[cfe-commits] r169558 - in /cfe/trunk/test/Index/skip-parsed-bodies: compile_commands.json pragma_once.h t2.cpp t3.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Thu Dec 6 15:04:24 PST 2012
Author: akirtzidis
Date: Thu Dec 6 17:04:24 2012
New Revision: 169558
URL: http://llvm.org/viewvc/llvm-project?rev=169558&view=rev
Log:
[libclang] Add a test to make sure we skip bodies properly from "#pragma once" headers.
Added:
cfe/trunk/test/Index/skip-parsed-bodies/pragma_once.h
Modified:
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/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=169558&r1=169557&r2=169558&view=diff
==============================================================================
--- cfe/trunk/test/Index/skip-parsed-bodies/compile_commands.json (original)
+++ cfe/trunk/test/Index/skip-parsed-bodies/compile_commands.json Thu Dec 6 17:04:24 2012
@@ -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
Added: cfe/trunk/test/Index/skip-parsed-bodies/pragma_once.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/skip-parsed-bodies/pragma_once.h?rev=169558&view=auto
==============================================================================
--- cfe/trunk/test/Index/skip-parsed-bodies/pragma_once.h (added)
+++ cfe/trunk/test/Index/skip-parsed-bodies/pragma_once.h Thu Dec 6 17:04:24 2012
@@ -0,0 +1,10 @@
+#pragma once
+
+extern int some_val;
+
+template <typename T>
+struct TS {
+ int tsmeth() {
+ ++some_val; return undef_tsval;
+ }
+};
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=169558&r1=169557&r2=169558&view=diff
==============================================================================
--- cfe/trunk/test/Index/skip-parsed-bodies/t2.cpp (original)
+++ cfe/trunk/test/Index/skip-parsed-bodies/t2.cpp Thu Dec 6 17:04:24 2012
@@ -1 +1,2 @@
#include "t.h"
+#include "pragma_once.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=169558&r1=169557&r2=169558&view=diff
==============================================================================
--- cfe/trunk/test/Index/skip-parsed-bodies/t3.cpp (original)
+++ cfe/trunk/test/Index/skip-parsed-bodies/t3.cpp Thu Dec 6 17:04:24 2012
@@ -1 +1,2 @@
#include "t.h"
+#include "pragma_once.h"
More information about the cfe-commits
mailing list