This is an archive of the discontinued LLVM Phabricator instance.

[Darwin] Add a warning for missing include path for libstdc++
ClosedPublic

Authored by arphaman on Jun 18 2018, 2:03 PM.

Details

Summary

Xcode 10 removes support for libstdc++, but the users just get a confusing include not file warning when including an STL header (when building for iOS6 which uses libstdc++ by default for example).
This patch adds a new warning that lets the user know that the libstdc++ include path was not found to ensure that the user is more aware of why the error occurs.

rdar://40830462

Diff Detail

Repository
rL LLVM

Event Timeline

arphaman created this revision.Jun 18 2018, 2:03 PM
bruno added inline comments.Jun 18 2018, 2:26 PM
lib/Frontend/InitHeaderSearch.cpp
491 ↗(On Diff #151786)

If we happen to suggest libc++, but it's also not there, do we still want the warning? Should we check it exists first?

arphaman added inline comments.Jun 18 2018, 2:38 PM
lib/Frontend/InitHeaderSearch.cpp
491 ↗(On Diff #151786)

I don't think such a check is that valuable on Darwin, which is where this warning fires, since libc++ is the default standard library on Darwin.

vsapsai added inline comments.Jun 18 2018, 2:59 PM
lib/Frontend/InitHeaderSearch.cpp
374–377 ↗(On Diff #151786)

Why are you using &= here instead of |=? I haven't tested but I expect that either 4.2.1 will work or 4.0.0, you don't need both of them.

404 ↗(On Diff #151786)

What is so special about CUDA? Is it OK to emit the warning for OpenCL, for instance?

test/Frontend/warning-stdlibcxx-darwin.cpp
1–2 ↗(On Diff #151786)

Do you think there is a value in adding a test that does exactly what the warning suggests and verifies there are no warnings?

arphaman marked 3 inline comments as done.Jun 19 2018, 10:48 AM
arphaman added inline comments.
lib/Frontend/InitHeaderSearch.cpp
374–377 ↗(On Diff #151786)

Good catch, fixed.

404 ↗(On Diff #151786)

We're looking to warn for pure C++/ObjC++, so I will disable it for other language dialects.

test/Frontend/warning-stdlibcxx-darwin.cpp
1–2 ↗(On Diff #151786)

Good call.

arphaman updated this revision to Diff 151944.Jun 19 2018, 10:49 AM
arphaman marked 3 inline comments as done.

Addressed review comments

bruno accepted this revision.Jun 19 2018, 10:56 AM

LGTM

This revision is now accepted and ready to land.Jun 19 2018, 10:56 AM
This revision was automatically updated to reflect the committed changes.