]> granicus.if.org Git - clang/commitdiff
[Driver] Use -fuse-line-directives by default in MSVC mode
authorMartin Storsjo <martin@martin.st>
Mon, 7 May 2018 20:26:09 +0000 (20:26 +0000)
committerMartin Storsjo <martin@martin.st>
Mon, 7 May 2018 20:26:09 +0000 (20:26 +0000)
Don't use the GNU extension form of line markers in MSVC mode.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331666 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/Clang.cpp
test/Driver/cl-options.c

index ef76817c36249e41e3875768a7250fdace610fe2..6f05fd1fa51a9ef484f0c6b5f1eead175c4d0445 100644 (file)
@@ -4215,9 +4215,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
                    IsWindowsMSVC))
     CmdArgs.push_back("-fms-extensions");
 
-  // -fno-use-line-directives is default.
+  // -fno-use-line-directives is default, except for MSVC targets.
   if (Args.hasFlag(options::OPT_fuse_line_directives,
-                   options::OPT_fno_use_line_directives, false))
+                   options::OPT_fno_use_line_directives, IsWindowsMSVC))
     CmdArgs.push_back("-fuse-line-directives");
 
   // -fms-compatibility=0 is default.
index 7e71fd2db903987bbeb182ab797e004995bb004c..ab0d2f9273596e1d012c64f23b9041628f8f7895 100644 (file)
@@ -28,6 +28,7 @@
 
 // RUN: %clang_cl /E -### -- %s 2>&1 | FileCheck -check-prefix=E %s
 // E: "-E"
+// E: "-fuse-line-directives"
 // E: "-o" "-"
 
 // RUN: %clang_cl /EP -### -- %s 2>&1 | FileCheck -check-prefix=EP %s