blob: 07907dfb40d5b1deb71e391b0f2152431b2b48b2 [file] [log] [blame]
Volodymyr Sapsai2f843612019-09-11 20:39:04 +00001// REQUIRES: shell
Volodymyr Sapsaifdb83b52019-09-11 21:19:27 +00002// REQUIRES: case-insensitive-filesystem
Volodymyr Sapsai2f843612019-09-11 20:39:04 +00003
Bruno Cardoso Lopesdc3f88a2018-06-21 21:45:24 +00004// RUN: rm -f %t.hmap
Volodymyr Sapsai2f843612019-09-11 20:39:04 +00005// 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 Smithcfc1f6a2017-04-27 21:41:51 +00008// RUN: %clang_cc1 -Eonly \
Bruno Cardoso Lopesdc3f88a2018-06-21 21:45:24 +00009// RUN: -I%t.hmap \
Duncan P. N. Exon Smithcfc1f6a2017-04-27 21:41:51 +000010// 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 Sapsai2f843612019-09-11 20:39:04 +000023#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}}