Do not desugar typedef pointing to compiler 'details'.
Rather than skipping the desugaring of typedef pointing to anything in std, we skip the desugaring of typedef pointing to a type starting with an underscore.
This commit is contained in:
parent
53bf555194
commit
5572e076ac
@ -469,17 +469,24 @@ namespace utils {
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsStdDetails(const TagType *tagTy)
|
||||
static bool IsCompilerDetails(const TagType *tagTy)
|
||||
{
|
||||
// Return true if the TagType is a 'details' of the std implementation.
|
||||
// (For now it means declared in std and __gnu_cxx
|
||||
|
||||
const TagDecl *decl = tagTy->getDecl();
|
||||
assert(decl);
|
||||
IdentifierInfo *info = decl->getDeclName().getAsIdentifierInfo();
|
||||
if (info && info->getNameStart()[0] == '_') {
|
||||
// We have a name starting by _, this is reserve for compiler
|
||||
// implementation, so let's not desugar to it.
|
||||
return true;
|
||||
}
|
||||
// And let's check if it is in one of the know compiler implementation
|
||||
// namespace.
|
||||
const NamedDecl *outer =dyn_cast_or_null<NamedDecl>(decl->getDeclContext());
|
||||
while (outer && outer->getName().size() ) {
|
||||
if (//outer->getName().compare("std") == 0 ||
|
||||
outer->getName().compare("__gnu_cxx") == 0) {
|
||||
if (outer->getName().compare("__gnu_cxx") == 0) {
|
||||
return true;
|
||||
}
|
||||
outer = dyn_cast_or_null<NamedDecl>(outer->getDeclContext());
|
||||
@ -517,7 +524,7 @@ namespace utils {
|
||||
}
|
||||
const TagType *tagTy = underlyingType->getAs<TagType>();
|
||||
if (tagTy) {
|
||||
bool details = IsStdDetails(tagTy);
|
||||
bool details = IsCompilerDetails(tagTy);
|
||||
if (details) return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user