junaire updated this revision to Diff 395125.
junaire added a comment.
Format patch.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115936/new/
https://reviews.llvm.org/D115936
Files:
clang/include/clang/AST/DeclBase.h
clang/lib/AST/DeclBase.cpp
Index: clang/lib/AST/DeclBase.cpp
===================================================================
--- clang/lib/AST/DeclBase.cpp
+++ clang/lib/AST/DeclBase.cpp
@@ -391,9 +391,11 @@
return false;
}
-bool Decl::isInStdNamespace() const {
+bool Decl::isInStdNamespace() const { return isInNamespace("std"); }
+
+bool Decl::isInNamespace(llvm::StringRef Namespace) const {
const DeclContext *DC = getDeclContext();
- return DC && DC->isStdNamespace();
+ return DC && DC->isNamespace(Namespace);
}
TranslationUnitDecl *Decl::getTranslationUnitDecl() {
@@ -1123,7 +1125,9 @@
cast<NamespaceDecl>(this)->isInline();
}
-bool DeclContext::isStdNamespace() const {
+bool DeclContext::isStdNamespace() const { return isNamespace("std"); }
+
+bool DeclContext::isNamespace(llvm::StringRef Namespace) const {
if (!isNamespace())
return false;
@@ -1136,7 +1140,7 @@
return false;
const IdentifierInfo *II = ND->getIdentifier();
- return II && II->isStr("std");
+ return II && II->isStr(Namespace);
}
bool DeclContext::isDependentContext() const {
Index: clang/include/clang/AST/DeclBase.h
===================================================================
--- clang/include/clang/AST/DeclBase.h
+++ clang/include/clang/AST/DeclBase.h
@@ -463,6 +463,7 @@
bool isInAnonymousNamespace() const;
bool isInStdNamespace() const;
+ bool isInNamespace(llvm::StringRef Namespace) const;
ASTContext &getASTContext() const LLVM_READONLY;
@@ -1945,6 +1946,8 @@
bool isStdNamespace() const;
+ bool isNamespace(llvm::StringRef Namespace) const;
+
bool isInlineNamespace() const;
/// Determines whether this context is dependent on a
Index: clang/lib/AST/DeclBase.cpp
===================================================================
--- clang/lib/AST/DeclBase.cpp
+++ clang/lib/AST/DeclBase.cpp
@@ -391,9 +391,11 @@
return false;
}
-bool Decl::isInStdNamespace() const {
+bool Decl::isInStdNamespace() const { return isInNamespace("std"); }
+
+bool Decl::isInNamespace(llvm::StringRef Namespace) const {
const DeclContext *DC = getDeclContext();
- return DC && DC->isStdNamespace();
+ return DC && DC->isNamespace(Namespace);
}
TranslationUnitDecl *Decl::getTranslationUnitDecl() {
@@ -1123,7 +1125,9 @@
cast<NamespaceDecl>(this)->isInline();
}
-bool DeclContext::isStdNamespace() const {
+bool DeclContext::isStdNamespace() const { return isNamespace("std"); }
+
+bool DeclContext::isNamespace(llvm::StringRef Namespace) const {
if (!isNamespace())
return false;
@@ -1136,7 +1140,7 @@
return false;
const IdentifierInfo *II = ND->getIdentifier();
- return II && II->isStr("std");
+ return II && II->isStr(Namespace);
}
bool DeclContext::isDependentContext() const {
Index: clang/include/clang/AST/DeclBase.h
===================================================================
--- clang/include/clang/AST/DeclBase.h
+++ clang/include/clang/AST/DeclBase.h
@@ -463,6 +463,7 @@
bool isInAnonymousNamespace() const;
bool isInStdNamespace() const;
+ bool isInNamespace(llvm::StringRef Namespace) const;
ASTContext &getASTContext() const LLVM_READONLY;
@@ -1945,6 +1946,8 @@
bool isStdNamespace() const;
+ bool isNamespace(llvm::StringRef Namespace) const;
+
bool isInlineNamespace() const;
/// Determines whether this context is dependent on a
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits