[cfe-commits] r145859 - in /cfe/trunk: include/clang-c/Index.h tools/c-index-test/c-index-test.c tools/libclang/IndexingContext.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Mon Dec 5 14:05:28 PST 2011
Author: akirtzidis
Date: Mon Dec 5 16:05:28 2011
New Revision: 145859
URL: http://llvm.org/viewvc/llvm-project?rev=145859&view=rev
Log:
[libclang] When indexing a field in a C++ class, return an entity
of kind CXIdxEntity_CXXInstanceVariable. rdar://10522503.
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/tools/c-index-test/c-index-test.c
cfe/trunk/tools/libclang/IndexingContext.cpp
Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=145859&r1=145858&r2=145859&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Mon Dec 5 16:05:28 2011
@@ -4031,7 +4031,8 @@
CXIdxEntity_CXXConstructor = 22,
CXIdxEntity_CXXDestructor = 23,
CXIdxEntity_CXXConversionFunction = 24,
- CXIdxEntity_CXXTypeAlias = 25
+ CXIdxEntity_CXXTypeAlias = 25,
+ CXIdxEntity_CXXInstanceVariable = 26
} CXIdxEntityKind;
Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=145859&r1=145858&r2=145859&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Mon Dec 5 16:05:28 2011
@@ -1641,6 +1641,7 @@
case CXIdxEntity_CXXNamespace: return "namespace";
case CXIdxEntity_CXXNamespaceAlias: return "namespace-alias";
case CXIdxEntity_CXXStaticVariable: return "c++-static-var";
+ case CXIdxEntity_CXXInstanceVariable: return "c++-instance-var";
case CXIdxEntity_CXXStaticMethod: return "c++-static-method";
case CXIdxEntity_CXXInstanceMethod: return "c++-instance-method";
case CXIdxEntity_CXXConstructor: return "constructor";
Modified: cfe/trunk/tools/libclang/IndexingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexingContext.cpp?rev=145859&r1=145858&r2=145859&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexingContext.cpp (original)
+++ cfe/trunk/tools/libclang/IndexingContext.cpp Mon Dec 5 16:05:28 2011
@@ -736,7 +736,12 @@
EntityInfo.kind = CXIdxEntity_CXXStaticVariable;
break;
case Decl::Field:
- EntityInfo.kind = CXIdxEntity_Field; break;
+ EntityInfo.kind = CXIdxEntity_Field;
+ if (const CXXRecordDecl *
+ CXXRec = dyn_cast<CXXRecordDecl>(D->getDeclContext()))
+ if (!CXXRec->isPOD())
+ EntityInfo.kind = CXIdxEntity_CXXInstanceVariable;
+ break;
case Decl::EnumConstant:
EntityInfo.kind = CXIdxEntity_EnumConstant; break;
case Decl::ObjCInterface:
More information about the cfe-commits
mailing list