summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclCXX.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2017-02-22 01:11:25 +0000
committerRichard Trieu <rtrieu@google.com>2017-02-22 01:11:25 +0000
commite7f7ed2be782a46ce46f4bf73a7e516940a96e71 (patch)
tree05b7404ccc795f7a84204e8ccb1efba5304842c9 /clang/lib/AST/DeclCXX.cpp
parente67e162654f3d94f30a632a93ab6f3431498b8a0 (diff)
downloadbcm5719-llvm-e7f7ed2be782a46ce46f4bf73a7e516940a96e71.tar.gz
bcm5719-llvm-e7f7ed2be782a46ce46f4bf73a7e516940a96e71.zip
Add more ODR checking.
Add the basics for the ODRHash class, which will only process Decl's from a whitelist, which currently only has AccessSpecDecl. Different access specifiers in merged classes can now be detected. Differential Revision: https://reviews.llvm.org/D21675 llvm-svn: 295800
Diffstat (limited to 'clang/lib/AST/DeclCXX.cpp')
-rw-r--r--clang/lib/AST/DeclCXX.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 19ffe1a720b..3846ace1aa0 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -18,6 +18,7 @@
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
+#include "clang/AST/ODRHash.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/IdentifierTable.h"
#include "llvm/ADT/STLExtras.h"
@@ -371,7 +372,15 @@ CXXRecordDecl::setBases(CXXBaseSpecifier const * const *Bases,
data().IsParsingBaseSpecifiers = false;
}
-void CXXRecordDecl::computeODRHash() {}
+void CXXRecordDecl::computeODRHash() {
+ if (!DefinitionData)
+ return;
+
+ ODRHash Hash;
+ Hash.AddCXXRecordDecl(this);
+
+ DefinitionData->ODRHash = Hash.CalculateHash();
+}
void CXXRecordDecl::addedClassSubobject(CXXRecordDecl *Subobj) {
// C++11 [class.copy]p11:
OpenPOWER on IntegriCloud