summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/IndexingContext.h
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-23 20:27:26 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-23 20:27:26 +0000
commit41fc05cad83dcc1fbd5928129103289cb5724569 (patch)
tree0ef7b7b8f83cc4827720474c36497cb081813b8c /clang/tools/libclang/IndexingContext.h
parent6e013bf96c295acfe5da99ded7686488a496d376 (diff)
downloadbcm5719-llvm-41fc05cad83dcc1fbd5928129103289cb5724569.tar.gz
bcm5719-llvm-41fc05cad83dcc1fbd5928129103289cb5724569.zip
[libclang] Indexing API: Fix issues, mostly C++ related.
llvm-svn: 145107
Diffstat (limited to 'clang/tools/libclang/IndexingContext.h')
-rw-r--r--clang/tools/libclang/IndexingContext.h25
1 files changed, 10 insertions, 15 deletions
diff --git a/clang/tools/libclang/IndexingContext.h b/clang/tools/libclang/IndexingContext.h
index cbf96d8dbb1..9a9fb3f4f0b 100644
--- a/clang/tools/libclang/IndexingContext.h
+++ b/clang/tools/libclang/IndexingContext.h
@@ -28,6 +28,10 @@ namespace cxindex {
struct EntityInfo : public CXIdxEntityInfo {
const NamedDecl *Dcl;
IndexingContext *IndexCtx;
+
+ EntityInfo() {
+ name = USR = 0;
+ }
};
struct ContainerInfo : public CXIdxContainerInfo {
@@ -225,35 +229,25 @@ class IndexingContext {
SmallVector<DeclGroupRef, 8> TUDeclsInObjCContainer;
- llvm::SmallString<256> StrScratch;
+ llvm::BumpPtrAllocator StrScratch;
unsigned StrAdapterCount;
class StrAdapter {
- llvm::SmallString<256> &Scratch;
IndexingContext &IdxCtx;
public:
- StrAdapter(IndexingContext &indexCtx)
- : Scratch(indexCtx.StrScratch), IdxCtx(indexCtx) {
+ StrAdapter(IndexingContext &indexCtx) : IdxCtx(indexCtx) {
++IdxCtx.StrAdapterCount;
}
~StrAdapter() {
--IdxCtx.StrAdapterCount;
if (IdxCtx.StrAdapterCount == 0)
- Scratch.clear();
+ IdxCtx.StrScratch.Reset();
}
const char *toCStr(StringRef Str);
-
- unsigned getCurSize() const { return Scratch.size(); }
-
- const char *getCStr(unsigned CharIndex) {
- Scratch.push_back('\0');
- return Scratch.data() + CharIndex;
- }
-
- SmallVectorImpl<char> &getBuffer() { return Scratch; }
+ const char *copyCStr(StringRef Str);
};
struct ObjCProtocolListInfo {
@@ -305,7 +299,8 @@ public:
IndexingContext(CXClientData clientData, IndexerCallbacks &indexCallbacks,
unsigned indexOptions, CXTranslationUnit cxTU)
: Ctx(0), ClientData(clientData), CB(indexCallbacks),
- IndexOptions(indexOptions), CXTU(cxTU), StrAdapterCount(0) { }
+ IndexOptions(indexOptions), CXTU(cxTU),
+ StrScratch(/*size=*/1024), StrAdapterCount(0) { }
ASTContext &getASTContext() const { return *Ctx; }
OpenPOWER on IntegriCloud