Return true from HeaderSearch::isFileMultipleIncludeGuarded if the file

was #import'ed.

llvm-svn: 169761
This commit is contained in:
Argyrios Kyrtzidis 2012-12-10 20:08:37 +00:00
parent 5d6faed1f0
commit 0d355df239
5 changed files with 14 additions and 1 deletions

View File

@ -749,7 +749,8 @@ bool HeaderSearch::isFileMultipleIncludeGuarded(const FileEntry *File) {
if (ExternalSource && !HFI.Resolved)
mergeHeaderFileInfo(HFI, ExternalSource->GetHeaderFileInfo(File));
return HFI.isPragmaOnce || HFI.ControllingMacro || HFI.ControllingMacroID;
return HFI.isPragmaOnce || HFI.isImport ||
HFI.ControllingMacro || HFI.ControllingMacroID;
}
void HeaderSearch::setHeaderFileInfoForUID(HeaderFileInfo HFI, unsigned UID) {

View File

@ -47,8 +47,11 @@
// 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: [indexDeclaration]: kind: function | name: imp_foo | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./imported.h:4:5
// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val4'
// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_tsval'
// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_impval'
// CHECK-NEXT: [enteredMainFile]: t3.cpp
// CHECK: [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
@ -63,4 +66,6 @@
// 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: [indexDeclaration]: kind: function | name: imp_foo | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
// CHECK-NOT: [indexEntityReference]: kind: variable | name: some_val |
// CHECK-NOT: [diagnostic]: {{.*}} undeclared identifier

View File

@ -0,0 +1,5 @@
extern int some_val;
static inline int imp_foo() {
++some_val; return undef_impval;
}

View File

@ -1,2 +1,3 @@
#include "t.h"
#include "pragma_once.h"
#import "imported.h"

View File

@ -1,2 +1,3 @@
#include "t.h"
#include "pragma_once.h"
#import "imported.h"