There is a bit of code at the end of AddDeclaration that should be run on
every exit of the function. However, there was an early exit beforehand
that could be triggered, which causes a small amount of data to skip the
hashing, leading to false positive mismatch. Use a separate function so
that this code is always run.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342199
91177308-0d34-0410-b5e6-
96231b3b80d8
void AddBoolean(bool value);
static bool isWhitelistedDecl(const Decl* D, const DeclContext *Parent);
+
+private:
+ void AddDeclarationNameImpl(DeclarationName Name);
};
} // end namespace clang
void ODRHash::AddDeclarationName(DeclarationName Name, bool TreatAsDecl) {
if (TreatAsDecl)
+ // Matches the NamedDecl check in AddDecl
AddBoolean(true);
+ AddDeclarationNameImpl(Name);
+
+ if (TreatAsDecl)
+ // Matches the ClassTemplateSpecializationDecl check in AddDecl
+ AddBoolean(false);
+}
+
+void ODRHash::AddDeclarationNameImpl(DeclarationName Name) {
// Index all DeclarationName and use index numbers to refer to them.
auto Result = DeclNameMap.insert(std::make_pair(Name, DeclNameMap.size()));
ID.AddInteger(Result.first->second);
}
}
}
-
- if (TreatAsDecl)
- AddBoolean(false);
}
void ODRHash::AddNestedNameSpecifier(const NestedNameSpecifier *NNS) {
void run() {
int x;
A::Check(&Field, 1);
+ A::Check(&Field, 1);
}
};
#endif