Author: Qichao Gu
Date: 2022-01-18T06:16:44-08:00
New Revision: 67ac3f1fbeec6ac53a2e32014fe277e49c77b182

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

LOG: [Driver] Pass the flag -dI to cc1 invocation

Hook up the flag -dI in the driver to pass it to cc1 invocation.

Differential Revision: https://reviews.llvm.org/D117292

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Clang.cpp
    clang/test/Driver/preprocessor.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index d4afefcb24a98..fd300fbe40145 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6666,6 +6666,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
 
   Args.AddLastArg(CmdArgs, options::OPT_dM);
   Args.AddLastArg(CmdArgs, options::OPT_dD);
+  Args.AddLastArg(CmdArgs, options::OPT_dI);
 
   Args.AddLastArg(CmdArgs, options::OPT_fmax_tokens_EQ);
 

diff  --git a/clang/test/Driver/preprocessor.c 
b/clang/test/Driver/preprocessor.c
index 09c1f6c29cc65..d396142cb2ec1 100644
--- a/clang/test/Driver/preprocessor.c
+++ b/clang/test/Driver/preprocessor.c
@@ -4,3 +4,11 @@
 #define A B
 A A
 
+// The driver should pass preprocessor dump flags (-dD, -dM and -dI) to cc1 
invocation
+// RUN: %clang -### -E -dD %s 2>&1 | FileCheck --check-prefix=CHECK-dD %s
+// RUN: %clang -### -E -dM %s 2>&1 | FileCheck --check-prefix=CHECK-dM %s
+// RUN: %clang -### -E -dI %s 2>&1 | FileCheck --check-prefix=CHECK-dI %s
+// CHECK-dD: clang{{.*}} "-cc1" {{.*}} "-dD"
+// CHECK-dM: clang{{.*}} "-cc1" {{.*}} "-dM"
+// CHECK-dI: clang{{.*}} "-cc1" {{.*}} "-dI"
+


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

Reply via email to