diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-09-01 17:22:34 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-09-01 17:22:34 +0000 |
commit | 61481dad22ebca3fba3fe4fb67a3b926d0895e9c (patch) | |
tree | 0d363a2de3b2e1b41b45eca905fae88a3d9454a5 /include/clang/AST/DeclBase.h | |
parent | b7cd17cfd2970636af0fe9b491bab1acf0009c2f (diff) |
Add DeclContext::Equals to compare declaration contexts based on their primary context. Use this instead of pointer comparisons
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80690 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/DeclBase.h')
-rw-r--r-- | include/clang/AST/DeclBase.h | 6 |
1 files changed, 6 insertions, 0 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); |