aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Index/FileIndexRecord.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Index/FileIndexRecord.h')
-rw-r--r--clang/lib/Index/FileIndexRecord.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/clang/lib/Index/FileIndexRecord.h b/clang/lib/Index/FileIndexRecord.h
index 37bf96a71964..621d5b78977d 100644
--- a/clang/lib/Index/FileIndexRecord.h
+++ b/clang/lib/Index/FileIndexRecord.h
@@ -27,14 +27,13 @@ class FileIndexRecord {
private:
FileID FID;
bool IsSystem;
- std::vector<DeclOccurrence> Decls;
+ mutable bool IsSorted = false;
+ mutable std::vector<DeclOccurrence> Decls;
public:
FileIndexRecord(FileID FID, bool IsSystem) : FID(FID), IsSystem(IsSystem) {}
- ArrayRef<DeclOccurrence> getDeclOccurrencesSortedByOffset() const {
- return Decls;
- }
+ ArrayRef<DeclOccurrence> getDeclOccurrencesSortedByOffset() const;
FileID getFileID() const { return FID; }
bool isSystem() const { return IsSystem; }
@@ -48,7 +47,21 @@ public:
/// \param Relations the set of symbols related to this occurrence.
void addDeclOccurence(SymbolRoleSet Roles, unsigned Offset, const Decl *D,
ArrayRef<SymbolRelation> Relations);
- void print(llvm::raw_ostream &OS) const;
+
+ /// Adds an occurrence of the given macro at the supplied \c Offset.
+ ///
+ /// \param Roles the roles the occurrence fulfills in this position.
+ /// \param Offset the offset in the file of this occurrence.
+ /// \param Name the name of the macro.
+ /// \param MI the canonical declaration this is an occurrence of.
+ void addMacroOccurence(SymbolRoleSet Roles, unsigned Offset,
+ const IdentifierInfo *Name, const MacroInfo *MI);
+
+ /// Remove any macro occurrences for header guards. When preprocessing, this
+ /// will only be accurate after HandleEndOfFile.
+ void removeHeaderGuardMacros();
+
+ void print(llvm::raw_ostream &OS, SourceManager &SM) const;
};
} // end namespace index