This is an archive of the discontinued LLVM Phabricator instance.

[MSVC] Don't add -nostdinc++ -isystem to runtimes builds
ClosedPublic

Authored by rnk on Jan 15 2021, 12:38 PM.

Details

Summary

If the host compiler is MSVC or clang-cl, then the compiler used to
buidl the runtimes will be clang-cl, and it doesn't support either of
those flags.

Worse, because -isystem is a space separated flag, it causes all cmake
try_compile tests to fail, so none of the -Wno-* flags make it to the
compiler in libcxx. I noticed that we weren't passing
-Wno-user-defined-literals to clang-cl and were getting warnings in the
build, and this fixes that for me.

Diff Detail

Event Timeline

rnk created this revision.Jan 15 2021, 12:38 PM
rnk requested review of this revision.Jan 15 2021, 12:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 15 2021, 12:38 PM
mstorsjo added inline comments.Jan 15 2021, 12:48 PM
runtimes/CMakeLists.txt
81

Doesn't the runtimes build system support cross compiling runtimes? (I don't use it myself as I need to build a number of other components between building the compiler and building the llvm provided runtimes, but afaik it's possible.) In that case, the logic for deducing things from the host compiler wouldn't apply...

rnk added inline comments.Jan 15 2021, 1:03 PM
runtimes/CMakeLists.txt
81

You're right, this comment is incorrect, I think this CMakeLists.txt file is configured using the just-built clang. I had misunderstood how the runtimes build is put together. If we get here and MSVC is true, we must be using clang-cl, but the actual code change still makes sense.

rnk updated this revision to Diff 317054.Jan 15 2021, 1:05 PM
  • fix misleading comment
This revision is now accepted and ready to land.Jan 15 2021, 1:11 PM
This revision was landed with ongoing or failed builds.Jan 15 2021, 1:22 PM
This revision was automatically updated to reflect the committed changes.