On Dec 20, 2008, at 2:52 PM, Douglas Gregor wrote: > On Dec 20, 2008, at 12:56 PM, Fariborz Jahanian wrote: > >> Author: fjahanian >> Date: Sat Dec 20 14:56:12 2008 >> New Revision: 61286 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=61286&view=rev >> Log: >> introducing ParmVarWithOriginalTypeDecl class to >> keep track of the original parameter decl. types. > > Great! > >> >> +/// ParmVarWithOriginalTypeDecl - Represent a parameter to a >> function, when >> +/// the type of the parameter has been promoted. This node >> represents the >> +/// parameter to the function with its original type. >> +/// >> +class ParmVarWithOriginalTypeDecl : public ParmVarDecl { >> +private: >> + QualType OriginalType; >> + >> + ParmVarWithOriginalTypeDecl(DeclContext *DC, SourceLocation L, >> + IdentifierInfo *Id, QualType T, >> + QualType OT, StorageClass S, >> + Expr *DefArg, ScopedDecl *PrevDecl) >> + : ParmVarDecl(DC, L, Id, T, S, DefArg, PrevDecl), >> OriginalType(OT) {} >> +public: >> + static ParmVarWithOriginalTypeDecl *Create(ASTContext &C, >> DeclContext *DC, >> + SourceLocation L,IdentifierInfo *Id, >> + QualType T, QualType OT, >> + StorageClass S, Expr *DefArg, >> + ScopedDecl *PrevDecl); >> + QualType getQualType() const { return OriginalType; } > > I think getQualType should be removed. Instead, we add a member > function getOriginalType() to ParmVarDecl that looks like this: > > QualType getOriginalType() const { > if (const ParmVarWithOriginalTypeDecl *PVD = > dyn_cast<ParmVarWithOriginalTypeDecl>(this)) > return PVD->OriginalType; > return getType(); > }
Good point. I was doing this on the caller site. But will move it here. > > > That way, ParmVarWithOriginalTypeDecl could be hidden almost > completely from clients, who will won't need to ever name this type > except when the parameter is originally created. > > Please make sure to update classof() in ParmVarDecl to account for > this new subclass. Yes. I did the change locally. - Thanks, Fariborz > > > - Doug _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
