diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-03-15 20:41:09 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-03-15 20:41:09 +0000 |
commit | d8f2e8ed63072ec5a1a8329aa772ae940f1dc3bc (patch) | |
tree | 67e252c3c4712c5ddbadfeda089bcefaa93ac4ce /lib/Sema/SemaExceptionSpec.cpp | |
parent | 99439d474e7cb48497a2da4c35f70cdc1d5b153f (diff) |
More robust check for the special C++0x operator new workaround.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127692 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r-- | lib/Sema/SemaExceptionSpec.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Sema/SemaExceptionSpec.cpp b/lib/Sema/SemaExceptionSpec.cpp index 1d21b9760c..490934c4b0 100644 --- a/lib/Sema/SemaExceptionSpec.cpp +++ b/lib/Sema/SemaExceptionSpec.cpp @@ -396,14 +396,14 @@ bool Sema::CheckEquivalentExceptionSpec(const PartialDiagnostic &DiagID, if (Name && Name->getName() == "bad_alloc") { // It's called bad_alloc, but is it in std? DeclContext* DC = ExRecord->getDeclContext(); - while (DC && !isa<NamespaceDecl>(DC)) - DC = DC->getParent(); - if (DC) { - NamespaceDecl* NS = cast<NamespaceDecl>(DC); + DC = DC->getEnclosingNamespaceContext(); + if (NamespaceDecl* NS = dyn_cast<NamespaceDecl>(DC)) { IdentifierInfo* NSName = NS->getIdentifier(); + DC = DC->getParent(); if (NSName && NSName->getName() == "std" && - isa<TranslationUnitDecl>(NS->getParent())) + DC->getEnclosingNamespaceContext()->isTranslationUnit()) { return false; + } } } } |