From 8bcfc5bef434d7052e28d0ce45182855659ebd3d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 6 Apr 2008 23:10:54 +0000 Subject: [PATCH] remove the Decl::getCanonicalType() method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49295 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/Decl.h | 1 - lib/CodeGen/CGDecl.cpp | 7 +++---- lib/Sema/SemaDecl.cpp | 9 +++++---- lib/Sema/SemaDeclObjC.cpp | 3 ++- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index c6c77b43e6..b3dd43cd18 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -116,7 +116,6 @@ protected: 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) { diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index 3fcd60e7b6..8255c12f01 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -66,7 +66,7 @@ void CodeGenFunction::EmitBlockVarDecl(const BlockVarDecl &D) { } 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 @@ void CodeGenFunction::EmitStaticBlockVarDecl(const BlockVarDecl &D) { 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 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const BlockVarDecl &D) { /// 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()) { diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 9498fb2c9e..0f464a0bc7 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -280,8 +280,8 @@ FunctionDecl *Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { 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 @@ VarDecl *Sema::MergeVarDecl(VarDecl *New, Decl *OldD) { 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; diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 9cf1b3c425..c94c681fcb 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -619,7 +619,8 @@ bool Sema::MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, 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; -- 2.40.0