summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ODRHash.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2017-06-16 02:44:29 +0000
committerRichard Trieu <rtrieu@google.com>2017-06-16 02:44:29 +0000
commit6e13ff33c89369a959eef627ae4f9acf956490ad (patch)
tree9e7688b9fc4a08fb4620b7a707a040dfe3060021 /clang/lib/AST/ODRHash.cpp
parentaf0f33a8532e2f28d39e92a43a59e694f20c0137 (diff)
downloadbcm5719-llvm-6e13ff33c89369a959eef627ae4f9acf956490ad.tar.gz
bcm5719-llvm-6e13ff33c89369a959eef627ae4f9acf956490ad.zip
[ODRHash] Hash VarDecl members.
These VarDecl's are static data members of classes. Since the initializers are also hashed, this also provides checking for default arguments to methods. llvm-svn: 305543
Diffstat (limited to 'clang/lib/AST/ODRHash.cpp')
-rw-r--r--clang/lib/AST/ODRHash.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index 3bf9896985e..05bed658f3f 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/lib/AST/ODRHash.cpp
@@ -252,6 +252,17 @@ public:
Inherited::VisitValueDecl(D);
}
+ void VisitVarDecl(const VarDecl *D) {
+ Hash.AddBoolean(D->isStaticLocal());
+ Hash.AddBoolean(D->isConstexpr());
+ const bool HasInit = D->hasInit();
+ Hash.AddBoolean(HasInit);
+ if (HasInit) {
+ AddStmt(D->getInit());
+ }
+ Inherited::VisitVarDecl(D);
+ }
+
void VisitParmVarDecl(const ParmVarDecl *D) {
// TODO: Handle default arguments.
Inherited::VisitParmVarDecl(D);
@@ -336,6 +347,7 @@ bool ODRHash::isWhitelistedDecl(const Decl *D, const CXXRecordDecl *Parent) {
case Decl::StaticAssert:
case Decl::TypeAlias:
case Decl::Typedef:
+ case Decl::Var:
return true;
}
}
OpenPOWER on IntegriCloud