summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2018-02-22 05:50:29 +0000
committerRichard Trieu <rtrieu@google.com>2018-02-22 05:50:29 +0000
commit0ac2eb7369f8acb6c7c5485299abc66cdcca04b0 (patch)
tree61e85225a96ef733e7a5feb1afbb081a6f3779f4 /clang/lib/AST
parentf65efae5c45bdccddb40b829cf28fcbf70af891b (diff)
downloadbcm5719-llvm-0ac2eb7369f8acb6c7c5485299abc66cdcca04b0.tar.gz
bcm5719-llvm-0ac2eb7369f8acb6c7c5485299abc66cdcca04b0.zip
[ODRHash] Fix hashing for friend functions.
When hashing a templated function, use the hash of the function it was instantiated from. llvm-svn: 325742
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/Decl.cpp6
-rw-r--r--clang/lib/AST/ODRHash.cpp3
2 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 30599ea7cfb..c4da87c013d 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -3625,6 +3625,12 @@ unsigned FunctionDecl::getODRHash() {
}
}
+ if (auto *FT = getInstantiatedFromMemberFunction()) {
+ HasODRHash = true;
+ ODRHash = FT->getODRHash();
+ return ODRHash;
+ }
+
class ODRHash Hash;
Hash.AddFunctionDecl(this);
HasODRHash = true;
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index 4104d3454e5..528e32aaba2 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/lib/AST/ODRHash.cpp
@@ -484,9 +484,6 @@ void ODRHash::AddFunctionDecl(const FunctionDecl *Function) {
if (!Function->hasBody()) return;
if (!Function->getBody()) return;
- // TODO: Fix hashing friend functions.
- if (Function->getFriendObjectKind()) return;
-
// Skip functions that are specializations or in specialization context.
const DeclContext *DC = Function;
while (DC) {
OpenPOWER on IntegriCloud