[cfe-commits] r96766 - in /cfe/trunk: include/clang/AST/ASTContext.h include/clang/AST/ExprCXX.h lib/AST/ASTContext.cpp lib/CodeGen/CodeGenFunction.cpp lib/Frontend/RewriteObjC.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaExprCXX.cpp lib/Sema/SemaLookup.cpp lib/Sema/SemaType.cpp
Douglas Gregor
dgregor at apple.com
Sun Feb 21 14:15:06 PST 2010
Author: dgregor
Date: Sun Feb 21 16:15:06 2010
New Revision: 96766
URL: http://llvm.org/viewvc/llvm-project?rev=96766&view=rev
Log:
Eliminate the default arguments to ASTContext::getFunctionType(),
fixing up a few callers that thought they were propagating NoReturn
information but were in fact saying something about exception
specifications.
Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/lib/Frontend/RewriteObjC.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/lib/Sema/SemaType.cpp
Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=96766&r1=96765&r2=96766&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Sun Feb 21 16:15:06 2010
@@ -529,11 +529,11 @@
/// list. isVariadic indicates whether the argument list includes '...'.
QualType getFunctionType(QualType ResultTy, const QualType *ArgArray,
unsigned NumArgs, bool isVariadic,
- unsigned TypeQuals, bool hasExceptionSpec = false,
- bool hasAnyExceptionSpec = false,
- unsigned NumExs = 0, const QualType *ExArray = 0,
- bool NoReturn = false,
- CallingConv CallConv = CC_Default);
+ unsigned TypeQuals, bool hasExceptionSpec,
+ bool hasAnyExceptionSpec,
+ unsigned NumExs, const QualType *ExArray,
+ bool NoReturn,
+ CallingConv CallConv);
/// getTypeDeclType - Return the unique reference to the type for
/// the specified type declaration.
Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=96766&r1=96765&r2=96766&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Sun Feb 21 16:15:06 2010
@@ -1045,7 +1045,9 @@
SourceLocation DestroyedTypeLoc)
: Expr(CXXPseudoDestructorExprClass,
Context.getPointerType(Context.getFunctionType(Context.VoidTy, 0, 0,
- false, 0)),
+ false, 0, false,
+ false, 0, 0, false,
+ CC_Default)),
/*isTypeDependent=*/false,
/*isValueDependent=*/Base->isValueDependent()),
Base(static_cast<Stmt *>(Base)), IsArrow(isArrow),
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=96766&r1=96765&r2=96766&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sun Feb 21 16:15:06 2010
@@ -4408,7 +4408,8 @@
if (allRTypes) return rhs;
return getFunctionType(retType, proto->arg_type_begin(),
proto->getNumArgs(), proto->isVariadic(),
- proto->getTypeQuals(), NoReturn, lcc);
+ proto->getTypeQuals(),
+ false, false, 0, 0, NoReturn, lcc);
}
if (allLTypes) return lhs;
@@ -4895,8 +4896,11 @@
// handle untyped/variadic arguments "T c99Style();" or "T cppStyle(...);".
if (ArgTypes.size() == 0 && TypeStr[0] == '.')
return getFunctionNoProtoType(ResType);
+
+ // FIXME: Should we create noreturn types?
return getFunctionType(ResType, ArgTypes.data(), ArgTypes.size(),
- TypeStr[0] == '.', 0);
+ TypeStr[0] == '.', 0, false, false, 0, 0,
+ false, CC_Default);
}
QualType
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=96766&r1=96765&r2=96766&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Sun Feb 21 16:15:06 2010
@@ -197,7 +197,10 @@
Builder.SetInsertPoint(EntryBB);
- QualType FnType = getContext().getFunctionType(RetTy, 0, 0, false, 0);
+ QualType FnType = getContext().getFunctionType(RetTy, 0, 0, false, 0,
+ false, false, 0, 0,
+ /*FIXME?*/false,
+ /*FIXME?*/CC_Default);
// Emit subprogram debug descriptor.
if (CGDebugInfo *DI = getDebugInfo()) {
Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=96766&r1=96765&r2=96766&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Sun Feb 21 16:15:06 2010
@@ -2165,8 +2165,10 @@
llvm::SmallVector<QualType, 16> ArgTys;
ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst()));
QualType getFuncType = Context->getFunctionType(Context->getObjCSelType(),
- &ArgTys[0], ArgTys.size(),
- false /*isVariadic*/, 0);
+ &ArgTys[0], ArgTys.size(),
+ false /*isVariadic*/, 0,
+ false, false, 0, 0, false,
+ CC_Default);
SelGetUidFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
SelGetUidIdent, getFuncType, 0,
@@ -2261,7 +2263,9 @@
ArgTys.push_back(argT);
QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(),
&ArgTys[0], ArgTys.size(),
- false, 0);
+ false, 0,
+ false, false, 0, 0, false,
+ CC_Default);
SuperContructorFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
msgSendIdent, msgSendType, 0,
@@ -2280,7 +2284,9 @@
ArgTys.push_back(argT);
QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(),
&ArgTys[0], ArgTys.size(),
- true /*isVariadic*/, 0);
+ true /*isVariadic*/, 0,
+ false, false, 0, 0, false,
+ CC_Default);
MsgSendFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
msgSendIdent, msgSendType, 0,
@@ -2302,7 +2308,9 @@
ArgTys.push_back(argT);
QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(),
&ArgTys[0], ArgTys.size(),
- true /*isVariadic*/, 0);
+ true /*isVariadic*/, 0,
+ false, false, 0, 0, false,
+ CC_Default);
MsgSendSuperFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
msgSendIdent, msgSendType, 0,
@@ -2321,7 +2329,9 @@
ArgTys.push_back(argT);
QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(),
&ArgTys[0], ArgTys.size(),
- true /*isVariadic*/, 0);
+ true /*isVariadic*/, 0,
+ false, false, 0, 0, false,
+ CC_Default);
MsgSendStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
msgSendIdent, msgSendType, 0,
@@ -2345,7 +2355,9 @@
ArgTys.push_back(argT);
QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(),
&ArgTys[0], ArgTys.size(),
- true /*isVariadic*/, 0);
+ true /*isVariadic*/, 0,
+ false, false, 0, 0, false,
+ CC_Default);
MsgSendSuperStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
msgSendIdent, msgSendType, 0,
@@ -2364,7 +2376,9 @@
ArgTys.push_back(argT);
QualType msgSendType = Context->getFunctionType(Context->DoubleTy,
&ArgTys[0], ArgTys.size(),
- true /*isVariadic*/, 0);
+ true /*isVariadic*/, 0,
+ false, false, 0, 0, false,
+ CC_Default);
MsgSendFpretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
msgSendIdent, msgSendType, 0,
@@ -2378,7 +2392,9 @@
ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst()));
QualType getClassType = Context->getFunctionType(Context->getObjCIdType(),
&ArgTys[0], ArgTys.size(),
- false /*isVariadic*/, 0);
+ false /*isVariadic*/, 0,
+ false, false, 0, 0, false,
+ CC_Default);
GetClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
getClassIdent, getClassType, 0,
@@ -2392,7 +2408,9 @@
ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst()));
QualType getClassType = Context->getFunctionType(Context->getObjCIdType(),
&ArgTys[0], ArgTys.size(),
- false /*isVariadic*/, 0);
+ false /*isVariadic*/, 0,
+ false, false, 0, 0, false,
+ CC_Default);
GetMetaClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
getClassIdent, getClassType, 0,
@@ -2804,7 +2822,9 @@
QualType castType = Context->getFunctionType(returnType,
&ArgTypes[0], ArgTypes.size(),
// If we don't have a method decl, force a variadic cast.
- Exp->getMethodDecl() ? Exp->getMethodDecl()->isVariadic() : true, 0);
+ Exp->getMethodDecl() ? Exp->getMethodDecl()->isVariadic() : true, 0,
+ false, false, 0, 0, false,
+ CC_Default);
castType = Context->getPointerType(castType);
cast = NoTypeInfoCStyleCastExpr(Context, castType, CastExpr::CK_Unknown,
cast);
@@ -2833,7 +2853,9 @@
// Now do the "normal" pointer to function cast.
castType = Context->getFunctionType(returnType,
&ArgTypes[0], ArgTypes.size(),
- Exp->getMethodDecl() ? Exp->getMethodDecl()->isVariadic() : false, 0);
+ Exp->getMethodDecl() ? Exp->getMethodDecl()->isVariadic() : false, 0,
+ false, false, 0, 0, false,
+ CC_Default);
castType = Context->getPointerType(castType);
cast = NoTypeInfoCStyleCastExpr(Context, castType, CastExpr::CK_Unknown,
cast);
@@ -4306,7 +4328,9 @@
}
// Now do the pointer to function cast.
QualType PtrToFuncCastType = Context->getFunctionType(Exp->getType(),
- &ArgTypes[0], ArgTypes.size(), false/*no variadic*/, 0);
+ &ArgTypes[0], ArgTypes.size(), false/*no variadic*/, 0,
+ false, false, 0, 0,
+ false, CC_Default);
PtrToFuncCastType = Context->getPointerType(PtrToFuncCastType);
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=96766&r1=96765&r2=96766&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sun Feb 21 16:15:06 2010
@@ -1103,7 +1103,10 @@
NewQType = Context.getFunctionType(NewFuncType->getResultType(),
ParamTypes.data(), ParamTypes.size(),
OldProto->isVariadic(),
- OldProto->getTypeQuals());
+ OldProto->getTypeQuals(),
+ false, false, 0, 0,
+ OldProto->getNoReturnAttr(),
+ OldProto->getCallConv());
New->setType(NewQType);
New->setHasInheritedPrototype();
@@ -1182,7 +1185,10 @@
New->setType(Context.getFunctionType(MergedReturn, &ArgTypes[0],
ArgTypes.size(),
- OldProto->isVariadic(), 0));
+ OldProto->isVariadic(), 0,
+ false, false, 0, 0,
+ OldProto->getNoReturnAttr(),
+ OldProto->getCallConv()));
return MergeCompatibleFunctionDecls(New, Old);
}
@@ -3226,7 +3232,7 @@
// Turn this into a variadic function with no parameters.
QualType R = Context.getFunctionType(
NewFD->getType()->getAs<FunctionType>()->getResultType(),
- 0, 0, true, 0);
+ 0, 0, true, 0, false, false, 0, 0, false, CC_Default);
NewFD->setType(R);
return NewFD->setInvalidDecl();
}
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=96766&r1=96765&r2=96766&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sun Feb 21 16:15:06 2010
@@ -2174,7 +2174,10 @@
CXXConstructorDecl::Create(Context, ClassDecl,
ClassDecl->getLocation(), Name,
Context.getFunctionType(Context.VoidTy,
- 0, 0, false, 0),
+ 0, 0, false, 0,
+ /*FIXME*/false, false,
+ 0, 0, false,
+ CC_Default),
/*TInfo=*/0,
/*isExplicit=*/false,
/*isInline=*/true,
@@ -2246,7 +2249,10 @@
ClassDecl->getLocation(), Name,
Context.getFunctionType(Context.VoidTy,
&ArgType, 1,
- false, 0),
+ false, 0,
+ /*FIXME:*/false,
+ false, 0, 0, false,
+ CC_Default),
/*TInfo=*/0,
/*isExplicit=*/false,
/*isInline=*/true,
@@ -2332,7 +2338,10 @@
CXXMethodDecl *CopyAssignment =
CXXMethodDecl::Create(Context, ClassDecl, ClassDecl->getLocation(), Name,
Context.getFunctionType(RetType, &ArgType, 1,
- false, 0),
+ false, 0,
+ /*FIXME:*/false,
+ false, 0, 0, false,
+ CC_Default),
/*TInfo=*/0, /*isStatic=*/false, /*isInline=*/true);
CopyAssignment->setAccess(AS_public);
CopyAssignment->setImplicit();
@@ -2364,7 +2373,10 @@
= CXXDestructorDecl::Create(Context, ClassDecl,
ClassDecl->getLocation(), Name,
Context.getFunctionType(Context.VoidTy,
- 0, 0, false, 0),
+ 0, 0, false, 0,
+ /*FIXME:*/false,
+ false, 0, 0, false,
+ CC_Default),
/*isInline=*/true,
/*isImplicitlyDeclared=*/true);
Destructor->setAccess(AS_public);
@@ -2523,7 +2535,13 @@
const FunctionProtoType *Proto = R->getAs<FunctionProtoType>();
return Context.getFunctionType(Context.VoidTy, Proto->arg_type_begin(),
Proto->getNumArgs(),
- Proto->isVariadic(), 0);
+ Proto->isVariadic(), 0,
+ Proto->hasExceptionSpec(),
+ Proto->hasAnyExceptionSpec(),
+ Proto->getNumExceptions(),
+ Proto->exception_begin(),
+ Proto->getNoReturnAttr(),
+ Proto->getCallConv());
}
/// CheckConstructor - Checks a fully-formed constructor for
@@ -2680,7 +2698,9 @@
// "void" as the return type, since destructors don't have return
// types. We *always* have to do this, because GetTypeForDeclarator
// will put in a result type of "int" when none was specified.
- return Context.getFunctionType(Context.VoidTy, 0, 0, false, 0);
+ // FIXME: Exceptions!
+ return Context.getFunctionType(Context.VoidTy, 0, 0, false, 0,
+ false, false, 0, 0, false, CC_Default);
}
/// CheckConversionDeclarator - Called by ActOnDeclarator to check the
@@ -2749,8 +2769,15 @@
// Rebuild the function type "R" without any parameters (in case any
// of the errors above fired) and with the conversion type as the
// return type.
+ const FunctionProtoType *Proto = R->getAs<FunctionProtoType>();
R = Context.getFunctionType(ConvType, 0, 0, false,
- R->getAs<FunctionProtoType>()->getTypeQuals());
+ Proto->getTypeQuals(),
+ Proto->hasExceptionSpec(),
+ Proto->hasAnyExceptionSpec(),
+ Proto->getNumExceptions(),
+ Proto->exception_begin(),
+ Proto->getNoReturnAttr(),
+ Proto->getCallConv());
// C++0x explicit conversion operators.
if (D.getDeclSpec().isExplicitSpecified() && !getLangOptions().CPlusPlus0x)
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=96766&r1=96765&r2=96766&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sun Feb 21 16:15:06 2010
@@ -6802,7 +6802,8 @@
// The parameter list is optional, if there was none, assume ().
if (!T->isFunctionType())
- T = Context.getFunctionType(T, NULL, 0, 0, 0);
+ T = Context.getFunctionType(T, 0, 0, false, 0, false, false, 0, 0, false,
+ CC_Default);
CurBlock->hasPrototype = true;
CurBlock->isVariadic = false;
@@ -6928,11 +6929,11 @@
QualType BlockTy;
if (!BSI->hasPrototype)
BlockTy = Context.getFunctionType(RetTy, 0, 0, false, 0, false, false, 0, 0,
- NoReturn);
+ NoReturn, CC_Default);
else
BlockTy = Context.getFunctionType(RetTy, ArgTypes.data(), ArgTypes.size(),
BSI->isVariadic, 0, false, false, 0, 0,
- NoReturn);
+ NoReturn, CC_Default);
// FIXME: Check that return/parameter types are complete/non-abstract
DiagnoseUnusedParameters(BSI->Params.begin(), BSI->Params.end());
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=96766&r1=96765&r2=96766&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sun Feb 21 16:15:06 2010
@@ -1023,7 +1023,7 @@
QualType FnType = Context.getFunctionType(Return, &Argument, 1, false, 0,
true, false,
HasBadAllocExceptionSpec? 1 : 0,
- &BadAllocType);
+ &BadAllocType, false, CC_Default);
FunctionDecl *Alloc =
FunctionDecl::Create(Context, GlobalCtx, SourceLocation(), Name,
FnType, /*TInfo=*/0, FunctionDecl::None, false, true);
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=96766&r1=96765&r2=96766&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Sun Feb 21 16:15:06 2010
@@ -544,7 +544,8 @@
0, 0, ConvProto->isVariadic(),
ConvProto->getTypeQuals(),
false, false, 0, 0,
- ConvProto->getNoReturnAttr());
+ ConvProto->getNoReturnAttr(),
+ CC_Default);
// Perform template argument deduction against the type that we would
// expect the function to have.
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=96766&r1=96765&r2=96766&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Sun Feb 21 16:15:06 2010
@@ -797,7 +797,7 @@
return QualType();
return Context.getFunctionType(T, ParamTypes, NumParamTypes, Variadic,
- Quals);
+ Quals, false, false, 0, 0, false, CC_Default);
}
/// \brief Build a member pointer type \c T Class::*.
@@ -1132,7 +1132,8 @@
T = Context.getFunctionType(T, NULL, 0, FTI.isVariadic, FTI.TypeQuals,
FTI.hasExceptionSpec,
FTI.hasAnyExceptionSpec,
- Exceptions.size(), Exceptions.data());
+ Exceptions.size(), Exceptions.data(),
+ false, CC_Default);
} else if (FTI.isVariadic) {
// We allow a zero-parameter variadic function in C if the
// function is marked with the "overloadable"
@@ -1148,7 +1149,8 @@
if (!Overloadable)
Diag(FTI.getEllipsisLoc(), diag::err_ellipsis_first_arg);
- T = Context.getFunctionType(T, NULL, 0, FTI.isVariadic, 0);
+ T = Context.getFunctionType(T, NULL, 0, FTI.isVariadic, 0,
+ false, false, 0, 0, false, CC_Default);
} else {
// Simple void foo(), where the incoming T is the result type.
T = Context.getFunctionNoProtoType(T);
@@ -1223,7 +1225,8 @@
FTI.isVariadic, FTI.TypeQuals,
FTI.hasExceptionSpec,
FTI.hasAnyExceptionSpec,
- Exceptions.size(), Exceptions.data());
+ Exceptions.size(), Exceptions.data(),
+ false, CC_Default);
}
// For GCC compatibility, we allow attributes that apply only to
@@ -1320,7 +1323,8 @@
// Strip the cv-quals from the type.
T = Context.getFunctionType(FnTy->getResultType(), FnTy->arg_type_begin(),
- FnTy->getNumArgs(), FnTy->isVariadic(), 0);
+ FnTy->getNumArgs(), FnTy->isVariadic(), 0,
+ false, false, 0, 0, false, CC_Default);
}
}
More information about the cfe-commits
mailing list