diff options
author | Gabor Marton <martongabesz@gmail.com> | 2018-11-26 15:54:08 +0000 |
---|---|---|
committer | Gabor Marton <martongabesz@gmail.com> | 2018-11-26 15:54:08 +0000 |
commit | 17d39677e015e8c4398949dd089dfd3fab136222 (patch) | |
tree | 6eda57ab79df6ebb1128b0cc8fc2751db5e74659 /clang/lib/AST/ASTStructuralEquivalence.cpp | |
parent | 4d3d82eef96e10a54e3d0bf367d8e10917ca8662 (diff) | |
download | bcm5719-llvm-17d39677e015e8c4398949dd089dfd3fab136222.tar.gz bcm5719-llvm-17d39677e015e8c4398949dd089dfd3fab136222.zip |
[ASTImporter][Structural Eq] Check for isBeingDefined
Summary:
If one definition is currently being defined, we do not compare for
equality and we assume that the decls are equal.
Reviewers: a_sidorin, a.sidorin, shafik
Reviewed By: a_sidorin
Subscribers: gamesh411, shafik, rnkovacs, dkrupp, Szelethus, cfe-commits
Differential Revision: https://reviews.llvm.org/D53697
llvm-svn: 347564
Diffstat (limited to 'clang/lib/AST/ASTStructuralEquivalence.cpp')
-rw-r--r-- | clang/lib/AST/ASTStructuralEquivalence.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTStructuralEquivalence.cpp b/clang/lib/AST/ASTStructuralEquivalence.cpp index 9149006a204..b6ed7578c38 100644 --- a/clang/lib/AST/ASTStructuralEquivalence.cpp +++ b/clang/lib/AST/ASTStructuralEquivalence.cpp @@ -1016,7 +1016,8 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, return false; // Compare the definitions of these two records. If either or both are - // incomplete, we assume that they are equivalent. + // incomplete (i.e. it is a forward decl), we assume that they are + // equivalent. D1 = D1->getDefinition(); D2 = D2->getDefinition(); if (!D1 || !D2) @@ -1031,6 +1032,11 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, if (D1->hasExternalLexicalStorage() || D2->hasExternalLexicalStorage()) return true; + // If one definition is currently being defined, we do not compare for + // equality and we assume that the decls are equal. + if (D1->isBeingDefined() || D2->isBeingDefined()) + return true; + if (auto *D1CXX = dyn_cast<CXXRecordDecl>(D1)) { if (auto *D2CXX = dyn_cast<CXXRecordDecl>(D2)) { if (D1CXX->hasExternalLexicalStorage() && |