From ffe5542eab6ccd9b09e1a4a951993e230d4f88a4 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Mon, 7 May 2018 20:26:09 +0000 Subject: [PATCH] [Driver] Use -fuse-line-directives by default in MSVC mode 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 | 4 ++-- test/Driver/cl-options.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Driver/ToolChains/Clang.cpp b/lib/Driver/ToolChains/Clang.cpp index ef76817c36..6f05fd1fa5 100644 --- a/lib/Driver/ToolChains/Clang.cpp +++ b/lib/Driver/ToolChains/Clang.cpp @@ -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. diff --git a/test/Driver/cl-options.c b/test/Driver/cl-options.c index 7e71fd2db9..ab0d2f9273 100644 --- a/test/Driver/cl-options.c +++ b/test/Driver/cl-options.c @@ -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 -- 2.40.0