[clang] c418d0f - [Driver] Simplify -fno-builtin- handling. NFC

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 15 13:35:12 PDT 2022


Author: Fangrui Song
Date: 2022-06-15T13:35:08-07:00
New Revision: c418d0f1be50545daa68e5abf8771db2e1b00819

URL: https://github.com/llvm/llvm-project/commit/c418d0f1be50545daa68e5abf8771db2e1b00819
DIFF: https://github.com/llvm/llvm-project/commit/c418d0f1be50545daa68e5abf8771db2e1b00819.diff

LOG: [Driver] Simplify -fno-builtin- handling. NFC

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Clang.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 0f251614eac22..43373083f8aab 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -3577,20 +3577,13 @@ static void RenderBuiltinOptions(const ToolChain &TC, const llvm::Triple &T,
     UseBuiltins = false;
 
   // Process the -fno-builtin-* options.
-  for (const auto &Arg : Args) {
-    const Option &O = Arg->getOption();
-    if (!O.matches(options::OPT_fno_builtin_))
-      continue;
-
-    Arg->claim();
+  for (const Arg *A : Args.filtered(options::OPT_fno_builtin_)) {
+    A->claim();
 
     // If -fno-builtin is specified, then there's no need to pass the option to
     // the frontend.
-    if (!UseBuiltins)
-      continue;
-
-    StringRef FuncName = Arg->getValue();
-    CmdArgs.push_back(Args.MakeArgString("-fno-builtin-" + FuncName));
+    if (UseBuiltins)
+      A->render(Args, CmdArgs);
   }
 
   // le32-specific flags:


        


More information about the cfe-commits mailing list