Author: Wang Pengcheng Date: 2023-12-12T19:16:30+08:00 New Revision: 985c00819583a23b58d8c8cdeaefe6f9ed49e9cf
URL: https://github.com/llvm/llvm-project/commit/985c00819583a23b58d8c8cdeaefe6f9ed49e9cf DIFF: https://github.com/llvm/llvm-project/commit/985c00819583a23b58d8c8cdeaefe6f9ed49e9cf.diff LOG: [RISCV][NFC] Use AddTargetFeature to add fast-unaligned-access (#74280) We can reduce some code. Added: Modified: clang/lib/Driver/ToolChains/Arch/RISCV.cpp Removed: ################################################################################ diff --git a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp index 5d990ba78e5cc..0b696111e7d71 100644 --- a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp +++ b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp @@ -171,13 +171,8 @@ void riscv::getRISCVTargetFeatures(const Driver &D, const llvm::Triple &Triple, Features.push_back("-save-restore"); // -mno-unaligned-access is default, unless -munaligned-access is specified. - if (const Arg *A = Args.getLastArg(options::OPT_munaligned_access, - options::OPT_mno_unaligned_access)) { - if (A->getOption().matches(options::OPT_munaligned_access)) - Features.push_back("+fast-unaligned-access"); - else - Features.push_back("-fast-unaligned-access"); - } + AddTargetFeature(Args, Features, options::OPT_munaligned_access, + options::OPT_mno_unaligned_access, "fast-unaligned-access"); // Now add any that the user explicitly requested on the command line, // which may override the defaults. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits