aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/AST/DeclBase.h6
-rw-r--r--lib/Sema/IdentifierResolver.cpp3
2 files changed, 7 insertions, 2 deletions
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h
index dcd2482eb3..6e04e55312 100644
--- a/include/clang/AST/DeclBase.h
+++ b/include/clang/AST/DeclBase.h
@@ -617,6 +617,12 @@ public:
/// inline namespaces.
bool isTransparentContext() const;
+ /// \brief Determine whether this declaration context is equivalent
+ /// to the declaration context DC.
+ bool Equals(DeclContext *DC) {
+ return this->getPrimaryContext() == DC->getPrimaryContext();
+ }
+
/// \brief Determine whether this declaration context encloses the
/// declaration context DC.
bool Encloses(DeclContext *DC);
diff --git a/lib/Sema/IdentifierResolver.cpp b/lib/Sema/IdentifierResolver.cpp
index 1e5fb26fb5..a36b85a87a 100644
--- a/lib/Sema/IdentifierResolver.cpp
+++ b/lib/Sema/IdentifierResolver.cpp
@@ -134,8 +134,7 @@ bool IdentifierResolver::isDeclInScope(Decl *D, DeclContext *Ctx,
return false;
}
- return D->getDeclContext()->getLookupContext()->getPrimaryContext() ==
- Ctx->getPrimaryContext();
+ return D->getDeclContext()->getLookupContext()->Equals(Ctx);
}
/// AddDecl - Link the decl to its shadowed decl chain.