forked from OSchip/llvm-project
Add PCH tests for R336379
I seemingly forgot the tests for this commit, added here. llvm-svn: 336380
This commit is contained in:
parent
76675de15c
commit
2623e14001
|
@ -0,0 +1,2 @@
|
|||
void foo() {
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
#include "Inputs/pch-through1.h"
|
||||
#include "Inputs/pch-through3.h"
|
||||
void foo() {
|
||||
through2(0);
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
void foo() {
|
||||
through4(0);
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
#define AFOO 0
|
||||
#include "Inputs/pch-through1.h"
|
|
@ -0,0 +1,3 @@
|
|||
#define AFOO 1
|
||||
#define BFOO 2
|
||||
#include "Inputs/pch-through1.h"
|
|
@ -0,0 +1,2 @@
|
|||
#define THROUGH1
|
||||
int through1(int);
|
|
@ -0,0 +1,2 @@
|
|||
#define THROUGH2
|
||||
int through2(int);
|
|
@ -0,0 +1,2 @@
|
|||
#define THROUGH3
|
||||
int through3(int);
|
|
@ -0,0 +1,2 @@
|
|||
#define THROUGH4
|
||||
int through4(int);
|
|
@ -0,0 +1,34 @@
|
|||
// Through header not found (anywhere)
|
||||
// RUN: not %clang_cc1 -emit-pch \
|
||||
// RUN: -pch-through-header=Inputs/pch-does-not-exist.h -o %t %s 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=CHECK-TEST0A %s
|
||||
// CHECK-TEST0A: fatal error:{{.*}} 'Inputs/pch-does-not-exist.h'
|
||||
// CHECK-TEST0A-SAME: required for precompiled header not found
|
||||
|
||||
// Through header not found in search path
|
||||
// RUN: not %clang_cc1 -emit-pch \
|
||||
// RUN: -pch-through-header=Inputs/pch-through2.h -o %t \
|
||||
// RUN: %S/Inputs/pch-through-use0.cpp 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=CHECK-TEST0B %s
|
||||
// CHECK-TEST0B: fatal error:{{.*}}'Inputs/pch-through2.h'
|
||||
// CHECK-TEST0B-SAME: required for precompiled header not found
|
||||
|
||||
// No #include of through header during pch create
|
||||
// RUN: not %clang_cc1 -I %S -emit-pch \
|
||||
// RUN: -pch-through-header=Inputs/pch-through2.h -o %t %s 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=CHECK-TEST1A %s
|
||||
// CHECK-TEST1A: fatal error:{{.*}} #include of
|
||||
// CHECK-TEST1A-SAME: 'Inputs/pch-through2.h' not seen while attempting to
|
||||
// CHECK-TEST1A-SAME: create precompiled header
|
||||
|
||||
// checks for through headers that are also -includes
|
||||
// RUN: %clang_cc1 -I %S -include Inputs/pch-through1.h \
|
||||
// RUN: -pch-through-header=Inputs/pch-through1.h -emit-pch -o %t.s3t1 %s
|
||||
// RUN: %clang_cc1 -I %S -include Inputs/pch-through1.h \
|
||||
// RUN: -include Inputs/pch-through2.h -include Inputs/pch-through3.h \
|
||||
// RUN: -pch-through-header=Inputs/pch-through2.h -emit-pch -o %t.s3t2 %s
|
||||
// Use through header from -includes
|
||||
// RUN: %clang_cc1 -I %S -include Inputs/pch-through1.h \
|
||||
// RUN: -include Inputs/pch-through2.h -include Inputs/pch-through4.h \
|
||||
// RUN: -pch-through-header=Inputs/pch-through2.h -include-pch %t.s3t2 \
|
||||
// RUN: %S/Inputs/pch-through-use2.cpp -o %t.out
|
|
@ -0,0 +1,28 @@
|
|||
// Create
|
||||
// RUN: %clang_cc1 -I %S -emit-pch \
|
||||
// RUN: -pch-through-header=Inputs/pch-through2.h -o %t.1 %s
|
||||
|
||||
// Use
|
||||
// RUN: %clang_cc1 -I %S -include-pch %t.1 \
|
||||
// RUN: -pch-through-header=Inputs/pch-through2.h %s
|
||||
|
||||
// No #include of through header during pch use
|
||||
// RUN: not %clang_cc1 -I %S -include-pch %t.1 \
|
||||
// RUN: -pch-through-header=Inputs/pch-through2.h \
|
||||
// RUN: %S/Inputs/pch-through-use1.cpp 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=CHECK-TEST2A %s
|
||||
// CHECK-TEST2A: fatal error:{{.*}} #include of
|
||||
// CHECK-TEST2A-SAME: 'Inputs/pch-through2.h' not seen while attempting to
|
||||
// CHECK-TEST2A-SAME: use precompiled header
|
||||
|
||||
// check that pch only contains code before the through header.
|
||||
// RUN: %clang_cc1 -I %S -emit-pch \
|
||||
// RUN: -pch-through-header=Inputs/pch-through1.h -o %t.2 %s
|
||||
// RUN: not %clang_cc1 -I %S -include-pch %t.2 \
|
||||
// RUN: -pch-through-header=Inputs/pch-through1.h \
|
||||
// RUN: %S/Inputs/pch-through-use1.cpp 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=CHECK-TEST3 %s
|
||||
// CHECK-TEST3: error: use of undeclared identifier 'through2'
|
||||
|
||||
#include "Inputs/pch-through1.h"
|
||||
#include "Inputs/pch-through2.h"
|
|
@ -0,0 +1,10 @@
|
|||
// RUN: %clang_cc1 -verify -I %S -emit-pch \
|
||||
// RUN: -pch-through-header=Inputs/pch-through1.h -o %t.s3at1 %s
|
||||
|
||||
// RUN: %clang_cc1 -I %S -include-pch %t.s3at1 \
|
||||
// RUN: -pch-through-header=Inputs/pch-through1.h \
|
||||
// RUN: %S/Inputs/pch-through-use3a.cpp
|
||||
//expected-no-diagnostics
|
||||
|
||||
#define AFOO 0
|
||||
#include "Inputs/pch-through1.h"
|
|
@ -0,0 +1,14 @@
|
|||
// RUN: %clang_cc1 -I %S -emit-pch \
|
||||
// RUN: -pch-through-header=Inputs/pch-through1.h -o %t.s3bt1 %s
|
||||
|
||||
// RUN: %clang_cc1 -I %S -include-pch %t.s3bt1 \
|
||||
// RUN: -pch-through-header=Inputs/pch-through1.h \
|
||||
// RUN: %S/Inputs/pch-through-use3b.cpp 2>&1 | FileCheck %s
|
||||
|
||||
//CHECK: warning: definition of macro 'AFOO' does not match definition in
|
||||
//CHECK-SAME: precompiled header
|
||||
//CHECK: warning: definition of macro 'BFOO' does not match definition in
|
||||
//CHECK-SAME: precompiled header
|
||||
|
||||
#define AFOO 0
|
||||
#include "Inputs/pch-through1.h"
|
Loading…
Reference in New Issue