diff options
author | Richard Trieu <rtrieu@google.com> | 2018-07-10 01:40:50 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2018-07-10 01:40:50 +0000 |
commit | 2e63a7ebe45201946297edd903d3b30d91f9d273 (patch) | |
tree | 833877f965004be68cfc773030ff6c7ad7692340 /lib/AST/Decl.cpp | |
parent | a758e727e602b5e05058271c990063baeeea3ccd (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336632 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 08718e0a9e..7db105eded 100644 --- a/lib/AST/Decl.cpp +++ b/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(); |