[PCH] Check for isTopLevelDeclInObjCContainer when picking abbreviations.

llvm-svn: 145110
This commit is contained in:
Argyrios Kyrtzidis 2011-11-23 21:11:23 +00:00
parent 8ad3bab505
commit a72450057b
3 changed files with 10 additions and 3 deletions

View File

@ -184,6 +184,7 @@ void ASTDeclWriter::VisitTypedefDecl(TypedefDecl *D) {
D->RedeclLink.getNext() == D &&
!D->isInvalidDecl() &&
!D->isReferenced() &&
!D->isTopLevelDeclInObjCContainer() &&
D->getAccess() == AS_none &&
!D->isModulePrivate() &&
D->getDeclName().getNameKind() == DeclarationName::Identifier)
@ -234,6 +235,7 @@ void ASTDeclWriter::VisitEnumDecl(EnumDecl *D) {
D->RedeclLink.getNext() == D &&
!D->isInvalidDecl() &&
!D->isReferenced() &&
!D->isTopLevelDeclInObjCContainer() &&
D->getAccess() == AS_none &&
!D->isModulePrivate() &&
!CXXRecordDecl::classofKind(D->getKind()) &&
@ -257,6 +259,7 @@ void ASTDeclWriter::VisitRecordDecl(RecordDecl *D) {
D->RedeclLink.getNext() == D &&
!D->isInvalidDecl() &&
!D->isReferenced() &&
!D->isTopLevelDeclInObjCContainer() &&
D->getAccess() == AS_none &&
!D->isModulePrivate() &&
!CXXRecordDecl::classofKind(D->getKind()) &&
@ -627,6 +630,7 @@ void ASTDeclWriter::VisitFieldDecl(FieldDecl *D) {
!D->isUsed(false) &&
!D->isInvalidDecl() &&
!D->isReferenced() &&
!D->isTopLevelDeclInObjCContainer() &&
!D->isModulePrivate() &&
!D->getBitWidth() &&
!D->hasInClassInitializer() &&
@ -679,6 +683,7 @@ void ASTDeclWriter::VisitVarDecl(VarDecl *D) {
!D->isUsed(false) &&
!D->isInvalidDecl() &&
!D->isReferenced() &&
!D->isTopLevelDeclInObjCContainer() &&
D->getAccess() == AS_none &&
!D->isModulePrivate() &&
D->getDeclName().getNameKind() == DeclarationName::Identifier &&

View File

@ -27,7 +27,7 @@ static int glob2;
// CHECK-IMPL: Identifier: "meth1" [14:8 - 14:13] ObjCInstanceMethodDecl=meth1:14:1 (Definition)
// CHECK-IMPL: Identifier: "meth2" [15:8 - 15:13] ObjCInstanceMethodDecl=meth2:15:1 (Definition)
// RUN: c-index-test -test-annotate-tokens=%s.h:5:1:7:1 %s -include %t.h \
// RUN: c-index-test -test-annotate-tokens=%s.h:7:1:9:1 %s -include %t.h \
// RUN: | FileCheck -check-prefix=PCH %s
// CHECK-PCH: Identifier: "meth1" [5:8 - 5:13] ObjCInstanceMethodDecl=meth1:5:1
// CHECK-PCH: Identifier: "meth2" [6:8 - 6:13] ObjCInstanceMethodDecl=meth2:6:1
// CHECK-PCH: Identifier: "meth1" [7:8 - 7:13] ObjCInstanceMethodDecl=meth1:7:1
// CHECK-PCH: Identifier: "meth2" [8:8 - 8:13] ObjCInstanceMethodDecl=meth2:8:1

View File

@ -2,6 +2,8 @@
void funcPCH1(int);
void funcPCH2(int);
enum E { Cake };
-(void)meth1;
-(void)meth2;
@end