diff options
author | Richard Trieu <rtrieu@google.com> | 2014-05-28 02:16:01 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2014-05-28 02:16:01 +0000 |
commit | c771d5d79f6ad3a9996cc6125791cce9b1a8a8f4 (patch) | |
tree | 2173f4a56c2b0cfedacbc5748392654d87f6210c /clang/lib/Sema/SemaExceptionSpec.cpp | |
parent | cda69a279dd71f50b87996eeee203bdd51b65961 (diff) | |
download | bcm5719-llvm-c771d5d79f6ad3a9996cc6125791cce9b1a8a8f4.tar.gz bcm5719-llvm-c771d5d79f6ad3a9996cc6125791cce9b1a8a8f4.zip |
Move the logic for testing for namespace std into one location. This check can
be performed by using Decl::isInStdNamespace or DeclContext::isStdNamespace
llvm-svn: 209708
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExceptionSpec.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index 40112a05214..24d82224ddf 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -468,15 +468,8 @@ bool Sema::CheckEquivalentExceptionSpec(const PartialDiagnostic &DiagID, IdentifierInfo* Name = ExRecord->getIdentifier(); if (Name && Name->getName() == "bad_alloc") { // It's called bad_alloc, but is it in std? - DeclContext* DC = ExRecord->getDeclContext(); - DC = DC->getEnclosingNamespaceContext(); - if (NamespaceDecl* NS = dyn_cast<NamespaceDecl>(DC)) { - IdentifierInfo* NSName = NS->getIdentifier(); - DC = DC->getParent(); - if (NSName && NSName->getName() == "std" && - DC->getEnclosingNamespaceContext()->isTranslationUnit()) { - return false; - } + if (ExRecord->isInStdNamespace()) { + return false; } } } |