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/AST/Decl.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/AST/Decl.cpp')
-rw-r--r-- | clang/lib/AST/Decl.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index a783364c677..1c3a5384d35 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -2328,12 +2328,6 @@ bool FunctionDecl::isReservedGlobalPlacementOperator() const { return (proto->getParamType(1).getCanonicalType() == Context.VoidPtrTy); } -static bool isNamespaceStd(const DeclContext *DC) { - const NamespaceDecl *ND = dyn_cast<NamespaceDecl>(DC->getRedeclContext()); - return ND && isNamed(ND, "std") && - ND->getParent()->getRedeclContext()->isTranslationUnit(); -} - bool FunctionDecl::isReplaceableGlobalAllocationFunction() const { if (getDeclName().getNameKind() != DeclarationName::CXXOperatorName) return false; @@ -2371,9 +2365,8 @@ bool FunctionDecl::isReplaceableGlobalAllocationFunction() const { Ty = Ty->getPointeeType(); if (Ty.getCVRQualifiers() != Qualifiers::Const) return false; - // FIXME: Recognise nothrow_t in an inline namespace inside std? const CXXRecordDecl *RD = Ty->getAsCXXRecordDecl(); - return RD && isNamed(RD, "nothrow_t") && isNamespaceStd(RD->getDeclContext()); + return RD && isNamed(RD, "nothrow_t") && RD->isInStdNamespace(); } FunctionDecl * |