Fix -Wnonportable-include-path suppression for header maps with absolute paths.In `DirectoryLookup::LookupFile` parameter `HasBeenMapped` doesn't coverthe case when clang finds a file through a he
Fix -Wnonportable-include-path suppression for header maps with absolute paths.In `DirectoryLookup::LookupFile` parameter `HasBeenMapped` doesn't coverthe case when clang finds a file through a header map but doesn't remapthe lookup filename because the target path is an absolute path. As aresult, -Wnonportable-include-path suppression for header mapsintroduced in r301592 wasn't triggered.Change parameter `HasBeenMapped` to `IsInHeaderMap` and use parameter`MappedName` to track the filename remapping. This way we can handleboth relative and absolute paths in header maps, and account for theirspecific properties, like filename remapping being a property preservedacross lookups in multiple directories.rdar://problem/39516483Reviewers: dexonsmith, brunoReviewed By: dexonsmithSubscribers: jkorous, cfe-commits, ributzkaDifferential Revision: https://reviews.llvm.org/D58094llvm-svn: 371655
show more ...
Preprocessor: Suppress -Wnonportable-include-path for header mapsIf a file search involves a header map, suppress-Wnonportable-include-path. It's firing lots of false positives forframework auth
Preprocessor: Suppress -Wnonportable-include-path for header mapsIf a file search involves a header map, suppress-Wnonportable-include-path. It's firing lots of false positives forframework authors internally, and it's not trivial to fix.Consider a framework called "Foo" with a main (installed) framework header"Foo/Foo.h". It's atypical for "Foo.h" to actually live inside adirectory called "Foo" in the source repository. Instead, thebuild system generates a header map while building the framework.If Foo.h lives at the top-level of the source repository (common), andthe git repo is called ssh://some.url/foo.git, then the header map willhave something like: Foo/Foo.h -> /Users/myname/code/foo/Foo.hwhere "/Users/myname/code/foo" is the clone of ssh://some.url/foo.git.After #import <Foo/Foo.h>, the current implementation of-Wnonportable-include-path will falsely assume that Foo.h was found in anonportable way, because of the name of the git clone (.../foo/Foo.h).However, that directory name was not involved in the header search atall.This commit adds an extra parameter to Preprocessor::LookupFile andHeaderSearch::LookupFile to track if the search used a header map,making it easy to suppress the warning. Longer term, once we find a wayto avoid the false positive, we should turn the warning back on.rdar://problem/28863903llvm-svn: 301592