[cfe-commits] r169761 - in /cfe/trunk: lib/Lex/HeaderSearch.cpp test/Index/skip-parsed-bodies/compile_commands.json test/Index/skip-parsed-bodies/imported.h test/Index/skip-parsed-bodies/t2.cpp test/Index/skip-parsed-bodies/t3.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Mon Dec 10 12:08:37 PST 2012


Author: akirtzidis
Date: Mon Dec 10 14:08:37 2012
New Revision: 169761

URL: http://llvm.org/viewvc/llvm-project?rev=169761&view=rev
Log:
Return true from HeaderSearch::isFileMultipleIncludeGuarded if the file
was #import'ed.

Added:
    cfe/trunk/test/Index/skip-parsed-bodies/imported.h
Modified:
    cfe/trunk/lib/Lex/HeaderSearch.cpp
    cfe/trunk/test/Index/skip-parsed-bodies/compile_commands.json
    cfe/trunk/test/Index/skip-parsed-bodies/t2.cpp
    cfe/trunk/test/Index/skip-parsed-bodies/t3.cpp

Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=169761&r1=169760&r2=169761&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Mon Dec 10 14:08:37 2012
@@ -749,7 +749,8 @@
   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) {

Modified: cfe/trunk/test/Index/skip-parsed-bodies/compile_commands.json
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/skip-parsed-bodies/compile_commands.json?rev=169761&r1=169760&r2=169761&view=diff
==============================================================================
--- cfe/trunk/test/Index/skip-parsed-bodies/compile_commands.json (original)
+++ cfe/trunk/test/Index/skip-parsed-bodies/compile_commands.json Mon Dec 10 14:08:37 2012
@@ -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

Added: cfe/trunk/test/Index/skip-parsed-bodies/imported.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/skip-parsed-bodies/imported.h?rev=169761&view=auto
==============================================================================
--- cfe/trunk/test/Index/skip-parsed-bodies/imported.h (added)
+++ cfe/trunk/test/Index/skip-parsed-bodies/imported.h Mon Dec 10 14:08:37 2012
@@ -0,0 +1,5 @@
+extern int some_val;
+
+static inline int imp_foo() {
+  ++some_val; return undef_impval;
+}

Modified: cfe/trunk/test/Index/skip-parsed-bodies/t2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/skip-parsed-bodies/t2.cpp?rev=169761&r1=169760&r2=169761&view=diff
==============================================================================
--- cfe/trunk/test/Index/skip-parsed-bodies/t2.cpp (original)
+++ cfe/trunk/test/Index/skip-parsed-bodies/t2.cpp Mon Dec 10 14:08:37 2012
@@ -1,2 +1,3 @@
 #include "t.h"
 #include "pragma_once.h"
+#import "imported.h"

Modified: cfe/trunk/test/Index/skip-parsed-bodies/t3.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/skip-parsed-bodies/t3.cpp?rev=169761&r1=169760&r2=169761&view=diff
==============================================================================
--- cfe/trunk/test/Index/skip-parsed-bodies/t3.cpp (original)
+++ cfe/trunk/test/Index/skip-parsed-bodies/t3.cpp Mon Dec 10 14:08:37 2012
@@ -1,2 +1,3 @@
 #include "t.h"
 #include "pragma_once.h"
+#import "imported.h"





More information about the cfe-commits mailing list