[PATCH] D58094: Fix -Wnonportable-include-path suppression for header maps with absolute paths.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 11 19:52:16 PST 2019


vsapsai created this revision.
vsapsai added reviewers: dexonsmith, bruno.
Herald added a subscriber: jkorous.

In `DirectoryLookup::LookupFile` parameter `HasBeenMapped` doesn't cover
the case when clang finds a file through a header map but doesn't remap
the lookup filename because the target path is an absolute path. As a
result, -Wnonportable-include-path suppression for header maps
introduced in r301592 wasn't triggered.

Change parameter `HasBeenMapped` to `IsInHeaderMap` and use parameter
`MappedName` to track the filename remapping. This way we can handle
both relative and absolute paths in header maps, and account for their
specific properties, like filename remapping being a property preserved
across lookups in multiple directories.

rdar://problem/39516483


https://reviews.llvm.org/D58094

Files:
  clang/include/clang/Lex/DirectoryLookup.h
  clang/lib/Lex/HeaderSearch.cpp
  clang/test/Preprocessor/Inputs/nonportable-hmaps/foo.hmap.json
  clang/test/Preprocessor/Inputs/nonportable-hmaps/headers/foo/Bar.h
  clang/test/Preprocessor/nonportable-include-with-hmap.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58094.186389.patch
Type: text/x-patch
Size: 4880 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190212/ec2b1aa3/attachment.bin>


More information about the cfe-commits mailing list