Volodymyr Sapsai | 2f84361 | 2019-09-11 20:39:04 +0000 | [diff] [blame] | 1 | // REQUIRES: shell |
Volodymyr Sapsai | fdb83b5 | 2019-09-11 21:19:27 +0000 | [diff] [blame] | 2 | // REQUIRES: case-insensitive-filesystem |
Volodymyr Sapsai | 2f84361 | 2019-09-11 20:39:04 +0000 | [diff] [blame] | 3 | |
Bruno Cardoso Lopes | dc3f88a | 2018-06-21 21:45:24 +0000 | [diff] [blame] | 4 | // RUN: rm -f %t.hmap |
Volodymyr Sapsai | 2f84361 | 2019-09-11 20:39:04 +0000 | [diff] [blame] | 5 | // RUN: sed -e "s:INPUTS_DIR:%S/Inputs:g" \ |
| 6 | // RUN: %S/Inputs/nonportable-hmaps/foo.hmap.json > %t.hmap.json |
| 7 | // RUN: %hmaptool write %t.hmap.json %t.hmap |
Duncan P. N. Exon Smith | cfc1f6a | 2017-04-27 21:41:51 +0000 | [diff] [blame] | 8 | // RUN: %clang_cc1 -Eonly \ |
Bruno Cardoso Lopes | dc3f88a | 2018-06-21 21:45:24 +0000 | [diff] [blame] | 9 | // RUN: -I%t.hmap \ |
Duncan P. N. Exon Smith | cfc1f6a | 2017-04-27 21:41:51 +0000 | [diff] [blame] | 10 | // RUN: -I%S/Inputs/nonportable-hmaps \ |
| 11 | // RUN: %s -verify |
| 12 | // |
| 13 | // foo.hmap contains: Foo/Foo.h -> headers/foo/Foo.h |
| 14 | // |
| 15 | // Header search of "Foo/Foo.h" follows this path: |
| 16 | // 1. Look for "Foo/Foo.h". |
| 17 | // 2. Find "Foo/Foo.h" in "nonportable-hmaps/foo.hmap". |
| 18 | // 3. Look for "headers/foo/Foo.h". |
| 19 | // 4. Find "headers/foo/Foo.h" in "nonportable-hmaps". |
| 20 | // 5. Return. |
| 21 | // |
| 22 | // There is nothing nonportable; -Wnonportable-include-path should not fire. |
Volodymyr Sapsai | 2f84361 | 2019-09-11 20:39:04 +0000 | [diff] [blame] | 23 | #include "Foo/Foo.h" // no warning |
| 24 | |
| 25 | // Verify files with absolute paths in the header map are handled too. |
| 26 | // "Bar.h" is included twice to make sure that when we see potentially |
| 27 | // nonportable path, the file has been already discovered through a relative |
| 28 | // path which triggers the file to be opened and `FileEntry::RealPathName` |
| 29 | // to be set. |
| 30 | #include "Bar.h" |
| 31 | #include "Foo/Bar.h" // no warning |
| 32 | |
| 33 | // But the presence of the absolute path in the header map is not enough. If we |
| 34 | // didn't use it to discover a file, shouldn't suppress the warning. |
| 35 | #include "headers/Foo/Baz.h" // expected-warning {{non-portable path}} |