Skip to content

Commit 2934d72

Browse files
committed
[index] Fix compile after merge
This is a minimal change to fix the build/tests; a change to actually use the new macro support is forthcoming.
1 parent 06ee794 commit 2934d72

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

clang/lib/Index/ClangIndexRecordWriter.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ bool ClangIndexRecordWriter::writeRecord(StringRef Filename,
8282
for (auto &Rel : Occur.Relations)
8383
Related.push_back(writer::SymbolRelation{Rel.RelatedSymbol, Rel.Roles});
8484

85-
Impl.addOccurrence(Occur.Dcl, Occur.Roles, Line, Col, Related);
85+
// FIXME: handle macro occurrence
86+
if (auto *D = Occur.DeclOrMacro.dyn_cast<const Decl *>())
87+
Impl.addOccurrence(D, Occur.Roles, Line, Col, Related);
8688
}
8789

8890
PrintingPolicy Policy(Ctx.getLangOpts());

clang/lib/Index/IndexRecordHasher.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,10 @@ class DeclHashVisitor : public ConstDeclVisitor<DeclHashVisitor, hash_code> {
157157
hash_code IndexRecordHasher::hashRecord(const FileIndexRecord &Record) {
158158
hash_code Hash = INITIAL_HASH;
159159
for (auto &Info : Record.getDeclOccurrencesSortedByOffset()) {
160-
COMBINE_HASH(Info.Roles, Info.Offset, hash(Info.Dcl));
160+
COMBINE_HASH(Info.Roles, Info.Offset);
161+
if (auto *D = Info.DeclOrMacro.dyn_cast<const Decl *>()) {
162+
COMBINE_HASH(hash(D));
163+
}
161164
for (auto &Rel : Info.Relations) {
162165
COMBINE_HASH(hash(Rel.RelatedSymbol));
163166
}

0 commit comments

Comments
 (0)