summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExceptionSpec.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2011-03-15 20:41:09 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2011-03-15 20:41:09 +0000
commitc34c29f6610d0d58e754aa0146b96ba572dd65b8 (patch)
treeb052926d6b890ee3deb55cd0bdbe353e101dd806 /clang/lib/Sema/SemaExceptionSpec.cpp
parent4ae30b678588aba31d9d6b5fe43c8faa202d25c7 (diff)
downloadbcm5719-llvm-c34c29f6610d0d58e754aa0146b96ba572dd65b8.tar.gz
bcm5719-llvm-c34c29f6610d0d58e754aa0146b96ba572dd65b8.zip
More robust check for the special C++0x operator new workaround.
llvm-svn: 127692
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r--clang/lib/Sema/SemaExceptionSpec.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp
index 1d21b9760c7..490934c4b04 100644
--- a/clang/lib/Sema/SemaExceptionSpec.cpp
+++ b/clang/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;
+ }
}
}
}
OpenPOWER on IntegriCloud