Fix the handling of B<const Double32_t, const int>
git-svn-id: http://root.cern.ch/svn/root/trunk@46192 27541ba8-7e3a-0410-8455-c3a389f83636
This commit is contained in:
parent
22952b8f72
commit
c22cd67c6d
@ -277,45 +277,47 @@ namespace utils {
|
|||||||
if (decl) {
|
if (decl) {
|
||||||
NamedDecl* outer
|
NamedDecl* outer
|
||||||
= llvm::dyn_cast_or_null<NamedDecl>(decl->getDeclContext());
|
= llvm::dyn_cast_or_null<NamedDecl>(decl->getDeclContext());
|
||||||
if (original_prefix) {
|
|
||||||
const clang::Type *oldtype = original_prefix->getAsType();
|
|
||||||
if (oldtype) {
|
|
||||||
if (oldtype->getAsCXXRecordDecl() == outer) {
|
|
||||||
// Same type, use the original spelling
|
|
||||||
prefix = GetPartiallyDesugaredNNS(Ctx,original_prefix,TypesToSkip);
|
|
||||||
outer = 0; // Cancel the later creation.
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const NamespaceDecl *old_ns = original_prefix->getAsNamespace();
|
|
||||||
if (old_ns) {
|
|
||||||
old_ns = old_ns->getCanonicalDecl();
|
|
||||||
}
|
|
||||||
else if (NamespaceAliasDecl *alias =
|
|
||||||
original_prefix->getAsNamespaceAlias())
|
|
||||||
{
|
|
||||||
old_ns = alias->getNamespace()->getCanonicalDecl();
|
|
||||||
}
|
|
||||||
const NamespaceDecl *new_ns = llvm::dyn_cast<NamespaceDecl>(outer);
|
|
||||||
if (new_ns) new_ns = new_ns->getCanonicalDecl();
|
|
||||||
if (old_ns == new_ns) {
|
|
||||||
// This is the same namespace, use the original prefix
|
|
||||||
// as a starting point.
|
|
||||||
prefix = original_prefix;
|
|
||||||
outer = 0; // Cancel the later creation.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else { // if (!original_prefix)
|
|
||||||
// move the qualifiers on the outer type (avoid 'std::const string'!)
|
|
||||||
prefix_qualifiers = QT.getLocalQualifiers();
|
|
||||||
QT.setLocalFastQualifiers(0);
|
|
||||||
}
|
|
||||||
if (outer && outer->getName ().size()) {
|
if (outer && outer->getName ().size()) {
|
||||||
if (decl->getDeclContext()->isNamespace()) {
|
if (original_prefix) {
|
||||||
prefix = CreateNestedNameSpecifier(Ctx,
|
const clang::Type *oldtype = original_prefix->getAsType();
|
||||||
|
if (oldtype) {
|
||||||
|
if (oldtype->getAsCXXRecordDecl() == outer) {
|
||||||
|
// Same type, use the original spelling
|
||||||
|
prefix = GetPartiallyDesugaredNNS(Ctx,original_prefix,TypesToSkip);
|
||||||
|
outer = 0; // Cancel the later creation.
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const NamespaceDecl *old_ns = original_prefix->getAsNamespace();
|
||||||
|
if (old_ns) {
|
||||||
|
old_ns = old_ns->getCanonicalDecl();
|
||||||
|
}
|
||||||
|
else if (NamespaceAliasDecl *alias =
|
||||||
|
original_prefix->getAsNamespaceAlias())
|
||||||
|
{
|
||||||
|
old_ns = alias->getNamespace()->getCanonicalDecl();
|
||||||
|
}
|
||||||
|
const NamespaceDecl *new_ns = llvm::dyn_cast<NamespaceDecl>(outer);
|
||||||
|
if (new_ns) new_ns = new_ns->getCanonicalDecl();
|
||||||
|
if (old_ns == new_ns) {
|
||||||
|
// This is the same namespace, use the original prefix
|
||||||
|
// as a starting point.
|
||||||
|
prefix = original_prefix;
|
||||||
|
outer = 0; // Cancel the later creation.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // if (!original_prefix)
|
||||||
|
// move the qualifiers on the outer type (avoid 'std::const string'!)
|
||||||
|
prefix_qualifiers = QT.getLocalQualifiers();
|
||||||
|
QT = QualType(QT.getTypePtr(),0);
|
||||||
|
}
|
||||||
|
if (outer) {
|
||||||
|
if (decl->getDeclContext()->isNamespace()) {
|
||||||
|
prefix = CreateNestedNameSpecifier(Ctx,
|
||||||
llvm::dyn_cast<NamespaceDecl>(outer));
|
llvm::dyn_cast<NamespaceDecl>(outer));
|
||||||
} else {
|
} else {
|
||||||
prefix = CreateNestedNameSpecifier(Ctx,
|
prefix = CreateNestedNameSpecifier(Ctx,
|
||||||
llvm::dyn_cast<TagDecl>(outer));
|
llvm::dyn_cast<TagDecl>(outer));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -353,17 +355,17 @@ namespace utils {
|
|||||||
|
|
||||||
// If desugaring happened allocate new type in the AST.
|
// If desugaring happened allocate new type in the AST.
|
||||||
if (mightHaveChanged) {
|
if (mightHaveChanged) {
|
||||||
unsigned int qualifiers = QT.getLocalFastQualifiers();
|
Qualifiers qualifiers = QT.getLocalQualifiers();
|
||||||
QT = Ctx.getTemplateSpecializationType(TST->getTemplateName(),
|
QT = Ctx.getTemplateSpecializationType(TST->getTemplateName(),
|
||||||
desArgs.data(),
|
desArgs.data(),
|
||||||
desArgs.size(),
|
desArgs.size(),
|
||||||
TST->getCanonicalTypeInternal());
|
TST->getCanonicalTypeInternal());
|
||||||
QT.setLocalFastQualifiers(qualifiers);
|
QT = Ctx.getQualifiedType(QT, qualifiers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (prefix) {
|
if (prefix) {
|
||||||
QT = Ctx.getElaboratedType(ETK_None,prefix,QT);
|
QT = Ctx.getElaboratedType(ETK_None,prefix,QT);
|
||||||
QT.setLocalFastQualifiers(prefix_qualifiers.getFastQualifiers()); // Note: Is that copying _all_ the qualifiers?
|
QT = Ctx.getQualifiedType(QT, prefix_qualifiers);
|
||||||
}
|
}
|
||||||
return QT;
|
return QT;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user