benlangmuir updated this revision to Diff 550474.
benlangmuir added a reviewer: vsapsai.
benlangmuir added a comment.
Add missing test updates: tests using the `Inputs/System/usr/include` should be
using `-internal-isystem` to get the correct search path order with respect to
the resource dir. The tests that were previously using `-isystem` were only
working before because the other headers wrap their `#include_next` in
`__has_include_next`, which was causing them to silently be missing these
headers. With inttypes.h the include_next is unguarded, which revealed the
issue. Note: even if we someday add the has_include_next guard to inttypes.h
the test change is still correct.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158021/new/
https://reviews.llvm.org/D158021
Files:
clang/lib/Lex/ModuleMap.cpp
clang/test/Modules/Inputs/System/usr/include/module.map
clang/test/Modules/Werror-Wsystem-headers.m
clang/test/Modules/crash-vfs-include-pch.m
clang/test/Modules/cstd.m
clang/test/Modules/pch-used.m
Index: clang/test/Modules/pch-used.m
===================================================================
--- clang/test/Modules/pch-used.m
+++ clang/test/Modules/pch-used.m
@@ -1,8 +1,8 @@
// UNSUPPORTED: target={{.*}}-zos{{.*}}, target={{.*}}-aix{{.*}}
// RUN: rm -rf %t
// RUN: mkdir %t
-// RUN: %clang_cc1 -x objective-c-header -emit-pch %S/Inputs/pch-used.h -o %t/pch-used.h.pch -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -O0 -isystem %S/Inputs/System/usr/include
-// RUN: %clang_cc1 %s -include-pch %t/pch-used.h.pch -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -O0 -isystem %S/Inputs/System/usr/include -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -x objective-c-header -emit-pch %S/Inputs/pch-used.h -o %t/pch-used.h.pch -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -O0 -internal-isystem %S/Inputs/System/usr/include
+// RUN: %clang_cc1 %s -include-pch %t/pch-used.h.pch -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -O0 -internal-isystem %S/Inputs/System/usr/include -emit-llvm -o - | FileCheck %s
void f(void) { SPXTrace(); }
void g(void) { double x = DBL_MAX; }
Index: clang/test/Modules/cstd.m
===================================================================
--- clang/test/Modules/cstd.m
+++ clang/test/Modules/cstd.m
@@ -28,3 +28,11 @@
# error "bool was not defined!"
#endif
+// Supplied by compiler, which forwards to the "/usr/include" version.
+@import cstd.inttypes;
+#ifndef __CLANG_INTTYPES_H
+#error "__CLANG_INTTYPES_H was not defined!"
+#endif
+#ifndef MY_PRIi32
+#error "MY_PRIi32 was not defined!"
+#endif
Index: clang/test/Modules/crash-vfs-include-pch.m
===================================================================
--- clang/test/Modules/crash-vfs-include-pch.m
+++ clang/test/Modules/crash-vfs-include-pch.m
@@ -6,12 +6,12 @@
// RUN: %clang_cc1 -x objective-c-header -emit-pch %S/Inputs/pch-used.h \
// RUN: -o %t/out/pch-used.h.pch -fmodules -fimplicit-module-maps \
// RUN: -fmodules-cache-path=%t/cache -O0 \
-// RUN: -isystem %S/Inputs/System/usr/include
+// RUN: -internal-isystem %S/Inputs/System/usr/include
// RUN: env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \
// RUN: not %clang %s -E -include-pch %t/out/pch-used.h.pch -fmodules -nostdlibinc \
// RUN: -fimplicit-module-maps -fmodules-cache-path=%t/cache -O0 \
-// RUN: -Xclang -fno-validate-pch -isystem %S/Inputs/System/usr/include \
+// RUN: -Xclang -fno-validate-pch -Xclang -internal-isystem -Xclang %S/Inputs/System/usr/include \
// RUN: -o %t/output.E 2>&1 | FileCheck %s
// RUN: FileCheck --check-prefix=CHECKSH %s -input-file %t/crash-vfs-*.sh
Index: clang/test/Modules/Werror-Wsystem-headers.m
===================================================================
--- clang/test/Modules/Werror-Wsystem-headers.m
+++ clang/test/Modules/Werror-Wsystem-headers.m
@@ -4,17 +4,17 @@
// Initial module build
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \
-// RUN: -isystem %S/Inputs/System/usr/include -fsyntax-only %s -verify
+// RUN: -internal-isystem %S/Inputs/System/usr/include -fsyntax-only %s -verify
// RUN: cp %t/cstd.pcm %t-saved/cstd.pcm
// Even with -Werror don't rebuild a system module
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \
-// RUN: -isystem %S/Inputs/System/usr/include -fsyntax-only %s -verify -Werror
+// RUN: -internal-isystem %S/Inputs/System/usr/include -fsyntax-only %s -verify -Werror
// RUN: diff %t/cstd.pcm %t-saved/cstd.pcm
// Unless -Wsystem-headers is on
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \
-// RUN: -isystem %S/Inputs/System/usr/include -fsyntax-only %s -verify \
+// RUN: -internal-isystem %S/Inputs/System/usr/include -fsyntax-only %s -verify \
// RUN: -Werror=unused -Wsystem-headers
// RUN: not diff %t/cstd.pcm %t-saved/cstd.pcm
Index: clang/test/Modules/Inputs/System/usr/include/module.map
===================================================================
--- clang/test/Modules/Inputs/System/usr/include/module.map
+++ clang/test/Modules/Inputs/System/usr/include/module.map
@@ -4,6 +4,11 @@
header "float.h"
}
+ // In both directories (compiler support version wins, forwards)
+ module inttypes {
+ header "inttypes.h"
+ }
+
// Only in system headers directory
module stdio {
header "stdio.h"
Index: clang/lib/Lex/ModuleMap.cpp
===================================================================
--- clang/lib/Lex/ModuleMap.cpp
+++ clang/lib/Lex/ModuleMap.cpp
@@ -379,6 +379,7 @@
bool ModuleMap::isBuiltinHeader(StringRef FileName) {
return llvm::StringSwitch<bool>(FileName)
.Case("float.h", true)
+ .Case("inttypes.h", true)
.Case("iso646.h", true)
.Case("limits.h", true)
.Case("stdalign.h", true)
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits