summaryrefslogtreecommitdiffstats
path: root/tools/libclang/IndexingContext.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/libclang/IndexingContext.h')
-rw-r--r--tools/libclang/IndexingContext.h64
1 files changed, 39 insertions, 25 deletions
diff --git a/tools/libclang/IndexingContext.h b/tools/libclang/IndexingContext.h
index 93d4718e27..6271660c33 100644
--- a/tools/libclang/IndexingContext.h
+++ b/tools/libclang/IndexingContext.h
@@ -25,9 +25,24 @@ namespace clang {
namespace cxindex {
class IndexingContext;
- class ScratchAlloc;
class AttrListInfo;
+class ScratchAlloc {
+ IndexingContext &IdxCtx;
+
+public:
+ explicit ScratchAlloc(IndexingContext &indexCtx);
+ ScratchAlloc(const ScratchAlloc &SA);
+
+ ~ScratchAlloc();
+
+ const char *toCStr(StringRef Str);
+ const char *copyCStr(StringRef Str);
+
+ template <typename T>
+ T *allocate();
+};
+
struct EntityInfo : public CXIdxEntityInfo {
const NamedDecl *Dcl;
IndexingContext *IndexCtx;
@@ -229,16 +244,20 @@ struct IBOutletCollectionInfo : public AttrInfo {
};
class AttrListInfo {
+ ScratchAlloc SA;
+
SmallVector<AttrInfo, 2> Attrs;
SmallVector<IBOutletCollectionInfo, 2> IBCollAttrs;
SmallVector<CXIdxAttrInfo *, 2> CXAttrs;
unsigned ref_cnt;
+ AttrListInfo(const AttrListInfo&); // DO NOT IMPLEMENT
+ void operator=(const AttrListInfo&); // DO NOT IMPLEMENT
public:
- AttrListInfo(const Decl *D,
- IndexingContext &IdxCtx,
- ScratchAlloc &SA);
- AttrListInfo(const AttrListInfo &other);
+ AttrListInfo(const Decl *D, IndexingContext &IdxCtx);
+
+ static IntrusiveRefCntPtr<AttrListInfo> create(const Decl *D,
+ IndexingContext &IdxCtx);
const CXIdxAttrInfo *const *getAttrs() const {
if (CXAttrs.empty())
@@ -488,28 +507,23 @@ private:
static bool shouldIgnoreIfImplicit(const Decl *D);
};
-class ScratchAlloc {
- IndexingContext &IdxCtx;
-
-public:
- explicit ScratchAlloc(IndexingContext &indexCtx) : IdxCtx(indexCtx) {
- ++IdxCtx.StrAdapterCount;
- }
-
- ~ScratchAlloc() {
- --IdxCtx.StrAdapterCount;
- if (IdxCtx.StrAdapterCount == 0)
- IdxCtx.StrScratch.Reset();
- }
+inline ScratchAlloc::ScratchAlloc(IndexingContext &idxCtx) : IdxCtx(idxCtx) {
+ ++IdxCtx.StrAdapterCount;
+}
+inline ScratchAlloc::ScratchAlloc(const ScratchAlloc &SA) : IdxCtx(SA.IdxCtx) {
+ ++IdxCtx.StrAdapterCount;
+}
- const char *toCStr(StringRef Str);
- const char *copyCStr(StringRef Str);
+inline ScratchAlloc::~ScratchAlloc() {
+ --IdxCtx.StrAdapterCount;
+ if (IdxCtx.StrAdapterCount == 0)
+ IdxCtx.StrScratch.Reset();
+}
- template <typename T>
- T *allocate() {
- return IdxCtx.StrScratch.Allocate<T>();
- }
-};
+template <typename T>
+inline T *ScratchAlloc::allocate() {
+ return IdxCtx.StrScratch.Allocate<T>();
+}
}} // end clang::cxindex