Move IsStdClass to cling::utils::Analyze
This commit is contained in:
parent
d6dfcf82a8
commit
1004034c75
@ -77,6 +77,12 @@ namespace utils {
|
||||
bool omitDeclStmts = true,
|
||||
clang::Sema* S = 0);
|
||||
|
||||
///\brief Return true if the class or template is declared directly in the
|
||||
/// std namespace (modulo inline namespace).
|
||||
///
|
||||
///\param[in] decl - The declaration being analyzed.
|
||||
bool IsStdClass(const clang::NamedDecl &cl);
|
||||
|
||||
///\brief Return true if the decl has been declared in ths std namespace
|
||||
/// or is a compiler details (in __gnu_cxx and starting with a leading
|
||||
/// underscore).
|
||||
|
@ -534,6 +534,30 @@ namespace utils {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Analyze::IsStdClass(const clang::NamedDecl &cl)
|
||||
{
|
||||
// Return true if the class or template is declared directly in the
|
||||
// std namespace (modulo inline namespace).
|
||||
|
||||
const clang::DeclContext *ctx = cl.getDeclContext();
|
||||
|
||||
while (ctx && ctx->isInlineNamespace()) {
|
||||
ctx = ctx->getParent();
|
||||
}
|
||||
|
||||
if (ctx && ctx->isNamespace())
|
||||
{
|
||||
const clang::NamedDecl *parent = llvm::dyn_cast<clang::NamedDecl> (ctx);
|
||||
if (parent) {
|
||||
if (parent->getDeclContext()->isTranslationUnit()
|
||||
&& parent->getQualifiedNameAsString()=="std") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsCompilerDetails(const TagType *tagTy)
|
||||
{
|
||||
// Return true if the TagType is a 'details' of the std implementation.
|
||||
|
Loading…
x
Reference in New Issue
Block a user