1- // RUN: %clang_cc1 -triple x86_64-apple-macosx10.15.0 -emit-pch -o %t %s
2- // RUN: %clang_analyze_cc1 -triple x86_64-apple-macosx10.15.0 -include-pch %t \
3- // RUN: -analyzer-checker=core,apiModeling,unix.StdCLibraryFunctions -verify %s
1+ // RUN: rm -rf %t
2+ // RUN: mkdir -p %t
3+ // RUN: split-file %s %t
4+
5+ // RUN: %clang_cc1 -x c++ -triple x86_64-apple-macosx10.15.0 -emit-pch -o %t/header.pch %t/header.h
6+ // RUN: %clang_analyze_cc1 -triple x86_64-apple-macosx10.15.0 -include-pch %t/header.pch \
7+ // RUN: -analyzer-checker=core,apiModeling,unix.StdCLibraryFunctions -verify %t/main.cpp
48//
5- // RUN: %clang_cc1 -emit-pch -o %t %s
6- // RUN: %clang_analyze_cc1 -include-pch %t \
7- // RUN: -analyzer-checker=core,apiModeling,unix.StdCLibraryFunctions -verify %s
9+ // RUN: %clang_cc1 -x c++ -emit-pch -o %t/header.pch %t/header.h
10+ // RUN: %clang_analyze_cc1 -include-pch %t/header.pch \
11+ // RUN: -analyzer-checker=core,apiModeling,unix.StdCLibraryFunctions -verify %t/main.cpp
12+
13+
14+ // --- header.h
815
9- // expected-no-diagnostics
1016
11- #ifndef HEADER
12- #define HEADER
1317// Pre-compiled header
1418
1519int foo ();
@@ -18,9 +22,12 @@ int foo();
1822#define EOF -1
1923#define AT_FDCWD -2
2024
21- #else
22- // Source file
2325
26+ // --- main.cpp
27+
28+
29+ // Source file
30+ // expected-no-diagnostics
2431int test () {
2532 // we need a function call here to initiate erroneous routine
2633 return foo (); // no-crash
@@ -36,4 +43,3 @@ void test_faccessat() {
3643 if (0 != faccessat (AT_FDCWD, fileSystemPath, 2 , 0x0030 )) {}
3744}
3845
39- #endif
0 commit comments