Author: Fangrui Song
Date: 2021-04-01T14:37:34-07:00
New Revision: 6fe7de90b9e4e466a5c2baadafd5f72d3203651d

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

LOG: [Driver] -nostdinc -nostdinc++: don't warn for 
-Wunused-command-line-argument

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Gnu.cpp
    clang/test/Driver/nostdincxx.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index 4a8a11a8d416..c08972f0d700 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2882,9 +2882,8 @@ void Generic_GCC::AddMultilibIncludeArgs(const ArgList 
&DriverArgs,
 
 void Generic_GCC::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
                                                ArgStringList &CC1Args) const {
-  if (DriverArgs.hasArg(options::OPT_nostdinc) ||
-      DriverArgs.hasArg(options::OPT_nostdincxx) ||
-      DriverArgs.hasArg(options::OPT_nostdlibinc))
+  if (DriverArgs.hasArg(options::OPT_nostdinc, options::OPT_nostdincxx,
+                        options::OPT_nostdlibinc))
     return;
 
   switch (GetCXXStdlibType(DriverArgs)) {

diff  --git a/clang/test/Driver/nostdincxx.cpp 
b/clang/test/Driver/nostdincxx.cpp
index 3fc7a5e76842..c919c73fa126 100644
--- a/clang/test/Driver/nostdincxx.cpp
+++ b/clang/test/Driver/nostdincxx.cpp
@@ -1,6 +1,7 @@
 // RUN: not %clangxx -nostdinc %s 2>&1 | FileCheck %s
 // RUN: not %clangxx -nostdinc++ %s 2>&1 | FileCheck %s
 // RUN: not %clangxx -nostdlibinc %s 2>&1 | FileCheck %s
+// RUN: not %clangxx -fsyntax-only -nostdinc -nostdinc++ %s 2>&1 | FileCheck 
/dev/null --implicit-check-not=-Wunused-command-line-argument
 // CHECK: file not found
 #include <vector> 
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to