This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Use -fuse-line-directives by default in MSVC mode
ClosedPublic

Authored by mstorsjo on May 7 2018, 4:41 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

mstorsjo created this revision.May 7 2018, 4:41 AM
hans accepted this revision.May 7 2018, 4:51 AM

Seems reasonable to me (but please update the comment before landing).

lib/Driver/ToolChains/Clang.cpp
4218 ↗(On Diff #145446)

The comment needs an update I think.

This revision is now accepted and ready to land.May 7 2018, 4:51 AM
mstorsjo added inline comments.May 7 2018, 7:35 AM
lib/Driver/ToolChains/Clang.cpp
4218 ↗(On Diff #145446)

Thanks, will change into "-fno-use-line-directives is default, except for MSVC targets." before pushing.

This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.
rnk reopened this revision.May 8 2018, 5:19 PM

Please don't do this, this is actually really problematic, since #line directives lose information about what's a system header. That means the result of -E usually won't compile, since Windows headers are typically full of warnings and default-error warnings.

This revision is now accepted and ready to land.May 8 2018, 5:19 PM
smeenai added a subscriber: smeenai.May 8 2018, 5:27 PM
In D46520#1092233, @rnk wrote:

Please don't do this, this is actually really problematic, since #line directives lose information about what's a system header. That means the result of -E usually won't compile, since Windows headers are typically full of warnings and default-error warnings.

Oh, ok - I can revert it then; I didn't have any specific need for this, I just noticed that clang in msvc mode and cl.exe differed in this aspect.

hans added a comment.May 9 2018, 12:18 AM
In D46520#1092233, @rnk wrote:

Please don't do this, this is actually really problematic, since #line directives lose information about what's a system header. That means the result of -E usually won't compile, since Windows headers are typically full of warnings and default-error warnings.

Sorry, I didn't realize this was the case :-/

mstorsjo closed this revision.May 9 2018, 2:26 AM

Reverted in SVN r331858.

rnk added a comment.May 10 2018, 1:18 PM

Reverted in SVN r331858.

Thanks! When one attempts to generate pre-processed source with clang and compile it with MSVC, you usually have to remove clang's internal intrinsic headers from the include search path, otherwise you'll end up with references to builtins that don't exist in MSVC. Adding an extra -fuse-line-directives flag is just one more thing that you have to remember for that corner-case usage.