From 27c1b1a638d2f6300ebc6f64fd97bd6f4d9c9e2d Mon Sep 17 00:00:00 2001 From: Richard Trieu Date: Tue, 10 Jul 2018 01:40:50 +0000 Subject: [ODRHash] Merge the two function hashes into one. Functions that are a sub-Decl of a record were hashed differently than other functions. This change keeps the AddFunctionDecl function and the hash of records now calls this function. In addition, AddFunctionDecl has an option to perform a hash as if the body was absent, which is required for some checks after loading modules. Additional logic prevents multiple error message from being printed. llvm-svn: 336632 --- clang/lib/AST/Decl.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'clang/lib/AST/Decl.cpp') diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 08718e0a9e8..7db105eded7 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -3658,18 +3658,15 @@ unsigned FunctionDecl::getMemoryFunctionKind() const { return 0; } +unsigned FunctionDecl::getODRHash() const { + assert(HasODRHash); + return ODRHash; +} + unsigned FunctionDecl::getODRHash() { if (HasODRHash) return ODRHash; - if (FunctionDecl *Definition = getDefinition()) { - if (Definition != this) { - HasODRHash = true; - ODRHash = Definition->getODRHash(); - return ODRHash; - } - } - if (auto *FT = getInstantiatedFromMemberFunction()) { HasODRHash = true; ODRHash = FT->getODRHash(); -- cgit v1.2.3