[cfe-commits] r49295 - in /cfe/trunk: include/clang/AST/Decl.h lib/CodeGen/CGDecl.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclObjC.cpp

Chris Lattner sabre at nondot.org
Sun Apr 6 16:10:55 PDT 2008


Author: lattner
Date: Sun Apr  6 18:10:54 2008
New Revision: 49295

URL: http://llvm.org/viewvc/llvm-project?rev=49295&view=rev
Log:
remove the Decl::getCanonicalType() method.

Modified:
    cfe/trunk/include/clang/AST/Decl.h
    cfe/trunk/lib/CodeGen/CGDecl.cpp
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=49295&r1=49294&r2=49295&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Sun Apr  6 18:10:54 2008
@@ -116,7 +116,6 @@
 public:
   QualType getType() const { return DeclType; }
   void setType(QualType newType) { DeclType = newType; }
-  QualType getCanonicalType() const { return DeclType.getCanonicalType(); }
   
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) {

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=49295&r1=49294&r2=49295&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Sun Apr  6 18:10:54 2008
@@ -66,7 +66,7 @@
 }
 
 void CodeGenFunction::EmitStaticBlockVarDecl(const BlockVarDecl &D) {
-  QualType Ty = D.getCanonicalType();
+  QualType Ty = D.getType();
   assert(Ty->isConstantSizeType() && "VLAs can't be static");
   
   llvm::Value *&DMEntry = LocalDeclMap[&D];
@@ -94,14 +94,13 @@
                              Init, ContextName + "." + D.getName(),
                              &CGM.getModule(), 0,
                              Ty.getAddressSpace());
-  
 }
   
 /// EmitLocalBlockVarDecl - Emit code and set up an entry in LocalDeclMap for a
 /// variable declaration with auto, register, or no storage class specifier.
 /// These turn into simple stack objects.
 void CodeGenFunction::EmitLocalBlockVarDecl(const BlockVarDecl &D) {
-  QualType Ty = D.getCanonicalType();
+  QualType Ty = D.getType();
 
   llvm::Value *DeclPtr;
   if (Ty->isConstantSizeType()) {
@@ -133,7 +132,7 @@
 
 /// Emit an alloca for the specified parameter and set up LocalDeclMap.
 void CodeGenFunction::EmitParmDecl(const ParmVarDecl &D, llvm::Value *Arg) {
-  QualType Ty = D.getCanonicalType();
+  QualType Ty = D.getType();
   
   llvm::Value *DeclPtr;
   if (!Ty->isConstantSizeType()) {

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=49295&r1=49294&r2=49295&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sun Apr  6 18:10:54 2008
@@ -280,8 +280,8 @@
   MergeAttributes(New, Old);
 
   
-  QualType OldQType = Old->getType().getCanonicalType();
-  QualType NewQType = New->getType().getCanonicalType();
+  QualType OldQType = Context.getCanonicalType(Old->getType());
+  QualType NewQType = Context.getCanonicalType(New->getType());
   
   // Function types need to be compatible, not identical. This handles
   // duplicate function decls like "void f(int); void f(enum X);" properly.
@@ -357,8 +357,9 @@
   MergeAttributes(New, Old);
 
   // Verify the types match.
-  if (Old->getCanonicalType() != New->getCanonicalType() && 
-      !areEquivalentArrayTypes(New->getCanonicalType(), Old->getCanonicalType())) {
+  QualType OldCType = Context.getCanonicalType(Old->getType());
+  QualType NewCType = Context.getCanonicalType(New->getType());
+  if (OldCType != NewCType && !areEquivalentArrayTypes(NewCType, OldCType)) {
     Diag(New->getLocation(), diag::err_redefinition, New->getName());
     Diag(Old->getLocation(), diag::err_previous_definition);
     return New;

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=49295&r1=49294&r2=49295&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Sun Apr  6 18:10:54 2008
@@ -619,7 +619,8 @@
   for (unsigned i = 0, e = Method->getNumParams(); i != e; ++i) {
     ParmVarDecl *ParamDecl = Method->getParamDecl(i);
     ParmVarDecl *PrevParamDecl = PrevMethod->getParamDecl(i);
-    if (ParamDecl->getCanonicalType() != PrevParamDecl->getCanonicalType())
+    if (Context.getCanonicalType(ParamDecl->getType()) !=
+        Context.getCanonicalType(PrevParamDecl->getType()))
       return false;
   }
   return true;





More information about the cfe-commits mailing list