Full discussion of this diff can be found here: http://lists.llvm.org/pipermail/cfe-dev/2016-April/048298.html
See D19842 for the corresponding LLVM diff.
Paths
| Differential D19843
Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths. ClosedPublic Authored by eric_niebler on May 2 2016, 5:26 PM.
Details
Summary Full discussion of this diff can be found here: http://lists.llvm.org/pipermail/cfe-dev/2016-April/048298.html See D19842 for the corresponding LLVM diff.
Diff Detail Event Timelineeric_niebler retitled this revision from to Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.. eric_niebler updated this object. Comment Actions Some minor remarks. Sorry for being finicky :).
Comment Actions Factor out TrySimplifyPath from Preprocessor::HandleIncludeDirective. Other review feedback. Comment Actions Nice job! Thanks for taking my remarks into account.
Comment Actions Thanks for the feedback, @curdeius. What happens now? Do I just wait until somebody accepts the llvm diff and this one? How do I increase the likelihood that that happens? Comment Actions Thanks for this! Sorry for the delay on the review side. Generally, the approach here looks fine, and I don't have any high-level concerns beyond a performance concern over whatever dark magic you're doing on the LLVM side to get this filename. Please add some tests for the FixItHint replacement text. See test/FixIt for examples of how to do this. I've left a handful of mostly-stylistic comments inline.
Comment Actions
Thanks for the suggestion. After adding tests for this, I noticed badness with the path separators in the FixIt hint when running on Windows. I'm working on a fix. Comment Actions LGTM once the LLVM side is landed.
This revision is now accepted and ready to land.May 27 2016, 3:04 PM eric_niebler edited edge metadata. Comment ActionsRemove stale comment, tweak for diagnostic wording. eric_niebler updated this object. Comment ActionsRework the patch to only warn by default for include files not found in system include directories, unless they are known "standard" headers that should be portable (C/C++/Posix/Boost). Add an additional warning -Wnonportable-system-include-path for turning the warning on for user code that #include's other system headers like <Windows.h>. (As always, warning within system headers are suppressed.) This revision is now accepted and ready to land.Jun 8 2016, 10:15 AM Comment Actions Looks OK to me, pending Bruno's confirmation that performance is acceptable.
Comment Actions
@bruno, you're not likely to find a difference for darwin + frameworks since the frameworks headers like Cocoa/Cocoa.h don't exist on-disk with that path -- at least not on my machine. As a result, the attempt to get the "real path name" fails and no diagnostic is issued; the code path you want to measure will never be hit. This appears to be a shortcoming of the way I'm trying to get the true case of the files as they are opened. Correctly handing this would greatly increase the complexity of the patch. Apple == :-(
eric_niebler edited edge metadata. Comment ActionsReplace StringSet with StringSwitch, ASCII range ends at 0x7f not 0xff, miscellaneous formatting tweaks. Comment Actions Thanks for the updates, LGTM (@bruno, did you get the performance numbers you wanted?) Comment Actions @rsmith wrote:
FWIW, I benchmarked (on Windows, where problems are likely to occur) with 3 implementations of warnByDefaultOnWrongCase: 1) StringSwitch, 2) StringSet, and 3) noop. I found no measurable performance difference between any of them. This code path just isn't hot enough to matter. If I don't hear back, maybe @twoh will merge these diffs again by EOD. And hopefully we'll hear fewer screams this time. :-) Comment Actions Looks like I need s/std::size_t/size_t/ to keep the win2008 buildbot happy. Also, Taewook and I are looking into the clang-format test failure, but my suspicion is that that one isn't ours. This revision is now accepted and ready to land.Jun 13 2016, 12:00 PM Comment Actions FormatTests unittest passes for me with just my patch. Not sure which diff is causing that failure but it seems not to be mine. Shall Taewook just commit the s/std::size_t/size_t/ change, or does something else need to be done (revert & resubmit)? Comment Actions I already reverted the path in http://reviews.llvm.org/rL272572, so re-commit should be the way to go. Comment Actions Win2008 buildbot still unhappy. Sorry about this guys. I suppose it's the constexpr. We don't have a win2008 machine locally to test on. Is there a way for us to run this through your gauntlet without actually doing a commit? Comment Actions FTR, I finally test it out for compile time and could not notice any difference besides noise. Thanks Eric!
Revision Contents
Diff 60615 include/clang/Basic/DiagnosticLexKinds.td
include/clang/Basic/FileManager.h
include/clang/Basic/VirtualFileSystem.h
include/clang/Lex/DirectoryLookup.h
include/clang/Lex/HeaderSearch.h
lib/Basic/FileManager.cpp
lib/Basic/VirtualFileSystem.cpp
lib/Lex/HeaderSearch.cpp
lib/Lex/PPDirectives.cpp
test/Lexer/Inputs/case-insensitive-include.h
test/Lexer/case-insensitive-include-ms.c
test/Lexer/case-insensitive-include.c
test/Lexer/case-insensitive-system-include.c
test/PCH/case-insensitive-include.c
|
Diagnostics should start with a lowercase letter and not end in a period.