forked from OSchip/llvm-project
correctly handle stuff like:
typedef int G; X = sizeof(const G); X = sizeof(restrict G); llvm-svn: 39190
This commit is contained in:
parent
d0342e5989
commit
f0a40e7ef4
|
@ -79,10 +79,10 @@ static TypeRef ConvertDeclSpecToType(const DeclSpec &DS, ASTContext &Ctx) {
|
|||
case DeclSpec::TST_typedef: {
|
||||
Decl *D = (Decl *)DS.TypenameRep;
|
||||
assert(D && "Didn't get a decl for a typedef?");
|
||||
// FIXME: apply type quals!
|
||||
assert(DS.TypeSpecWidth == 0 && DS.TypeSpecComplex == 0 &&
|
||||
DS.TypeSpecSign == 0 && DS.TypeQualifiers == 0 &&
|
||||
DS.TypeSpecSign == 0 &&
|
||||
"Can't handle qualifiers on typedef names yet!");
|
||||
// TypeQuals handled by caller.
|
||||
return Ctx.getTypeDeclType(cast<TypedefDecl>(D));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -260,7 +260,7 @@ void StmtPrinter::VisitSizeOfAlignOfTypeExpr(SizeOfAlignOfTypeExpr *Node) {
|
|||
OS << (Node->isSizeOf() ? "sizeof(" : "__alignof(");
|
||||
|
||||
std::string TypeStr;
|
||||
Node->getArgumentType()->getAsString(TypeStr);
|
||||
Node->getArgumentType().getAsString(TypeStr);
|
||||
OS << TypeStr << ")";
|
||||
}
|
||||
void StmtPrinter::VisitArraySubscriptExpr(ArraySubscriptExpr *Node) {
|
||||
|
|
|
@ -98,5 +98,11 @@ void ArrayType::getAsString(std::string &S) const {
|
|||
}
|
||||
|
||||
void TypeNameType::getAsString(std::string &InnerString) const {
|
||||
InnerString += getDecl()->getIdentifier()->getName();
|
||||
if (InnerString.empty()) {
|
||||
InnerString = getDecl()->getIdentifier()->getName();
|
||||
} else {
|
||||
// Prefix the basic type, e.g. 'typedefname X'.
|
||||
InnerString = ' ' + InnerString;
|
||||
InnerString = getDecl()->getIdentifier()->getName() + InnerString;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,10 +79,10 @@ static TypeRef ConvertDeclSpecToType(const DeclSpec &DS, ASTContext &Ctx) {
|
|||
case DeclSpec::TST_typedef: {
|
||||
Decl *D = (Decl *)DS.TypenameRep;
|
||||
assert(D && "Didn't get a decl for a typedef?");
|
||||
// FIXME: apply type quals!
|
||||
assert(DS.TypeSpecWidth == 0 && DS.TypeSpecComplex == 0 &&
|
||||
DS.TypeSpecSign == 0 && DS.TypeQualifiers == 0 &&
|
||||
DS.TypeSpecSign == 0 &&
|
||||
"Can't handle qualifiers on typedef names yet!");
|
||||
// TypeQuals handled by caller.
|
||||
return Ctx.getTypeDeclType(cast<TypedefDecl>(D));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue