aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
diff options
context:
space:
mode:
authorAbramo Bagnara <abramo.bagnara@gmail.com>2010-12-14 22:11:44 +0000
committerAbramo Bagnara <abramo.bagnara@gmail.com>2010-12-14 22:11:44 +0000
commit723df245307a530da5433dfb43accf187dc3e243 (patch)
tree54bc41314c4898d2d1f156fbf627a159eb38e56d /lib/Sema
parent8786da77984e81d48e0e1b2bd339809b1efc19f3 (diff)
Added missing IgnoreParens().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121795 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaCodeComplete.cpp5
-rw-r--r--lib/Sema/SemaDecl.cpp4
-rw-r--r--lib/Sema/SemaDeclAttr.cpp2
-rw-r--r--lib/Sema/SemaExceptionSpec.cpp4
-rw-r--r--lib/Sema/SemaExpr.cpp5
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp2
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp8
7 files changed, 13 insertions, 17 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index 2394629be5..76452a4516 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -1918,10 +1918,7 @@ static std::string FormatFunctionParameter(ASTContext &Context,
// then we're done.
if (BlockPointerTypeLoc *BlockPtr
= dyn_cast<BlockPointerTypeLoc>(&TL)) {
- TL = BlockPtr->getPointeeLoc();
- // Skip any paren typeloc.
- while (ParenTypeLoc *ParenPtr = dyn_cast<ParenTypeLoc>(&TL))
- TL = ParenPtr->getInnerLoc();
+ TL = BlockPtr->getPointeeLoc().IgnoreParens();
Block = dyn_cast<FunctionProtoTypeLoc>(&TL);
}
break;
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 66e517008c..3506456eb7 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3761,7 +3761,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
// Copy the parameter declarations from the declarator D to the function
// declaration NewFD, if they are available. First scavenge them into Params.
llvm::SmallVector<ParmVarDecl*, 16> Params;
- if (D.getNumTypeObjects() > 0) {
+ if (D.isFunctionDeclarator()) {
DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo();
// Check for C99 6.7.5.3p10 - foo(void) is a non-varargs
@@ -4283,7 +4283,7 @@ void Sema::CheckMain(FunctionDecl* FD) {
if (!Context.hasSameUnqualifiedType(FT->getResultType(), Context.IntTy)) {
TypeSourceInfo *TSI = FD->getTypeSourceInfo();
- TypeLoc TL = TSI->getTypeLoc();
+ TypeLoc TL = TSI->getTypeLoc().IgnoreParens();
const SemaDiagnosticBuilder& D = Diag(FD->getTypeSpecStartLoc(),
diag::err_main_returns_nonint);
if (FunctionTypeLoc* PTL = dyn_cast<FunctionTypeLoc>(&TL)) {
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 8a88ae5f57..3453528d8a 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -2170,7 +2170,7 @@ static void HandleGlobalAttr(Decl *d, const AttributeList &Attr, Sema &S) {
FunctionDecl *FD = cast<FunctionDecl>(d);
if (!FD->getResultType()->isVoidType()) {
- TypeLoc TL = FD->getTypeSourceInfo()->getTypeLoc();
+ TypeLoc TL = FD->getTypeSourceInfo()->getTypeLoc().IgnoreParens();
if (FunctionTypeLoc* FTL = dyn_cast<FunctionTypeLoc>(&TL)) {
S.Diag(FD->getTypeSpecStartLoc(), diag::err_kern_type_not_void_return)
<< FD->getType()
diff --git a/lib/Sema/SemaExceptionSpec.cpp b/lib/Sema/SemaExceptionSpec.cpp
index d08e84dacd..5d7993b1af 100644
--- a/lib/Sema/SemaExceptionSpec.cpp
+++ b/lib/Sema/SemaExceptionSpec.cpp
@@ -81,7 +81,6 @@ bool Sema::CheckSpecifiedExceptionType(QualType T, const SourceRange &Range) {
/// to member to a function with an exception specification. This means that
/// it is invalid to add another level of indirection.
bool Sema::CheckDistantExceptionSpec(QualType T) {
- T = T.IgnoreParens();
if (const PointerType *PT = T->getAs<PointerType>())
T = PT->getPointeeType();
else if (const MemberPointerType *PT = T->getAs<MemberPointerType>())
@@ -89,7 +88,6 @@ bool Sema::CheckDistantExceptionSpec(QualType T) {
else
return false;
- T = T.IgnoreParens();
const FunctionProtoType *FnT = T->getAs<FunctionProtoType>();
if (!FnT)
return false;
@@ -198,7 +196,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) {
SourceLocation AfterParenLoc;
if (TypeSourceInfo *TSInfo = New->getTypeSourceInfo()) {
- TypeLoc TL = TSInfo->getTypeLoc();
+ TypeLoc TL = TSInfo->getTypeLoc().IgnoreParens();
if (const FunctionTypeLoc *FTLoc = dyn_cast<FunctionTypeLoc>(&TL))
AfterParenLoc = PP.getLocForEndOfToken(FTLoc->getRParenLoc());
}
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 862a242d51..218a0b313d 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -8240,8 +8240,9 @@ void Sema::ActOnBlockArguments(Declarator &ParamInfo, Scope *CurScope) {
// Push block parameters from the declarator if we had them.
llvm::SmallVector<ParmVarDecl*, 8> Params;
- if (isa<FunctionProtoType>(T)) {
- FunctionProtoTypeLoc TL = cast<FunctionProtoTypeLoc>(Sig->getTypeLoc());
+ if (isa<FunctionProtoType>(T.IgnoreParens())) {
+ FunctionProtoTypeLoc TL
+ = cast<FunctionProtoTypeLoc>(Sig->getTypeLoc().IgnoreParens());
for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
ParmVarDecl *Param = TL.getArg(I);
if (Param->getIdentifier() == 0 &&
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index 65e61ed174..fe9750108b 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -990,7 +990,7 @@ static bool NeedsInstantiationAsFunctionType(TypeSourceInfo *T) {
if (T->getType()->isDependentType() || T->getType()->isVariablyModifiedType())
return true;
- TypeLoc TL = T->getTypeLoc();
+ TypeLoc TL = T->getTypeLoc().IgnoreParens();
if (!isa<FunctionProtoTypeLoc>(TL))
return false;
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 2f73991ec5..b6ef498874 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1264,16 +1264,16 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
return 0;
QualType T = TInfo->getType();
- // \brief If the type of this function is not *directly* a function
- // type, then we're instantiating the a function that was declared
- // via a typedef, e.g.,
+ // \brief If the type of this function, after ignoring parentheses,
+ // is not *directly* a function type, then we're instantiating a function
+ // that was declared via a typedef, e.g.,
//
// typedef int functype(int, int);
// functype func;
//
// In this case, we'll just go instantiate the ParmVarDecls that we
// synthesized in the method declaration.
- if (!isa<FunctionProtoType>(T)) {
+ if (!isa<FunctionProtoType>(T.IgnoreParens())) {
assert(!Params.size() && "Instantiating type could not yield parameters");
for (unsigned I = 0, N = D->getNumParams(); I != N; ++I) {
ParmVarDecl *P = SemaRef.SubstParmVarDecl(D->getParamDecl(I),