[cfe-commits] r39307 - in /cfe/cfe/trunk: AST/ASTContext.cpp AST/SemaDecl.cpp AST/SemaExpr.cpp AST/SemaType.cpp AST/Type.cpp Sema/SemaDecl.cpp Sema/SemaExpr.cpp Sema/SemaType.cpp include/clang/AST/ASTContext.h include/clang/AST/Decl.h include/clang/AST/Type.h
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:42:50 PDT 2007
Author: sabre
Date: Wed Jul 11 11:42:50 2007
New Revision: 39307
URL: http://llvm.org/viewvc/llvm-project?rev=39307&view=rev
Log:
rename some classes, no functionality changes.
Modified:
cfe/cfe/trunk/AST/ASTContext.cpp
cfe/cfe/trunk/AST/SemaDecl.cpp
cfe/cfe/trunk/AST/SemaExpr.cpp
cfe/cfe/trunk/AST/SemaType.cpp
cfe/cfe/trunk/AST/Type.cpp
cfe/cfe/trunk/Sema/SemaDecl.cpp
cfe/cfe/trunk/Sema/SemaExpr.cpp
cfe/cfe/trunk/Sema/SemaType.cpp
cfe/cfe/trunk/include/clang/AST/ASTContext.h
cfe/cfe/trunk/include/clang/AST/Decl.h
cfe/cfe/trunk/include/clang/AST/Type.h
Modified: cfe/cfe/trunk/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/ASTContext.cpp?rev=39307&r1=39306&r2=39307&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/cfe/trunk/AST/ASTContext.cpp Wed Jul 11 11:42:50 2007
@@ -58,7 +58,7 @@
++NumFunctionNP;
else if (isa<FunctionTypeProto>(T))
++NumFunctionP;
- else if (isa<TypeNameType>(T))
+ else if (isa<TypedefType>(T))
++NumTypeName;
else if (TaggedType *TT = dyn_cast<TaggedType>(T)) {
++NumTagged;
@@ -255,21 +255,21 @@
return FTP;
}
-/// getTypeDeclType - Return the unique reference to the type for the
+/// getTypedefType - Return the unique reference to the type for the
/// specified typename decl.
-TypeRef ASTContext::getTypeDeclType(TypeDecl *Decl) {
+TypeRef ASTContext::getTypedefType(TypedefDecl *Decl) {
// FIXME: This is obviously braindead!
- // Unique TypeDecl, to guarantee there is only one TypeDeclType.
+ // Unique TypedefDecl, to guarantee there is only one TypedefType.
++NumSlowLookups;
for (unsigned i = 0, e = Types.size(); i != e; ++i)
- if (TypeNameType *Ty = dyn_cast<TypeNameType>(Types[i]))
+ if (TypedefType *Ty = dyn_cast<TypedefType>(Types[i]))
if (Ty->getDecl() == Decl)
return Types[i];
// FIXME: does this lose qualifiers from the typedef??
Type *Canonical = Decl->getUnderlyingType().getTypePtr();
- Types.push_back(new TypeNameType(Decl, Canonical));
+ Types.push_back(new TypedefType(Decl, Canonical));
return Types.back();
}
Modified: cfe/cfe/trunk/AST/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaDecl.cpp?rev=39307&r1=39306&r2=39307&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/SemaDecl.cpp (original)
+++ cfe/cfe/trunk/AST/SemaDecl.cpp Wed Jul 11 11:42:50 2007
@@ -25,7 +25,7 @@
Sema::DeclTy *Sema::isTypeName(const IdentifierInfo &II, Scope *S) const {
- return dyn_cast_or_null<TypeDecl>(II.getFETokenInfo<Decl>());
+ return dyn_cast_or_null<TypedefDecl>(II.getFETokenInfo<Decl>());
}
void Sema::PopScope(SourceLocation Loc, Scope *S) {
Modified: cfe/cfe/trunk/AST/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaExpr.cpp?rev=39307&r1=39306&r2=39307&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/SemaExpr.cpp (original)
+++ cfe/cfe/trunk/AST/SemaExpr.cpp Wed Jul 11 11:42:50 2007
@@ -267,7 +267,7 @@
}
}
- if (isa<TypeDecl>(D)) {
+ if (isa<TypedefDecl>(D)) {
Diag(Loc, diag::err_unexpected_typedef, II.getName());
return true;
}
Modified: cfe/cfe/trunk/AST/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaType.cpp?rev=39307&r1=39306&r2=39307&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/SemaType.cpp (original)
+++ cfe/cfe/trunk/AST/SemaType.cpp Wed Jul 11 11:42:50 2007
@@ -92,7 +92,7 @@
DS.getTypeSpecSign() == 0 &&
"Can't handle qualifiers on typedef names yet!");
// TypeQuals handled by caller.
- return Ctx.getTypeDeclType(cast<TypedefDecl>(D));
+ return Ctx.getTypedefType(cast<TypedefDecl>(D));
}
}
}
Modified: cfe/cfe/trunk/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Type.cpp?rev=39307&r1=39306&r2=39307&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/Type.cpp (original)
+++ cfe/cfe/trunk/AST/Type.cpp Wed Jul 11 11:42:50 2007
@@ -196,7 +196,7 @@
}
-void TypeNameType::getAsString(std::string &InnerString) const {
+void TypedefType::getAsString(std::string &InnerString) const {
if (!InnerString.empty()) // Prefix the basic type, e.g. 'typedefname X'.
InnerString = ' ' + InnerString;
InnerString = getDecl()->getIdentifier()->getName() + InnerString;
Modified: cfe/cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaDecl.cpp?rev=39307&r1=39306&r2=39307&view=diff
==============================================================================
--- cfe/cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaDecl.cpp Wed Jul 11 11:42:50 2007
@@ -25,7 +25,7 @@
Sema::DeclTy *Sema::isTypeName(const IdentifierInfo &II, Scope *S) const {
- return dyn_cast_or_null<TypeDecl>(II.getFETokenInfo<Decl>());
+ return dyn_cast_or_null<TypedefDecl>(II.getFETokenInfo<Decl>());
}
void Sema::PopScope(SourceLocation Loc, Scope *S) {
Modified: cfe/cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaExpr.cpp?rev=39307&r1=39306&r2=39307&view=diff
==============================================================================
--- cfe/cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaExpr.cpp Wed Jul 11 11:42:50 2007
@@ -267,7 +267,7 @@
}
}
- if (isa<TypeDecl>(D)) {
+ if (isa<TypedefDecl>(D)) {
Diag(Loc, diag::err_unexpected_typedef, II.getName());
return true;
}
Modified: cfe/cfe/trunk/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaType.cpp?rev=39307&r1=39306&r2=39307&view=diff
==============================================================================
--- cfe/cfe/trunk/Sema/SemaType.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaType.cpp Wed Jul 11 11:42:50 2007
@@ -92,7 +92,7 @@
DS.getTypeSpecSign() == 0 &&
"Can't handle qualifiers on typedef names yet!");
// TypeQuals handled by caller.
- return Ctx.getTypeDeclType(cast<TypedefDecl>(D));
+ return Ctx.getTypedefType(cast<TypedefDecl>(D));
}
}
}
Modified: cfe/cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/ASTContext.h?rev=39307&r1=39306&r2=39307&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/cfe/trunk/include/clang/AST/ASTContext.h Wed Jul 11 11:42:50 2007
@@ -66,9 +66,9 @@
TypeRef getFunctionType(TypeRef ResultTy, TypeRef *ArgArray,
unsigned NumArgs, bool isVariadic);
- /// getTypeDeclType - Return the unique reference to the type for the
+ /// getTypedefType - Return the unique reference to the type for the
/// specified typename decl.
- TypeRef getTypeDeclType(TypeDecl *Decl);
+ TypeRef getTypedefType(TypedefDecl *Decl);
/// getTagDeclType - Return the unique reference to the type for the
/// specified TagDecl (struct/union/class/enum) decl.
Modified: cfe/cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Decl.h?rev=39307&r1=39306&r2=39307&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Decl.h Wed Jul 11 11:42:50 2007
@@ -93,27 +93,15 @@
static bool classof(const Decl *) { return true; }
};
-/// TypeDecl - Common base-class for all type name decls, which as Typedefs and
-/// Objective-C classes.
-class TypeDecl : public Decl {
- /// Type. FIXME: This isn't a wonderful place for this.
- TypeRef DeclType;
-public:
- TypeDecl(Kind DK, SourceLocation L, IdentifierInfo *Id, TypeRef T)
- : Decl(DK, L, Id), DeclType(T) {}
-
- TypeRef getUnderlyingType() const { return DeclType; }
-
- // Implement isa/cast/dyncast/etc.
- static bool classof(const Decl *D) { return D->getKind() == Typedef; }
- static bool classof(const TypeDecl *D) { return true; }
-};
-
-class TypedefDecl : public TypeDecl {
+class TypedefDecl : public Decl {
+ /// UnderlyingType - This is the type the typedef is set to.
+ TypeRef UnderlyingType;
public:
// FIXME: Remove Declarator argument.
TypedefDecl(SourceLocation L, IdentifierInfo *Id, TypeRef T)
- : TypeDecl(Typedef, L, Id, T) {}
+ : Decl(Typedef, L, Id), UnderlyingType(T) {}
+
+ TypeRef getUnderlyingType() const { return UnderlyingType; }
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return D->getKind() == Typedef; }
Modified: cfe/cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Type.h?rev=39307&r1=39306&r2=39307&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Type.h Wed Jul 11 11:42:50 2007
@@ -23,7 +23,7 @@
namespace clang {
class ASTContext;
class Type;
- class TypeDecl;
+ class TypedefDecl;
class TagDecl;
class RecordDecl;
class EnumDecl;
@@ -360,18 +360,18 @@
};
-class TypeNameType : public Type {
- TypeDecl *Decl;
- TypeNameType(TypeDecl *D, Type *can) : Type(TypeName, can), Decl(D) {}
+class TypedefType : public Type {
+ TypedefDecl *Decl;
+ TypedefType(TypedefDecl *D, Type *can) : Type(TypeName, can), Decl(D) {}
friend class ASTContext; // ASTContext creates these.
public:
- TypeDecl *getDecl() const { return Decl; }
+ TypedefDecl *getDecl() const { return Decl; }
virtual void getAsString(std::string &InnerString) const;
static bool classof(const Type *T) { return T->getTypeClass() == TypeName; }
- static bool classof(const TypeNameType *) { return true; }
+ static bool classof(const TypedefType *) { return true; }
};
More information about the cfe-commits
mailing list