[cfe-commits] r39190 - in /cfe/cfe/trunk: AST/SemaType.cpp AST/StmtPrinter.cpp AST/Type.cpp Sema/SemaType.cpp
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:40:51 PDT 2007
Author: sabre
Date: Wed Jul 11 11:40:51 2007
New Revision: 39190
URL: http://llvm.org/viewvc/llvm-project?rev=39190&view=rev
Log:
correctly handle stuff like:
typedef int G;
X = sizeof(const G);
X = sizeof(restrict G);
Modified:
cfe/cfe/trunk/AST/SemaType.cpp
cfe/cfe/trunk/AST/StmtPrinter.cpp
cfe/cfe/trunk/AST/Type.cpp
cfe/cfe/trunk/Sema/SemaType.cpp
Modified: cfe/cfe/trunk/AST/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaType.cpp?rev=39190&r1=39189&r2=39190&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/SemaType.cpp (original)
+++ cfe/cfe/trunk/AST/SemaType.cpp Wed Jul 11 11:40:51 2007
@@ -79,10 +79,10 @@
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));
}
}
Modified: cfe/cfe/trunk/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/StmtPrinter.cpp?rev=39190&r1=39189&r2=39190&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/StmtPrinter.cpp (original)
+++ cfe/cfe/trunk/AST/StmtPrinter.cpp Wed Jul 11 11:40:51 2007
@@ -260,7 +260,7 @@
OS << (Node->isSizeOf() ? "sizeof(" : "__alignof(");
std::string TypeStr;
- Node->getArgumentType()->getAsString(TypeStr);
+ Node->getArgumentType().getAsString(TypeStr);
OS << TypeStr << ")";
}
void StmtPrinter::VisitArraySubscriptExpr(ArraySubscriptExpr *Node) {
Modified: cfe/cfe/trunk/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Type.cpp?rev=39190&r1=39189&r2=39190&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/Type.cpp (original)
+++ cfe/cfe/trunk/AST/Type.cpp Wed Jul 11 11:40:51 2007
@@ -98,5 +98,11 @@
}
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;
+ }
}
Modified: cfe/cfe/trunk/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaType.cpp?rev=39190&r1=39189&r2=39190&view=diff
==============================================================================
--- cfe/cfe/trunk/Sema/SemaType.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaType.cpp Wed Jul 11 11:40:51 2007
@@ -79,10 +79,10 @@
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));
}
}
More information about the cfe-commits
mailing list