summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp13
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp25
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateDecl.cpp41
3 files changed, 29 insertions, 50 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index b83181becb9..98b71c7360c 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3668,16 +3668,9 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
QualType T = adjustParameterType(parmDeclType);
- ParmVarDecl *New;
- if (T == parmDeclType) // parameter type did not need adjustment
- New = ParmVarDecl::Create(Context, CurContext,
- D.getIdentifierLoc(), II,
- parmDeclType, DInfo, StorageClass,
- 0);
- else // keep track of both the adjusted and unadjusted types
- New = OriginalParmVarDecl::Create(Context, CurContext,
- D.getIdentifierLoc(), II, T, DInfo,
- parmDeclType, StorageClass, 0);
+ ParmVarDecl *New
+ = ParmVarDecl::Create(Context, CurContext, D.getIdentifierLoc(), II,
+ T, DInfo, StorageClass, 0);
if (D.isInvalidType())
New->setInvalidDecl();
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 22a517934c7..d1b68a79775 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -1707,29 +1707,22 @@ Sema::DeclPtrTy Sema::ActOnMethodDeclaration(
llvm::SmallVector<ParmVarDecl*, 16> Params;
for (unsigned i = 0, e = Sel.getNumArgs(); i != e; ++i) {
- QualType ArgType, UnpromotedArgType;
+ QualType ArgType;
+ DeclaratorInfo *DI;
if (ArgInfo[i].Type == 0) {
- UnpromotedArgType = ArgType = Context.getObjCIdType();
+ ArgType = Context.getObjCIdType();
+ DI = 0;
} else {
- UnpromotedArgType = ArgType = GetTypeFromParser(ArgInfo[i].Type);
+ ArgType = GetTypeFromParser(ArgInfo[i].Type, &DI);
// Perform the default array/function conversions (C99 6.7.5.3p[7,8]).
ArgType = adjustParameterType(ArgType);
}
- ParmVarDecl* Param;
- if (ArgType == UnpromotedArgType)
- Param = ParmVarDecl::Create(Context, ObjCMethod, ArgInfo[i].NameLoc,
- ArgInfo[i].Name, ArgType,
- /*DInfo=*/0, //FIXME: Pass info here.
- VarDecl::None, 0);
- else
- Param = OriginalParmVarDecl::Create(Context, ObjCMethod,
- ArgInfo[i].NameLoc,
- ArgInfo[i].Name, ArgType,
- /*DInfo=*/0, //FIXME: Pass info here.
- UnpromotedArgType,
- VarDecl::None, 0);
+ ParmVarDecl* Param
+ = ParmVarDecl::Create(Context, ObjCMethod, ArgInfo[i].NameLoc,
+ ArgInfo[i].Name, ArgType, DI,
+ VarDecl::None, 0);
if (ArgType->isObjCInterfaceType()) {
Diag(ArgInfo[i].NameLoc,
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index be4adbc93d1..00f148df6e6 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -56,7 +56,6 @@ namespace {
Decl *VisitCXXDestructorDecl(CXXDestructorDecl *D);
Decl *VisitCXXConversionDecl(CXXConversionDecl *D);
ParmVarDecl *VisitParmVarDecl(ParmVarDecl *D);
- Decl *VisitOriginalParmVarDecl(OriginalParmVarDecl *D);
Decl *VisitClassTemplateDecl(ClassTemplateDecl *D);
Decl *VisitClassTemplatePartialSpecializationDecl(
ClassTemplatePartialSpecializationDecl *D);
@@ -776,24 +775,27 @@ Decl *TemplateDeclInstantiator::VisitCXXConversionDecl(CXXConversionDecl *D) {
}
ParmVarDecl *TemplateDeclInstantiator::VisitParmVarDecl(ParmVarDecl *D) {
- QualType OrigT = SemaRef.SubstType(D->getOriginalType(), TemplateArgs,
- D->getLocation(), D->getDeclName());
- if (OrigT.isNull())
+ QualType T;
+ DeclaratorInfo *DI = D->getDeclaratorInfo();
+ if (DI) {
+ DI = SemaRef.SubstType(DI, TemplateArgs, D->getLocation(),
+ D->getDeclName());
+ if (DI) T = DI->getType();
+ } else {
+ T = SemaRef.SubstType(D->getType(), TemplateArgs, D->getLocation(),
+ D->getDeclName());
+ DI = 0;
+ }
+
+ if (T.isNull())
return 0;
- QualType T = SemaRef.adjustParameterType(OrigT);
+ T = SemaRef.adjustParameterType(T);
// Allocate the parameter
- ParmVarDecl *Param = 0;
- if (T == OrigT)
- Param = ParmVarDecl::Create(SemaRef.Context, Owner, D->getLocation(),
- D->getIdentifier(), T, D->getDeclaratorInfo(),
- D->getStorageClass(), 0);
- else
- Param = OriginalParmVarDecl::Create(SemaRef.Context, Owner,
- D->getLocation(), D->getIdentifier(),
- T, D->getDeclaratorInfo(), OrigT,
- D->getStorageClass(), 0);
+ ParmVarDecl *Param
+ = ParmVarDecl::Create(SemaRef.Context, Owner, D->getLocation(),
+ D->getIdentifier(), T, DI, D->getStorageClass(), 0);
// Mark the default argument as being uninstantiated.
if (D->hasUninstantiatedDefaultArg())
@@ -808,15 +810,6 @@ ParmVarDecl *TemplateDeclInstantiator::VisitParmVarDecl(ParmVarDecl *D) {
return Param;
}
-Decl *
-TemplateDeclInstantiator::VisitOriginalParmVarDecl(OriginalParmVarDecl *D) {
- // Since parameter types can decay either before or after
- // instantiation, we simply treat OriginalParmVarDecls as
- // ParmVarDecls the same way, and create one or the other depending
- // on what happens after template instantiation.
- return VisitParmVarDecl(D);
-}
-
Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
TemplateTypeParmDecl *D) {
// TODO: don't always clone when decls are refcounted.
OpenPOWER on IntegriCloud