forked from OSchip/llvm-project
[libclang] Add a test to make sure we skip bodies properly from "#pragma once" headers.
llvm-svn: 169558
This commit is contained in:
parent
74aa8f1141
commit
fc7f04510c
|
@ -42,9 +42,13 @@
|
|||
// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS |
|
||||
// CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C |
|
||||
// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
|
||||
// CHECK-NEXT: [ppIncludedFile]: ./pragma_once.h
|
||||
// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo2 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
|
||||
// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:25:5
|
||||
// CHECK: [indexDeclaration]: kind: c++-instance-method | name: tsmeth | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
|
||||
// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./pragma_once.h:8:7
|
||||
// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val4'
|
||||
// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_tsval'
|
||||
|
||||
// CHECK-NEXT: [enteredMainFile]: t3.cpp
|
||||
// CHECK: [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
|
||||
|
@ -54,5 +58,9 @@
|
|||
// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS |
|
||||
// CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C |
|
||||
// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
|
||||
// CHECK-NEXT: [ppIncludedFile]: ./pragma_once.h
|
||||
// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo2 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
|
||||
// CHECK-NOT : [diagnostic]: {{.*}} undeclared identifier
|
||||
// CHECK-NEXT: [indexDeclaration]: kind: variable | {{.*}} | loc: ./pragma_once.h:3:12
|
||||
// CHECK: [indexDeclaration]: kind: c++-instance-method | name: tsmeth | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
|
||||
// CHECK-NOT: [indexEntityReference]: kind: variable | name: some_val |
|
||||
// CHECK-NOT: [diagnostic]: {{.*}} undeclared identifier
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
extern int some_val;
|
||||
|
||||
template <typename T>
|
||||
struct TS {
|
||||
int tsmeth() {
|
||||
++some_val; return undef_tsval;
|
||||
}
|
||||
};
|
|
@ -1 +1,2 @@
|
|||
#include "t.h"
|
||||
#include "pragma_once.h"
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
#include "t.h"
|
||||
#include "pragma_once.h"
|
||||
|
|
Loading…
Reference in New Issue