forked from OSchip/llvm-project
Rename FunctionProtoType accessors from 'arguments' to 'parameters'
Fix a perennial source of confusion in the clang type system: Declarations and function prototypes have parameters to which arguments are supplied, so calling these 'arguments' was a stretch even in C mode, let alone C++ where default arguments, templates and overloading make the distinction important to get right. Readability win across the board, especially in the casting, ADL and overloading implementations which make a lot more sense at a glance now. Will keep an eye on the builders and update dependent projects shortly. No functional change. llvm-svn: 199686
This commit is contained in:
parent
8ff1610f06
commit
9cacbabd33
|
@ -2017,7 +2017,7 @@ public:
|
||||||
bool Unqualified = false, bool BlockReturnType = false);
|
bool Unqualified = false, bool BlockReturnType = false);
|
||||||
QualType mergeFunctionTypes(QualType, QualType, bool OfBlockPointer=false,
|
QualType mergeFunctionTypes(QualType, QualType, bool OfBlockPointer=false,
|
||||||
bool Unqualified = false);
|
bool Unqualified = false);
|
||||||
QualType mergeFunctionArgumentTypes(QualType, QualType,
|
QualType mergeFunctionParameterTypes(QualType, QualType,
|
||||||
bool OfBlockPointer = false,
|
bool OfBlockPointer = false,
|
||||||
bool Unqualified = false);
|
bool Unqualified = false);
|
||||||
QualType mergeTransparentUnionType(QualType, QualType,
|
QualType mergeTransparentUnionType(QualType, QualType,
|
||||||
|
|
|
@ -557,23 +557,23 @@ struct CanProxyAdaptor<FunctionProtoType>
|
||||||
: public CanProxyBase<FunctionProtoType> {
|
: public CanProxyBase<FunctionProtoType> {
|
||||||
LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getResultType)
|
LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getResultType)
|
||||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(FunctionType::ExtInfo, getExtInfo)
|
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(FunctionType::ExtInfo, getExtInfo)
|
||||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumArgs)
|
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumParams)
|
||||||
CanQualType getArgType(unsigned i) const {
|
CanQualType getParamType(unsigned i) const {
|
||||||
return CanQualType::CreateUnsafe(this->getTypePtr()->getArgType(i));
|
return CanQualType::CreateUnsafe(this->getTypePtr()->getParamType(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isVariadic)
|
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isVariadic)
|
||||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getTypeQuals)
|
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getTypeQuals)
|
||||||
|
|
||||||
typedef CanTypeIterator<FunctionProtoType::arg_type_iterator>
|
typedef CanTypeIterator<FunctionProtoType::param_type_iterator>
|
||||||
arg_type_iterator;
|
param_type_iterator;
|
||||||
|
|
||||||
arg_type_iterator arg_type_begin() const {
|
param_type_iterator param_type_begin() const {
|
||||||
return arg_type_iterator(this->getTypePtr()->arg_type_begin());
|
return param_type_iterator(this->getTypePtr()->param_type_begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
arg_type_iterator arg_type_end() const {
|
param_type_iterator param_type_end() const {
|
||||||
return arg_type_iterator(this->getTypePtr()->arg_type_end());
|
return param_type_iterator(this->getTypePtr()->param_type_end());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: canonical function types never have exception specifications
|
// Note: canonical function types never have exception specifications
|
||||||
|
|
|
@ -873,8 +873,8 @@ DEF_TRAVERSE_TYPE(FunctionNoProtoType, {
|
||||||
DEF_TRAVERSE_TYPE(FunctionProtoType, {
|
DEF_TRAVERSE_TYPE(FunctionProtoType, {
|
||||||
TRY_TO(TraverseType(T->getResultType()));
|
TRY_TO(TraverseType(T->getResultType()));
|
||||||
|
|
||||||
for (FunctionProtoType::arg_type_iterator A = T->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator A = T->param_type_begin(),
|
||||||
AEnd = T->arg_type_end();
|
AEnd = T->param_type_end();
|
||||||
A != AEnd; ++A) {
|
A != AEnd; ++A) {
|
||||||
TRY_TO(TraverseType(*A));
|
TRY_TO(TraverseType(*A));
|
||||||
}
|
}
|
||||||
|
@ -1106,8 +1106,8 @@ DEF_TRAVERSE_TYPELOC(FunctionProtoType, {
|
||||||
for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
|
for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
|
||||||
if (TL.getArg(I)) {
|
if (TL.getArg(I)) {
|
||||||
TRY_TO(TraverseDecl(TL.getArg(I)));
|
TRY_TO(TraverseDecl(TL.getArg(I)));
|
||||||
} else if (I < T->getNumArgs()) {
|
} else if (I < T->getNumParams()) {
|
||||||
TRY_TO(TraverseType(T->getArgType(I)));
|
TRY_TO(TraverseType(T->getParamType(I)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -381,15 +381,23 @@ public:
|
||||||
// Iterator access to parameter types.
|
// Iterator access to parameter types.
|
||||||
typedef std::const_mem_fun_t<QualType, ParmVarDecl> deref_fun;
|
typedef std::const_mem_fun_t<QualType, ParmVarDecl> deref_fun;
|
||||||
typedef llvm::mapped_iterator<param_const_iterator, deref_fun>
|
typedef llvm::mapped_iterator<param_const_iterator, deref_fun>
|
||||||
arg_type_iterator;
|
param_type_iterator;
|
||||||
|
|
||||||
arg_type_iterator arg_type_begin() const {
|
param_type_iterator arg_type_begin() const {
|
||||||
return llvm::map_iterator(param_begin(), deref_fun(&ParmVarDecl::getType));
|
return llvm::map_iterator(param_begin(), deref_fun(&ParmVarDecl::getType));
|
||||||
}
|
}
|
||||||
arg_type_iterator arg_type_end() const {
|
param_type_iterator arg_type_end() const {
|
||||||
return llvm::map_iterator(param_end(), deref_fun(&ParmVarDecl::getType));
|
return llvm::map_iterator(param_end(), deref_fun(&ParmVarDecl::getType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FunctionProtoType adapters.
|
||||||
|
param_type_iterator param_type_begin() const {
|
||||||
|
return arg_type_begin();
|
||||||
|
}
|
||||||
|
param_type_iterator param_type_end() const {
|
||||||
|
return arg_type_end();
|
||||||
|
}
|
||||||
|
|
||||||
/// createImplicitParams - Used to lazily create the self and cmd
|
/// createImplicitParams - Used to lazily create the self and cmd
|
||||||
/// implict parameters. This must be called prior to using getSelfDecl()
|
/// implict parameters. This must be called prior to using getSelfDecl()
|
||||||
/// or getCmdDecl(). The call is ignored if the implicit paramters
|
/// or getCmdDecl(). The call is ignored if the implicit paramters
|
||||||
|
|
|
@ -954,8 +954,8 @@ DEF_TRAVERSE_TYPE(FunctionNoProtoType, {
|
||||||
DEF_TRAVERSE_TYPE(FunctionProtoType, {
|
DEF_TRAVERSE_TYPE(FunctionProtoType, {
|
||||||
TRY_TO(TraverseType(T->getResultType()));
|
TRY_TO(TraverseType(T->getResultType()));
|
||||||
|
|
||||||
for (FunctionProtoType::arg_type_iterator A = T->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator A = T->param_type_begin(),
|
||||||
AEnd = T->arg_type_end();
|
AEnd = T->param_type_end();
|
||||||
A != AEnd; ++A) {
|
A != AEnd; ++A) {
|
||||||
TRY_TO(TraverseType(*A));
|
TRY_TO(TraverseType(*A));
|
||||||
}
|
}
|
||||||
|
@ -1187,8 +1187,8 @@ DEF_TRAVERSE_TYPELOC(FunctionProtoType, {
|
||||||
for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
|
for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
|
||||||
if (TL.getArg(I)) {
|
if (TL.getArg(I)) {
|
||||||
TRY_TO(TraverseDecl(TL.getArg(I)));
|
TRY_TO(TraverseDecl(TL.getArg(I)));
|
||||||
} else if (I < T->getNumArgs()) {
|
} else if (I < T->getNumParams()) {
|
||||||
TRY_TO(TraverseType(T->getArgType(I)));
|
TRY_TO(TraverseType(T->getParamType(I)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2933,11 +2933,11 @@ private:
|
||||||
|
|
||||||
friend class ASTContext; // ASTContext creates these.
|
friend class ASTContext; // ASTContext creates these.
|
||||||
|
|
||||||
const bool *getConsumedArgsBuffer() const {
|
const bool *getConsumedParamsBuffer() const {
|
||||||
assert(hasAnyConsumedArgs());
|
assert(hasAnyConsumedParams());
|
||||||
|
|
||||||
// Find the end of the exceptions.
|
// Find the end of the exceptions.
|
||||||
Expr * const *eh_end = reinterpret_cast<Expr * const *>(arg_type_end());
|
Expr *const *eh_end = reinterpret_cast<Expr *const *>(param_type_end());
|
||||||
if (getExceptionSpecType() != EST_ComputedNoexcept)
|
if (getExceptionSpecType() != EST_ComputedNoexcept)
|
||||||
eh_end += NumExceptions;
|
eh_end += NumExceptions;
|
||||||
else
|
else
|
||||||
|
@ -2947,13 +2947,13 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
unsigned getNumArgs() const { return NumArgs; }
|
unsigned getNumParams() const { return NumArgs; }
|
||||||
QualType getArgType(unsigned i) const {
|
QualType getParamType(unsigned i) const {
|
||||||
assert(i < NumArgs && "Invalid argument number!");
|
assert(i < NumArgs && "Invalid parameter index");
|
||||||
return arg_type_begin()[i];
|
return param_type_begin()[i];
|
||||||
}
|
}
|
||||||
ArrayRef<QualType> getArgTypes() const {
|
ArrayRef<QualType> getParamTypes() const {
|
||||||
return ArrayRef<QualType>(arg_type_begin(), arg_type_end());
|
return ArrayRef<QualType>(param_type_begin(), param_type_end());
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtProtoInfo getExtProtoInfo() const {
|
ExtProtoInfo getExtProtoInfo() const {
|
||||||
|
@ -2975,8 +2975,8 @@ public:
|
||||||
} else if (EPI.ExceptionSpecType == EST_Unevaluated) {
|
} else if (EPI.ExceptionSpecType == EST_Unevaluated) {
|
||||||
EPI.ExceptionSpecDecl = getExceptionSpecDecl();
|
EPI.ExceptionSpecDecl = getExceptionSpecDecl();
|
||||||
}
|
}
|
||||||
if (hasAnyConsumedArgs())
|
if (hasAnyConsumedParams())
|
||||||
EPI.ConsumedArguments = getConsumedArgsBuffer();
|
EPI.ConsumedArguments = getConsumedParamsBuffer();
|
||||||
return EPI;
|
return EPI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3015,7 +3015,7 @@ public:
|
||||||
if (getExceptionSpecType() != EST_ComputedNoexcept)
|
if (getExceptionSpecType() != EST_ComputedNoexcept)
|
||||||
return 0;
|
return 0;
|
||||||
// NoexceptExpr sits where the arguments end.
|
// NoexceptExpr sits where the arguments end.
|
||||||
return *reinterpret_cast<Expr *const *>(arg_type_end());
|
return *reinterpret_cast<Expr *const *>(param_type_end());
|
||||||
}
|
}
|
||||||
/// \brief If this function type has an exception specification which hasn't
|
/// \brief If this function type has an exception specification which hasn't
|
||||||
/// been determined yet (either because it has not been evaluated or because
|
/// been determined yet (either because it has not been evaluated or because
|
||||||
|
@ -3025,7 +3025,7 @@ public:
|
||||||
if (getExceptionSpecType() != EST_Uninstantiated &&
|
if (getExceptionSpecType() != EST_Uninstantiated &&
|
||||||
getExceptionSpecType() != EST_Unevaluated)
|
getExceptionSpecType() != EST_Unevaluated)
|
||||||
return 0;
|
return 0;
|
||||||
return reinterpret_cast<FunctionDecl * const *>(arg_type_end())[0];
|
return reinterpret_cast<FunctionDecl *const *>(param_type_end())[0];
|
||||||
}
|
}
|
||||||
/// \brief If this function type has an uninstantiated exception
|
/// \brief If this function type has an uninstantiated exception
|
||||||
/// specification, this is the function whose exception specification
|
/// specification, this is the function whose exception specification
|
||||||
|
@ -3034,7 +3034,7 @@ public:
|
||||||
FunctionDecl *getExceptionSpecTemplate() const {
|
FunctionDecl *getExceptionSpecTemplate() const {
|
||||||
if (getExceptionSpecType() != EST_Uninstantiated)
|
if (getExceptionSpecType() != EST_Uninstantiated)
|
||||||
return 0;
|
return 0;
|
||||||
return reinterpret_cast<FunctionDecl * const *>(arg_type_end())[1];
|
return reinterpret_cast<FunctionDecl *const *>(param_type_end())[1];
|
||||||
}
|
}
|
||||||
/// \brief Determine whether this function type has a non-throwing exception
|
/// \brief Determine whether this function type has a non-throwing exception
|
||||||
/// specification. If this depends on template arguments, returns
|
/// specification. If this depends on template arguments, returns
|
||||||
|
@ -3061,16 +3061,18 @@ public:
|
||||||
return static_cast<RefQualifierKind>(RefQualifier);
|
return static_cast<RefQualifierKind>(RefQualifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef const QualType *arg_type_iterator;
|
typedef const QualType *param_type_iterator;
|
||||||
arg_type_iterator arg_type_begin() const {
|
param_type_iterator param_type_begin() const {
|
||||||
return reinterpret_cast<const QualType *>(this+1);
|
return reinterpret_cast<const QualType *>(this+1);
|
||||||
}
|
}
|
||||||
arg_type_iterator arg_type_end() const { return arg_type_begin()+NumArgs; }
|
param_type_iterator param_type_end() const {
|
||||||
|
return param_type_begin() + NumArgs;
|
||||||
|
}
|
||||||
|
|
||||||
typedef const QualType *exception_iterator;
|
typedef const QualType *exception_iterator;
|
||||||
exception_iterator exception_begin() const {
|
exception_iterator exception_begin() const {
|
||||||
// exceptions begin where arguments end
|
// exceptions begin where arguments end
|
||||||
return arg_type_end();
|
return param_type_end();
|
||||||
}
|
}
|
||||||
exception_iterator exception_end() const {
|
exception_iterator exception_end() const {
|
||||||
if (getExceptionSpecType() != EST_Dynamic)
|
if (getExceptionSpecType() != EST_Dynamic)
|
||||||
|
@ -3078,13 +3080,11 @@ public:
|
||||||
return exception_begin() + NumExceptions;
|
return exception_begin() + NumExceptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasAnyConsumedArgs() const {
|
bool hasAnyConsumedParams() const { return HasAnyConsumedArgs; }
|
||||||
return HasAnyConsumedArgs;
|
bool isParamConsumed(unsigned I) const {
|
||||||
}
|
assert(I < getNumParams() && "parameter index out of range");
|
||||||
bool isArgConsumed(unsigned I) const {
|
if (hasAnyConsumedParams())
|
||||||
assert(I < getNumArgs() && "argument index out of range!");
|
return getConsumedParamsBuffer()[I];
|
||||||
if (hasAnyConsumedArgs())
|
|
||||||
return getConsumedArgsBuffer()[I];
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3100,7 +3100,7 @@ public:
|
||||||
|
|
||||||
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx);
|
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx);
|
||||||
static void Profile(llvm::FoldingSetNodeID &ID, QualType Result,
|
static void Profile(llvm::FoldingSetNodeID &ID, QualType Result,
|
||||||
arg_type_iterator ArgTys, unsigned NumArgs,
|
param_type_iterator ArgTys, unsigned NumArgs,
|
||||||
const ExtProtoInfo &EPI, const ASTContext &Context);
|
const ExtProtoInfo &EPI, const ASTContext &Context);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1219,7 +1219,7 @@ public:
|
||||||
unsigned getNumArgs() const {
|
unsigned getNumArgs() const {
|
||||||
if (isa<FunctionNoProtoType>(getTypePtr()))
|
if (isa<FunctionNoProtoType>(getTypePtr()))
|
||||||
return 0;
|
return 0;
|
||||||
return cast<FunctionProtoType>(getTypePtr())->getNumArgs();
|
return cast<FunctionProtoType>(getTypePtr())->getNumParams();
|
||||||
}
|
}
|
||||||
ParmVarDecl *getArg(unsigned i) const { return getParmArray()[i]; }
|
ParmVarDecl *getArg(unsigned i) const { return getParmArray()[i]; }
|
||||||
void setArg(unsigned i, ParmVarDecl *VD) { getParmArray()[i] = VD; }
|
void setArg(unsigned i, ParmVarDecl *VD) { getParmArray()[i] = VD; }
|
||||||
|
|
|
@ -194,7 +194,7 @@ public:
|
||||||
static RequiredArgs forPrototypePlus(const FunctionProtoType *prototype,
|
static RequiredArgs forPrototypePlus(const FunctionProtoType *prototype,
|
||||||
unsigned additional) {
|
unsigned additional) {
|
||||||
if (!prototype->isVariadic()) return All;
|
if (!prototype->isVariadic()) return All;
|
||||||
return RequiredArgs(prototype->getNumArgs() + additional);
|
return RequiredArgs(prototype->getNumParams() + additional);
|
||||||
}
|
}
|
||||||
|
|
||||||
static RequiredArgs forPrototype(const FunctionProtoType *prototype) {
|
static RequiredArgs forPrototype(const FunctionProtoType *prototype) {
|
||||||
|
|
|
@ -1954,7 +1954,7 @@ public:
|
||||||
QualType &ConvertedType);
|
QualType &ConvertedType);
|
||||||
bool IsBlockPointerConversion(QualType FromType, QualType ToType,
|
bool IsBlockPointerConversion(QualType FromType, QualType ToType,
|
||||||
QualType& ConvertedType);
|
QualType& ConvertedType);
|
||||||
bool FunctionArgTypesAreEqual(const FunctionProtoType *OldType,
|
bool FunctionParamTypesAreEqual(const FunctionProtoType *OldType,
|
||||||
const FunctionProtoType *NewType,
|
const FunctionProtoType *NewType,
|
||||||
unsigned *ArgPos = 0);
|
unsigned *ArgPos = 0);
|
||||||
void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag,
|
void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag,
|
||||||
|
@ -7825,10 +7825,8 @@ private:
|
||||||
SourceLocation Loc);
|
SourceLocation Loc);
|
||||||
|
|
||||||
void checkCall(NamedDecl *FDecl, ArrayRef<const Expr *> Args,
|
void checkCall(NamedDecl *FDecl, ArrayRef<const Expr *> Args,
|
||||||
unsigned NumProtoArgs, bool IsMemberFunction,
|
unsigned NumParams, bool IsMemberFunction, SourceLocation Loc,
|
||||||
SourceLocation Loc, SourceRange Range,
|
SourceRange Range, VariadicCallType CallType);
|
||||||
VariadicCallType CallType);
|
|
||||||
|
|
||||||
|
|
||||||
bool CheckObjCString(Expr *Arg);
|
bool CheckObjCString(Expr *Arg);
|
||||||
|
|
||||||
|
|
|
@ -2088,7 +2088,7 @@ const FunctionType *ASTContext::adjustFunctionType(const FunctionType *T,
|
||||||
const FunctionProtoType *FPT = cast<FunctionProtoType>(T);
|
const FunctionProtoType *FPT = cast<FunctionProtoType>(T);
|
||||||
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
|
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
|
||||||
EPI.ExtInfo = Info;
|
EPI.ExtInfo = Info;
|
||||||
Result = getFunctionType(FPT->getResultType(), FPT->getArgTypes(), EPI);
|
Result = getFunctionType(FPT->getResultType(), FPT->getParamTypes(), EPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cast<FunctionType>(Result.getTypePtr());
|
return cast<FunctionType>(Result.getTypePtr());
|
||||||
|
@ -2100,7 +2100,7 @@ void ASTContext::adjustDeducedFunctionResultType(FunctionDecl *FD,
|
||||||
while (true) {
|
while (true) {
|
||||||
const FunctionProtoType *FPT = FD->getType()->castAs<FunctionProtoType>();
|
const FunctionProtoType *FPT = FD->getType()->castAs<FunctionProtoType>();
|
||||||
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
|
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
|
||||||
FD->setType(getFunctionType(ResultType, FPT->getArgTypes(), EPI));
|
FD->setType(getFunctionType(ResultType, FPT->getParamTypes(), EPI));
|
||||||
if (FunctionDecl *Next = FD->getPreviousDecl())
|
if (FunctionDecl *Next = FD->getPreviousDecl())
|
||||||
FD = Next;
|
FD = Next;
|
||||||
else
|
else
|
||||||
|
@ -5423,8 +5423,9 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
|
||||||
S += "@?";
|
S += "@?";
|
||||||
// Block parameters
|
// Block parameters
|
||||||
if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(FT)) {
|
if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(FT)) {
|
||||||
for (FunctionProtoType::arg_type_iterator I = FPT->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator I = FPT->param_type_begin(),
|
||||||
E = FPT->arg_type_end(); I && (I != E); ++I) {
|
E = FPT->param_type_end();
|
||||||
|
I && (I != E); ++I) {
|
||||||
getObjCEncodingForTypeImpl(*I, S,
|
getObjCEncodingForTypeImpl(*I, S,
|
||||||
ExpandPointedToStructures,
|
ExpandPointedToStructures,
|
||||||
ExpandStructures,
|
ExpandStructures,
|
||||||
|
@ -6855,9 +6856,9 @@ QualType ASTContext::mergeTransparentUnionType(QualType T, QualType SubType,
|
||||||
return QualType();
|
return QualType();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// mergeFunctionArgumentTypes - merge two types which appear as function
|
/// mergeFunctionParameterTypes - merge two types which appear as function
|
||||||
/// argument types
|
/// parameter types
|
||||||
QualType ASTContext::mergeFunctionArgumentTypes(QualType lhs, QualType rhs,
|
QualType ASTContext::mergeFunctionParameterTypes(QualType lhs, QualType rhs,
|
||||||
bool OfBlockPointer,
|
bool OfBlockPointer,
|
||||||
bool Unqualified) {
|
bool Unqualified) {
|
||||||
// GNU extension: two types are compatible if they appear as a function
|
// GNU extension: two types are compatible if they appear as a function
|
||||||
|
@ -6949,8 +6950,8 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs,
|
||||||
if (lproto && rproto) { // two C99 style function prototypes
|
if (lproto && rproto) { // two C99 style function prototypes
|
||||||
assert(!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec() &&
|
assert(!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec() &&
|
||||||
"C++ shouldn't be here");
|
"C++ shouldn't be here");
|
||||||
unsigned lproto_nargs = lproto->getNumArgs();
|
unsigned lproto_nargs = lproto->getNumParams();
|
||||||
unsigned rproto_nargs = rproto->getNumArgs();
|
unsigned rproto_nargs = rproto->getNumParams();
|
||||||
|
|
||||||
// Compatible functions must have the same number of arguments
|
// Compatible functions must have the same number of arguments
|
||||||
if (lproto_nargs != rproto_nargs)
|
if (lproto_nargs != rproto_nargs)
|
||||||
|
@ -6970,11 +6971,10 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs,
|
||||||
// Check argument compatibility
|
// Check argument compatibility
|
||||||
SmallVector<QualType, 10> types;
|
SmallVector<QualType, 10> types;
|
||||||
for (unsigned i = 0; i < lproto_nargs; i++) {
|
for (unsigned i = 0; i < lproto_nargs; i++) {
|
||||||
QualType largtype = lproto->getArgType(i).getUnqualifiedType();
|
QualType largtype = lproto->getParamType(i).getUnqualifiedType();
|
||||||
QualType rargtype = rproto->getArgType(i).getUnqualifiedType();
|
QualType rargtype = rproto->getParamType(i).getUnqualifiedType();
|
||||||
QualType argtype = mergeFunctionArgumentTypes(largtype, rargtype,
|
QualType argtype = mergeFunctionParameterTypes(
|
||||||
OfBlockPointer,
|
largtype, rargtype, OfBlockPointer, Unqualified);
|
||||||
Unqualified);
|
|
||||||
if (argtype.isNull()) return QualType();
|
if (argtype.isNull()) return QualType();
|
||||||
|
|
||||||
if (Unqualified)
|
if (Unqualified)
|
||||||
|
@ -7012,9 +7012,9 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs,
|
||||||
// The only types actually affected are promotable integer
|
// The only types actually affected are promotable integer
|
||||||
// types and floats, which would be passed as a different
|
// types and floats, which would be passed as a different
|
||||||
// type depending on whether the prototype is visible.
|
// type depending on whether the prototype is visible.
|
||||||
unsigned proto_nargs = proto->getNumArgs();
|
unsigned proto_nargs = proto->getNumParams();
|
||||||
for (unsigned i = 0; i < proto_nargs; ++i) {
|
for (unsigned i = 0; i < proto_nargs; ++i) {
|
||||||
QualType argTy = proto->getArgType(i);
|
QualType argTy = proto->getParamType(i);
|
||||||
|
|
||||||
// Look at the converted type of enum types, since that is the type used
|
// Look at the converted type of enum types, since that is the type used
|
||||||
// to pass enum values.
|
// to pass enum values.
|
||||||
|
@ -7034,7 +7034,7 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs,
|
||||||
|
|
||||||
FunctionProtoType::ExtProtoInfo EPI = proto->getExtProtoInfo();
|
FunctionProtoType::ExtProtoInfo EPI = proto->getExtProtoInfo();
|
||||||
EPI.ExtInfo = einfo;
|
EPI.ExtInfo = einfo;
|
||||||
return getFunctionType(retType, proto->getArgTypes(), EPI);
|
return getFunctionType(retType, proto->getParamTypes(), EPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allLTypes) return lhs;
|
if (allLTypes) return lhs;
|
||||||
|
@ -7338,15 +7338,15 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS,
|
||||||
bool ASTContext::FunctionTypesMatchOnNSConsumedAttrs(
|
bool ASTContext::FunctionTypesMatchOnNSConsumedAttrs(
|
||||||
const FunctionProtoType *FromFunctionType,
|
const FunctionProtoType *FromFunctionType,
|
||||||
const FunctionProtoType *ToFunctionType) {
|
const FunctionProtoType *ToFunctionType) {
|
||||||
if (FromFunctionType->hasAnyConsumedArgs() !=
|
if (FromFunctionType->hasAnyConsumedParams() !=
|
||||||
ToFunctionType->hasAnyConsumedArgs())
|
ToFunctionType->hasAnyConsumedParams())
|
||||||
return false;
|
return false;
|
||||||
FunctionProtoType::ExtProtoInfo FromEPI =
|
FunctionProtoType::ExtProtoInfo FromEPI =
|
||||||
FromFunctionType->getExtProtoInfo();
|
FromFunctionType->getExtProtoInfo();
|
||||||
FunctionProtoType::ExtProtoInfo ToEPI =
|
FunctionProtoType::ExtProtoInfo ToEPI =
|
||||||
ToFunctionType->getExtProtoInfo();
|
ToFunctionType->getExtProtoInfo();
|
||||||
if (FromEPI.ConsumedArguments && ToEPI.ConsumedArguments)
|
if (FromEPI.ConsumedArguments && ToEPI.ConsumedArguments)
|
||||||
for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumArgs();
|
for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumParams();
|
||||||
ArgIdx != NumArgs; ++ArgIdx) {
|
ArgIdx != NumArgs; ++ArgIdx) {
|
||||||
if (FromEPI.ConsumedArguments[ArgIdx] !=
|
if (FromEPI.ConsumedArguments[ArgIdx] !=
|
||||||
ToEPI.ConsumedArguments[ArgIdx])
|
ToEPI.ConsumedArguments[ArgIdx])
|
||||||
|
@ -7383,7 +7383,7 @@ QualType ASTContext::mergeObjCGCQualifiers(QualType LHS, QualType RHS) {
|
||||||
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
|
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
|
||||||
EPI.ExtInfo = getFunctionExtInfo(LHS);
|
EPI.ExtInfo = getFunctionExtInfo(LHS);
|
||||||
QualType ResultType =
|
QualType ResultType =
|
||||||
getFunctionType(OldReturnType, FPT->getArgTypes(), EPI);
|
getFunctionType(OldReturnType, FPT->getParamTypes(), EPI);
|
||||||
return ResultType;
|
return ResultType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -535,12 +535,11 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
|
||||||
case Type::FunctionProto: {
|
case Type::FunctionProto: {
|
||||||
const FunctionProtoType *Proto1 = cast<FunctionProtoType>(T1);
|
const FunctionProtoType *Proto1 = cast<FunctionProtoType>(T1);
|
||||||
const FunctionProtoType *Proto2 = cast<FunctionProtoType>(T2);
|
const FunctionProtoType *Proto2 = cast<FunctionProtoType>(T2);
|
||||||
if (Proto1->getNumArgs() != Proto2->getNumArgs())
|
if (Proto1->getNumParams() != Proto2->getNumParams())
|
||||||
return false;
|
return false;
|
||||||
for (unsigned I = 0, N = Proto1->getNumArgs(); I != N; ++I) {
|
for (unsigned I = 0, N = Proto1->getNumParams(); I != N; ++I) {
|
||||||
if (!IsStructurallyEquivalent(Context,
|
if (!IsStructurallyEquivalent(Context, Proto1->getParamType(I),
|
||||||
Proto1->getArgType(I),
|
Proto2->getParamType(I)))
|
||||||
Proto2->getArgType(I)))
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Proto1->isVariadic() != Proto2->isVariadic())
|
if (Proto1->isVariadic() != Proto2->isVariadic())
|
||||||
|
@ -1602,8 +1601,8 @@ QualType ASTNodeImporter::VisitFunctionProtoType(const FunctionProtoType *T) {
|
||||||
|
|
||||||
// Import argument types
|
// Import argument types
|
||||||
SmallVector<QualType, 4> ArgTypes;
|
SmallVector<QualType, 4> ArgTypes;
|
||||||
for (FunctionProtoType::arg_type_iterator A = T->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator A = T->param_type_begin(),
|
||||||
AEnd = T->arg_type_end();
|
AEnd = T->param_type_end();
|
||||||
A != AEnd; ++A) {
|
A != AEnd; ++A) {
|
||||||
QualType ArgType = Importer.Import(*A);
|
QualType ArgType = Importer.Import(*A);
|
||||||
if (ArgType.isNull())
|
if (ArgType.isNull())
|
||||||
|
@ -2718,7 +2717,7 @@ Decl *ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) {
|
||||||
FromEPI.NoexceptExpr) {
|
FromEPI.NoexceptExpr) {
|
||||||
FunctionProtoType::ExtProtoInfo DefaultEPI;
|
FunctionProtoType::ExtProtoInfo DefaultEPI;
|
||||||
FromTy = Importer.getFromContext().getFunctionType(
|
FromTy = Importer.getFromContext().getFunctionType(
|
||||||
FromFPT->getResultType(), FromFPT->getArgTypes(), DefaultEPI);
|
FromFPT->getResultType(), FromFPT->getParamTypes(), DefaultEPI);
|
||||||
usedDifferentExceptionSpec = true;
|
usedDifferentExceptionSpec = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2308,7 +2308,8 @@ bool FunctionDecl::isReservedGlobalPlacementOperator() const {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const FunctionProtoType *proto = getType()->castAs<FunctionProtoType>();
|
const FunctionProtoType *proto = getType()->castAs<FunctionProtoType>();
|
||||||
if (proto->getNumArgs() != 2 || proto->isVariadic()) return false;
|
if (proto->getNumParams() != 2 || proto->isVariadic())
|
||||||
|
return false;
|
||||||
|
|
||||||
ASTContext &Context =
|
ASTContext &Context =
|
||||||
cast<TranslationUnitDecl>(getDeclContext()->getRedeclContext())
|
cast<TranslationUnitDecl>(getDeclContext()->getRedeclContext())
|
||||||
|
@ -2316,7 +2317,7 @@ bool FunctionDecl::isReservedGlobalPlacementOperator() const {
|
||||||
|
|
||||||
// The result type and first argument type are constant across all
|
// The result type and first argument type are constant across all
|
||||||
// these operators. The second argument must be exactly void*.
|
// these operators. The second argument must be exactly void*.
|
||||||
return (proto->getArgType(1).getCanonicalType() == Context.VoidPtrTy);
|
return (proto->getParamType(1).getCanonicalType() == Context.VoidPtrTy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isNamespaceStd(const DeclContext *DC) {
|
static bool isNamespaceStd(const DeclContext *DC) {
|
||||||
|
@ -2342,17 +2343,17 @@ bool FunctionDecl::isReplaceableGlobalAllocationFunction() const {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const FunctionProtoType *FPT = getType()->castAs<FunctionProtoType>();
|
const FunctionProtoType *FPT = getType()->castAs<FunctionProtoType>();
|
||||||
if (FPT->getNumArgs() > 2 || FPT->isVariadic())
|
if (FPT->getNumParams() > 2 || FPT->isVariadic())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// If this is a single-parameter function, it must be a replaceable global
|
// If this is a single-parameter function, it must be a replaceable global
|
||||||
// allocation or deallocation function.
|
// allocation or deallocation function.
|
||||||
if (FPT->getNumArgs() == 1)
|
if (FPT->getNumParams() == 1)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Otherwise, we're looking for a second parameter whose type is
|
// Otherwise, we're looking for a second parameter whose type is
|
||||||
// 'const std::nothrow_t &', or, in C++1y, 'std::size_t'.
|
// 'const std::nothrow_t &', or, in C++1y, 'std::size_t'.
|
||||||
QualType Ty = FPT->getArgType(1);
|
QualType Ty = FPT->getParamType(1);
|
||||||
ASTContext &Ctx = getASTContext();
|
ASTContext &Ctx = getASTContext();
|
||||||
if (Ctx.getLangOpts().SizedDeallocation &&
|
if (Ctx.getLangOpts().SizedDeallocation &&
|
||||||
Ctx.hasSameType(Ty, Ctx.getSizeType()))
|
Ctx.hasSameType(Ty, Ctx.getSizeType()))
|
||||||
|
@ -2385,7 +2386,7 @@ FunctionDecl::getCorrespondingUnsizedGlobalDeallocationFunction() const {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (getNumParams() != 2 || isVariadic() ||
|
if (getNumParams() != 2 || isVariadic() ||
|
||||||
!Ctx.hasSameType(getType()->castAs<FunctionProtoType>()->getArgType(1),
|
!Ctx.hasSameType(getType()->castAs<FunctionProtoType>()->getParamType(1),
|
||||||
Ctx.getSizeType()))
|
Ctx.getSizeType()))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -2517,7 +2518,7 @@ unsigned FunctionDecl::getBuiltinID() const {
|
||||||
/// after it has been created.
|
/// after it has been created.
|
||||||
unsigned FunctionDecl::getNumParams() const {
|
unsigned FunctionDecl::getNumParams() const {
|
||||||
const FunctionProtoType *FPT = getType()->getAs<FunctionProtoType>();
|
const FunctionProtoType *FPT = getType()->getAs<FunctionProtoType>();
|
||||||
return FPT ? FPT->getNumArgs() : 0;
|
return FPT ? FPT->getNumParams() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionDecl::setParams(ASTContext &C,
|
void FunctionDecl::setParams(ASTContext &C,
|
||||||
|
|
|
@ -868,7 +868,7 @@ ObjCMethodFamily ObjCMethodDecl::getMethodFamily() const {
|
||||||
if (noParams < 1 || noParams > 3)
|
if (noParams < 1 || noParams > 3)
|
||||||
family = OMF_None;
|
family = OMF_None;
|
||||||
else {
|
else {
|
||||||
ObjCMethodDecl::arg_type_iterator it = arg_type_begin();
|
ObjCMethodDecl::param_type_iterator it = arg_type_begin();
|
||||||
QualType ArgT = (*it);
|
QualType ArgT = (*it);
|
||||||
if (!ArgT->isObjCSelType()) {
|
if (!ArgT->isObjCSelType()) {
|
||||||
family = OMF_None;
|
family = OMF_None;
|
||||||
|
|
|
@ -2017,7 +2017,7 @@ void CXXNameMangler::mangleBareFunctionType(const FunctionType *T,
|
||||||
FunctionTypeDepth.leaveResultType();
|
FunctionTypeDepth.leaveResultType();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Proto->getNumArgs() == 0 && !Proto->isVariadic()) {
|
if (Proto->getNumParams() == 0 && !Proto->isVariadic()) {
|
||||||
// <builtin-type> ::= v # void
|
// <builtin-type> ::= v # void
|
||||||
Out << 'v';
|
Out << 'v';
|
||||||
|
|
||||||
|
@ -2025,8 +2025,8 @@ void CXXNameMangler::mangleBareFunctionType(const FunctionType *T,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (FunctionProtoType::arg_type_iterator Arg = Proto->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator Arg = Proto->param_type_begin(),
|
||||||
ArgEnd = Proto->arg_type_end();
|
ArgEnd = Proto->param_type_end();
|
||||||
Arg != ArgEnd; ++Arg)
|
Arg != ArgEnd; ++Arg)
|
||||||
mangleType(Context.getASTContext().getSignatureParameterType(*Arg));
|
mangleType(Context.getASTContext().getSignatureParameterType(*Arg));
|
||||||
|
|
||||||
|
|
|
@ -163,8 +163,8 @@ void MangleContext::mangleName(const NamedDecl *D, raw_ostream &Out) {
|
||||||
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD))
|
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD))
|
||||||
if (!MD->isStatic())
|
if (!MD->isStatic())
|
||||||
++ArgWords;
|
++ArgWords;
|
||||||
for (FunctionProtoType::arg_type_iterator Arg = Proto->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator Arg = Proto->param_type_begin(),
|
||||||
ArgEnd = Proto->arg_type_end();
|
ArgEnd = Proto->param_type_end();
|
||||||
Arg != ArgEnd; ++Arg) {
|
Arg != ArgEnd; ++Arg) {
|
||||||
QualType AT = *Arg;
|
QualType AT = *Arg;
|
||||||
// Size should be aligned to DWORD boundary
|
// Size should be aligned to DWORD boundary
|
||||||
|
|
|
@ -24,7 +24,7 @@ MangleNumberingContext::getManglingNumber(const CXXMethodDecl *CallOperator) {
|
||||||
= CallOperator->getType()->getAs<FunctionProtoType>();
|
= CallOperator->getType()->getAs<FunctionProtoType>();
|
||||||
ASTContext &Context = CallOperator->getASTContext();
|
ASTContext &Context = CallOperator->getASTContext();
|
||||||
|
|
||||||
QualType Key = Context.getFunctionType(Context.VoidTy, Proto->getArgTypes(),
|
QualType Key = Context.getFunctionType(Context.VoidTy, Proto->getParamTypes(),
|
||||||
FunctionProtoType::ExtProtoInfo());
|
FunctionProtoType::ExtProtoInfo());
|
||||||
Key = Context.getCanonicalType(Key);
|
Key = Context.getCanonicalType(Key);
|
||||||
return ++ManglingNumbers[Key->castAs<FunctionProtoType>()];
|
return ++ManglingNumbers[Key->castAs<FunctionProtoType>()];
|
||||||
|
|
|
@ -1336,12 +1336,13 @@ void MicrosoftCXXNameMangler::mangleFunctionType(const FunctionType *T,
|
||||||
// <argument-list> ::= X # void
|
// <argument-list> ::= X # void
|
||||||
// ::= <type>+ @
|
// ::= <type>+ @
|
||||||
// ::= <type>* Z # varargs
|
// ::= <type>* Z # varargs
|
||||||
if (Proto->getNumArgs() == 0 && !Proto->isVariadic()) {
|
if (Proto->getNumParams() == 0 && !Proto->isVariadic()) {
|
||||||
Out << 'X';
|
Out << 'X';
|
||||||
} else {
|
} else {
|
||||||
// Happens for function pointer type arguments for example.
|
// Happens for function pointer type arguments for example.
|
||||||
for (FunctionProtoType::arg_type_iterator Arg = Proto->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator
|
||||||
ArgEnd = Proto->arg_type_end();
|
Arg = Proto->param_type_begin(),
|
||||||
|
ArgEnd = Proto->param_type_end();
|
||||||
Arg != ArgEnd; ++Arg)
|
Arg != ArgEnd; ++Arg)
|
||||||
mangleArgumentType(*Arg, Range);
|
mangleArgumentType(*Arg, Range);
|
||||||
// <builtin-type> ::= Z # ellipsis
|
// <builtin-type> ::= Z # ellipsis
|
||||||
|
|
|
@ -1659,7 +1659,7 @@ FunctionProtoType::FunctionProtoType(QualType result, ArrayRef<QualType> args,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (epi.ConsumedArguments) {
|
if (epi.ConsumedArguments) {
|
||||||
bool *consumedArgs = const_cast<bool*>(getConsumedArgsBuffer());
|
bool *consumedArgs = const_cast<bool *>(getConsumedParamsBuffer());
|
||||||
for (unsigned i = 0; i != NumArgs; ++i)
|
for (unsigned i = 0; i != NumArgs; ++i)
|
||||||
consumedArgs[i] = epi.ConsumedArguments[i];
|
consumedArgs[i] = epi.ConsumedArguments[i];
|
||||||
}
|
}
|
||||||
|
@ -1715,8 +1715,8 @@ bool FunctionProtoType::isNothrow(const ASTContext &Ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FunctionProtoType::isTemplateVariadic() const {
|
bool FunctionProtoType::isTemplateVariadic() const {
|
||||||
for (unsigned ArgIdx = getNumArgs(); ArgIdx; --ArgIdx)
|
for (unsigned ArgIdx = getNumParams(); ArgIdx; --ArgIdx)
|
||||||
if (isa<PackExpansionType>(getArgType(ArgIdx - 1)))
|
if (isa<PackExpansionType>(getParamType(ArgIdx - 1)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -1778,7 +1778,7 @@ void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID, QualType Result,
|
||||||
|
|
||||||
void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID,
|
void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID,
|
||||||
const ASTContext &Ctx) {
|
const ASTContext &Ctx) {
|
||||||
Profile(ID, getResultType(), arg_type_begin(), NumArgs, getExtProtoInfo(),
|
Profile(ID, getResultType(), param_type_begin(), NumArgs, getExtProtoInfo(),
|
||||||
Ctx);
|
Ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2232,8 +2232,9 @@ static CachedProperties computeCachedProperties(const Type *T) {
|
||||||
case Type::FunctionProto: {
|
case Type::FunctionProto: {
|
||||||
const FunctionProtoType *FPT = cast<FunctionProtoType>(T);
|
const FunctionProtoType *FPT = cast<FunctionProtoType>(T);
|
||||||
CachedProperties result = Cache::get(FPT->getResultType());
|
CachedProperties result = Cache::get(FPT->getResultType());
|
||||||
for (FunctionProtoType::arg_type_iterator ai = FPT->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator ai = FPT->param_type_begin(),
|
||||||
ae = FPT->arg_type_end(); ai != ae; ++ai)
|
ae = FPT->param_type_end();
|
||||||
|
ai != ae; ++ai)
|
||||||
result = merge(result, Cache::get(*ai));
|
result = merge(result, Cache::get(*ai));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2317,8 +2318,9 @@ static LinkageInfo computeLinkageInfo(const Type *T) {
|
||||||
case Type::FunctionProto: {
|
case Type::FunctionProto: {
|
||||||
const FunctionProtoType *FPT = cast<FunctionProtoType>(T);
|
const FunctionProtoType *FPT = cast<FunctionProtoType>(T);
|
||||||
LinkageInfo LV = computeLinkageInfo(FPT->getResultType());
|
LinkageInfo LV = computeLinkageInfo(FPT->getResultType());
|
||||||
for (FunctionProtoType::arg_type_iterator ai = FPT->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator ai = FPT->param_type_begin(),
|
||||||
ae = FPT->arg_type_end(); ai != ae; ++ai)
|
ae = FPT->param_type_end();
|
||||||
|
ai != ae; ++ai)
|
||||||
LV.merge(computeLinkageInfo(*ai));
|
LV.merge(computeLinkageInfo(*ai));
|
||||||
return LV;
|
return LV;
|
||||||
}
|
}
|
||||||
|
|
|
@ -624,17 +624,17 @@ void TypePrinter::printFunctionProtoAfter(const FunctionProtoType *T,
|
||||||
OS << '(';
|
OS << '(';
|
||||||
{
|
{
|
||||||
ParamPolicyRAII ParamPolicy(Policy);
|
ParamPolicyRAII ParamPolicy(Policy);
|
||||||
for (unsigned i = 0, e = T->getNumArgs(); i != e; ++i) {
|
for (unsigned i = 0, e = T->getNumParams(); i != e; ++i) {
|
||||||
if (i) OS << ", ";
|
if (i) OS << ", ";
|
||||||
print(T->getArgType(i), OS, StringRef());
|
print(T->getParamType(i), OS, StringRef());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (T->isVariadic()) {
|
if (T->isVariadic()) {
|
||||||
if (T->getNumArgs())
|
if (T->getNumParams())
|
||||||
OS << ", ";
|
OS << ", ";
|
||||||
OS << "...";
|
OS << "...";
|
||||||
} else if (T->getNumArgs() == 0 && !Policy.LangOpts.CPlusPlus) {
|
} else if (T->getNumParams() == 0 && !Policy.LangOpts.CPlusPlus) {
|
||||||
// Do not emit int() if we have a proto, emit 'int(void)'.
|
// Do not emit int() if we have a proto, emit 'int(void)'.
|
||||||
OS << "void";
|
OS << "void";
|
||||||
}
|
}
|
||||||
|
|
|
@ -479,10 +479,10 @@ static bool HasSameVirtualSignature(const CXXMethodDecl *LHS,
|
||||||
// list here because there isn't necessarily an inheritance
|
// list here because there isn't necessarily an inheritance
|
||||||
// relationship between the two methods.
|
// relationship between the two methods.
|
||||||
if (LT->getTypeQuals() != RT->getTypeQuals() ||
|
if (LT->getTypeQuals() != RT->getTypeQuals() ||
|
||||||
LT->getNumArgs() != RT->getNumArgs())
|
LT->getNumParams() != RT->getNumParams())
|
||||||
return false;
|
return false;
|
||||||
for (unsigned I = 0, E = LT->getNumArgs(); I != E; ++I)
|
for (unsigned I = 0, E = LT->getNumParams(); I != E; ++I)
|
||||||
if (LT->getArgType(I) != RT->getArgType(I))
|
if (LT->getParamType(I) != RT->getParamType(I))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,7 @@ static bool isDispatchBlock(QualType Ty) {
|
||||||
// returns void.
|
// returns void.
|
||||||
const FunctionProtoType *FT =
|
const FunctionProtoType *FT =
|
||||||
BPT->getPointeeType()->getAs<FunctionProtoType>();
|
BPT->getPointeeType()->getAs<FunctionProtoType>();
|
||||||
if (!FT || !FT->getResultType()->isVoidType() ||
|
if (!FT || !FT->getResultType()->isVoidType() || FT->getNumParams() != 0)
|
||||||
FT->getNumArgs() != 0)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -92,8 +92,8 @@ static const CGFunctionInfo &arrangeLLVMFunctionInfo(CodeGenTypes &CGT,
|
||||||
FunctionType::ExtInfo extInfo) {
|
FunctionType::ExtInfo extInfo) {
|
||||||
RequiredArgs required = RequiredArgs::forPrototypePlus(FTP, prefix.size());
|
RequiredArgs required = RequiredArgs::forPrototypePlus(FTP, prefix.size());
|
||||||
// FIXME: Kill copy.
|
// FIXME: Kill copy.
|
||||||
for (unsigned i = 0, e = FTP->getNumArgs(); i != e; ++i)
|
for (unsigned i = 0, e = FTP->getNumParams(); i != e; ++i)
|
||||||
prefix.push_back(FTP->getArgType(i));
|
prefix.push_back(FTP->getParamType(i));
|
||||||
CanQualType resultType = FTP->getResultType().getUnqualifiedType();
|
CanQualType resultType = FTP->getResultType().getUnqualifiedType();
|
||||||
return CGT.arrangeLLVMFunctionInfo(resultType, prefix, extInfo, required);
|
return CGT.arrangeLLVMFunctionInfo(resultType, prefix, extInfo, required);
|
||||||
}
|
}
|
||||||
|
@ -211,8 +211,8 @@ CodeGenTypes::arrangeCXXConstructorDeclaration(const CXXConstructorDecl *D,
|
||||||
CanQual<FunctionProtoType> FTP = GetFormalType(D);
|
CanQual<FunctionProtoType> FTP = GetFormalType(D);
|
||||||
|
|
||||||
// Add the formal parameters.
|
// Add the formal parameters.
|
||||||
for (unsigned i = 0, e = FTP->getNumArgs(); i != e; ++i)
|
for (unsigned i = 0, e = FTP->getNumParams(); i != e; ++i)
|
||||||
argTypes.push_back(FTP->getArgType(i));
|
argTypes.push_back(FTP->getParamType(i));
|
||||||
|
|
||||||
TheCXXABI.BuildConstructorSignature(D, ctorKind, resultType, argTypes);
|
TheCXXABI.BuildConstructorSignature(D, ctorKind, resultType, argTypes);
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ CodeGenTypes::arrangeCXXDestructor(const CXXDestructorDecl *D,
|
||||||
TheCXXABI.BuildDestructorSignature(D, dtorKind, resultType, argTypes);
|
TheCXXABI.BuildDestructorSignature(D, dtorKind, resultType, argTypes);
|
||||||
|
|
||||||
CanQual<FunctionProtoType> FTP = GetFormalType(D);
|
CanQual<FunctionProtoType> FTP = GetFormalType(D);
|
||||||
assert(FTP->getNumArgs() == 0 && "dtor with formal parameters");
|
assert(FTP->getNumParams() == 0 && "dtor with formal parameters");
|
||||||
assert(FTP->isVariadic() == 0 && "dtor with formal parameters");
|
assert(FTP->isVariadic() == 0 && "dtor with formal parameters");
|
||||||
|
|
||||||
FunctionType::ExtInfo extInfo = FTP->getExtInfo();
|
FunctionType::ExtInfo extInfo = FTP->getExtInfo();
|
||||||
|
@ -344,7 +344,7 @@ arrangeFreeFunctionLikeCall(CodeGenTypes &CGT,
|
||||||
// extra prefix plus the arguments in the prototype.
|
// extra prefix plus the arguments in the prototype.
|
||||||
if (const FunctionProtoType *proto = dyn_cast<FunctionProtoType>(fnType)) {
|
if (const FunctionProtoType *proto = dyn_cast<FunctionProtoType>(fnType)) {
|
||||||
if (proto->isVariadic())
|
if (proto->isVariadic())
|
||||||
required = RequiredArgs(proto->getNumArgs() + numExtraRequiredArgs);
|
required = RequiredArgs(proto->getNumParams() + numExtraRequiredArgs);
|
||||||
|
|
||||||
// If we don't have a prototype at all, but we're supposed to
|
// If we don't have a prototype at all, but we're supposed to
|
||||||
// explicitly use the variadic convention for unprototyped calls,
|
// explicitly use the variadic convention for unprototyped calls,
|
||||||
|
|
|
@ -1738,14 +1738,14 @@ CodeGenFunction::EmitSynthesizedCXXCopyCtorCall(const CXXConstructorDecl *D,
|
||||||
Args.add(RValue::get(This), D->getThisType(getContext()));
|
Args.add(RValue::get(This), D->getThisType(getContext()));
|
||||||
|
|
||||||
// Push the src ptr.
|
// Push the src ptr.
|
||||||
QualType QT = *(FPT->arg_type_begin());
|
QualType QT = *(FPT->param_type_begin());
|
||||||
llvm::Type *t = CGM.getTypes().ConvertType(QT);
|
llvm::Type *t = CGM.getTypes().ConvertType(QT);
|
||||||
Src = Builder.CreateBitCast(Src, t);
|
Src = Builder.CreateBitCast(Src, t);
|
||||||
Args.add(RValue::get(Src), QT);
|
Args.add(RValue::get(Src), QT);
|
||||||
|
|
||||||
// Skip over first argument (Src).
|
// Skip over first argument (Src).
|
||||||
EmitCallArgs(Args, FPT->isVariadic(), FPT->arg_type_begin() + 1,
|
EmitCallArgs(Args, FPT->isVariadic(), FPT->param_type_begin() + 1,
|
||||||
FPT->arg_type_end(), ArgBeg + 1, ArgEnd);
|
FPT->param_type_end(), ArgBeg + 1, ArgEnd);
|
||||||
|
|
||||||
EmitCall(CGM.getTypes().arrangeCXXMethodCall(Args, FPT, RequiredArgs::All),
|
EmitCall(CGM.getTypes().arrangeCXXMethodCall(Args, FPT, RequiredArgs::All),
|
||||||
Callee, ReturnValueSlot(), Args, D);
|
Callee, ReturnValueSlot(), Args, D);
|
||||||
|
|
|
@ -761,8 +761,8 @@ llvm::DIType CGDebugInfo::CreateType(const FunctionType *Ty,
|
||||||
if (isa<FunctionNoProtoType>(Ty))
|
if (isa<FunctionNoProtoType>(Ty))
|
||||||
EltTys.push_back(DBuilder.createUnspecifiedParameter());
|
EltTys.push_back(DBuilder.createUnspecifiedParameter());
|
||||||
else if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(Ty)) {
|
else if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(Ty)) {
|
||||||
for (unsigned i = 0, e = FPT->getNumArgs(); i != e; ++i)
|
for (unsigned i = 0, e = FPT->getNumParams(); i != e; ++i)
|
||||||
EltTys.push_back(getOrCreateType(FPT->getArgType(i), Unit));
|
EltTys.push_back(getOrCreateType(FPT->getParamType(i), Unit));
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::DIArray EltTypeArray = DBuilder.getOrCreateArray(EltTys);
|
llvm::DIArray EltTypeArray = DBuilder.getOrCreateArray(EltTys);
|
||||||
|
|
|
@ -1014,17 +1014,17 @@ namespace {
|
||||||
void Emit(CodeGenFunction &CGF, Flags flags) {
|
void Emit(CodeGenFunction &CGF, Flags flags) {
|
||||||
const FunctionProtoType *FPT
|
const FunctionProtoType *FPT
|
||||||
= OperatorDelete->getType()->getAs<FunctionProtoType>();
|
= OperatorDelete->getType()->getAs<FunctionProtoType>();
|
||||||
assert(FPT->getNumArgs() == NumPlacementArgs + 1 ||
|
assert(FPT->getNumParams() == NumPlacementArgs + 1 ||
|
||||||
(FPT->getNumArgs() == 2 && NumPlacementArgs == 0));
|
(FPT->getNumParams() == 2 && NumPlacementArgs == 0));
|
||||||
|
|
||||||
CallArgList DeleteArgs;
|
CallArgList DeleteArgs;
|
||||||
|
|
||||||
// The first argument is always a void*.
|
// The first argument is always a void*.
|
||||||
FunctionProtoType::arg_type_iterator AI = FPT->arg_type_begin();
|
FunctionProtoType::param_type_iterator AI = FPT->param_type_begin();
|
||||||
DeleteArgs.add(RValue::get(Ptr), *AI++);
|
DeleteArgs.add(RValue::get(Ptr), *AI++);
|
||||||
|
|
||||||
// A member 'operator delete' can take an extra 'size_t' argument.
|
// A member 'operator delete' can take an extra 'size_t' argument.
|
||||||
if (FPT->getNumArgs() == NumPlacementArgs + 2)
|
if (FPT->getNumParams() == NumPlacementArgs + 2)
|
||||||
DeleteArgs.add(RValue::get(AllocSize), *AI++);
|
DeleteArgs.add(RValue::get(AllocSize), *AI++);
|
||||||
|
|
||||||
// Pass the rest of the arguments, which must match exactly.
|
// Pass the rest of the arguments, which must match exactly.
|
||||||
|
@ -1069,17 +1069,17 @@ namespace {
|
||||||
void Emit(CodeGenFunction &CGF, Flags flags) {
|
void Emit(CodeGenFunction &CGF, Flags flags) {
|
||||||
const FunctionProtoType *FPT
|
const FunctionProtoType *FPT
|
||||||
= OperatorDelete->getType()->getAs<FunctionProtoType>();
|
= OperatorDelete->getType()->getAs<FunctionProtoType>();
|
||||||
assert(FPT->getNumArgs() == NumPlacementArgs + 1 ||
|
assert(FPT->getNumParams() == NumPlacementArgs + 1 ||
|
||||||
(FPT->getNumArgs() == 2 && NumPlacementArgs == 0));
|
(FPT->getNumParams() == 2 && NumPlacementArgs == 0));
|
||||||
|
|
||||||
CallArgList DeleteArgs;
|
CallArgList DeleteArgs;
|
||||||
|
|
||||||
// The first argument is always a void*.
|
// The first argument is always a void*.
|
||||||
FunctionProtoType::arg_type_iterator AI = FPT->arg_type_begin();
|
FunctionProtoType::param_type_iterator AI = FPT->param_type_begin();
|
||||||
DeleteArgs.add(Ptr.restore(CGF), *AI++);
|
DeleteArgs.add(Ptr.restore(CGF), *AI++);
|
||||||
|
|
||||||
// A member 'operator delete' can take an extra 'size_t' argument.
|
// A member 'operator delete' can take an extra 'size_t' argument.
|
||||||
if (FPT->getNumArgs() == NumPlacementArgs + 2) {
|
if (FPT->getNumParams() == NumPlacementArgs + 2) {
|
||||||
RValue RV = AllocSize.restore(CGF);
|
RValue RV = AllocSize.restore(CGF);
|
||||||
DeleteArgs.add(RV, *AI++);
|
DeleteArgs.add(RV, *AI++);
|
||||||
}
|
}
|
||||||
|
@ -1168,8 +1168,8 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) {
|
||||||
// We start at 1 here because the first argument (the allocation size)
|
// We start at 1 here because the first argument (the allocation size)
|
||||||
// has already been emitted.
|
// has already been emitted.
|
||||||
EmitCallArgs(allocatorArgs, allocatorType->isVariadic(),
|
EmitCallArgs(allocatorArgs, allocatorType->isVariadic(),
|
||||||
allocatorType->arg_type_begin() + 1,
|
allocatorType->param_type_begin() + 1,
|
||||||
allocatorType->arg_type_end(), E->placement_arg_begin(),
|
allocatorType->param_type_end(), E->placement_arg_begin(),
|
||||||
E->placement_arg_end());
|
E->placement_arg_end());
|
||||||
|
|
||||||
// Emit the allocation call. If the allocator is a global placement
|
// Emit the allocation call. If the allocator is a global placement
|
||||||
|
@ -1286,14 +1286,14 @@ void CodeGenFunction::EmitDeleteCall(const FunctionDecl *DeleteFD,
|
||||||
// Check if we need to pass the size to the delete operator.
|
// Check if we need to pass the size to the delete operator.
|
||||||
llvm::Value *Size = 0;
|
llvm::Value *Size = 0;
|
||||||
QualType SizeTy;
|
QualType SizeTy;
|
||||||
if (DeleteFTy->getNumArgs() == 2) {
|
if (DeleteFTy->getNumParams() == 2) {
|
||||||
SizeTy = DeleteFTy->getArgType(1);
|
SizeTy = DeleteFTy->getParamType(1);
|
||||||
CharUnits DeleteTypeSize = getContext().getTypeSizeInChars(DeleteTy);
|
CharUnits DeleteTypeSize = getContext().getTypeSizeInChars(DeleteTy);
|
||||||
Size = llvm::ConstantInt::get(ConvertType(SizeTy),
|
Size = llvm::ConstantInt::get(ConvertType(SizeTy),
|
||||||
DeleteTypeSize.getQuantity());
|
DeleteTypeSize.getQuantity());
|
||||||
}
|
}
|
||||||
|
|
||||||
QualType ArgTy = DeleteFTy->getArgType(0);
|
QualType ArgTy = DeleteFTy->getParamType(0);
|
||||||
llvm::Value *DeletePtr = Builder.CreateBitCast(Ptr, ConvertType(ArgTy));
|
llvm::Value *DeletePtr = Builder.CreateBitCast(Ptr, ConvertType(ArgTy));
|
||||||
DeleteArgs.add(RValue::get(DeletePtr), ArgTy);
|
DeleteArgs.add(RValue::get(DeletePtr), ArgTy);
|
||||||
|
|
||||||
|
@ -1422,19 +1422,19 @@ namespace {
|
||||||
void Emit(CodeGenFunction &CGF, Flags flags) {
|
void Emit(CodeGenFunction &CGF, Flags flags) {
|
||||||
const FunctionProtoType *DeleteFTy =
|
const FunctionProtoType *DeleteFTy =
|
||||||
OperatorDelete->getType()->getAs<FunctionProtoType>();
|
OperatorDelete->getType()->getAs<FunctionProtoType>();
|
||||||
assert(DeleteFTy->getNumArgs() == 1 || DeleteFTy->getNumArgs() == 2);
|
assert(DeleteFTy->getNumParams() == 1 || DeleteFTy->getNumParams() == 2);
|
||||||
|
|
||||||
CallArgList Args;
|
CallArgList Args;
|
||||||
|
|
||||||
// Pass the pointer as the first argument.
|
// Pass the pointer as the first argument.
|
||||||
QualType VoidPtrTy = DeleteFTy->getArgType(0);
|
QualType VoidPtrTy = DeleteFTy->getParamType(0);
|
||||||
llvm::Value *DeletePtr
|
llvm::Value *DeletePtr
|
||||||
= CGF.Builder.CreateBitCast(Ptr, CGF.ConvertType(VoidPtrTy));
|
= CGF.Builder.CreateBitCast(Ptr, CGF.ConvertType(VoidPtrTy));
|
||||||
Args.add(RValue::get(DeletePtr), VoidPtrTy);
|
Args.add(RValue::get(DeletePtr), VoidPtrTy);
|
||||||
|
|
||||||
// Pass the original requested size as the second argument.
|
// Pass the original requested size as the second argument.
|
||||||
if (DeleteFTy->getNumArgs() == 2) {
|
if (DeleteFTy->getNumParams() == 2) {
|
||||||
QualType size_t = DeleteFTy->getArgType(1);
|
QualType size_t = DeleteFTy->getParamType(1);
|
||||||
llvm::IntegerType *SizeTy
|
llvm::IntegerType *SizeTy
|
||||||
= cast<llvm::IntegerType>(CGF.ConvertType(size_t));
|
= cast<llvm::IntegerType>(CGF.ConvertType(size_t));
|
||||||
|
|
||||||
|
|
|
@ -2516,11 +2516,11 @@ public:
|
||||||
bool ForceColumnInfo = false) {
|
bool ForceColumnInfo = false) {
|
||||||
if (CallArgTypeInfo) {
|
if (CallArgTypeInfo) {
|
||||||
EmitCallArgs(Args, CallArgTypeInfo->isVariadic(),
|
EmitCallArgs(Args, CallArgTypeInfo->isVariadic(),
|
||||||
CallArgTypeInfo->arg_type_begin(),
|
CallArgTypeInfo->param_type_begin(),
|
||||||
CallArgTypeInfo->arg_type_end(), ArgBeg, ArgEnd,
|
CallArgTypeInfo->param_type_end(), ArgBeg, ArgEnd,
|
||||||
ForceColumnInfo);
|
ForceColumnInfo);
|
||||||
} else {
|
} else {
|
||||||
// T::arg_type_iterator might not have a default ctor.
|
// T::param_type_iterator might not have a default ctor.
|
||||||
const QualType *NoIter = 0;
|
const QualType *NoIter = 0;
|
||||||
EmitCallArgs(Args, /*AllowExtraArguments=*/true, NoIter, NoIter, ArgBeg,
|
EmitCallArgs(Args, /*AllowExtraArguments=*/true, NoIter, NoIter, ArgBeg,
|
||||||
ArgEnd, ForceColumnInfo);
|
ArgEnd, ForceColumnInfo);
|
||||||
|
|
|
@ -226,8 +226,8 @@ bool CodeGenTypes::isFuncTypeConvertible(const FunctionType *FT) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(FT))
|
if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(FT))
|
||||||
for (unsigned i = 0, e = FPT->getNumArgs(); i != e; i++)
|
for (unsigned i = 0, e = FPT->getNumParams(); i != e; i++)
|
||||||
if (!isFuncTypeArgumentConvertible(FPT->getArgType(i)))
|
if (!isFuncTypeArgumentConvertible(FPT->getParamType(i)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -482,8 +482,8 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
|
||||||
if (const RecordType *RT = FT->getResultType()->getAs<RecordType>())
|
if (const RecordType *RT = FT->getResultType()->getAs<RecordType>())
|
||||||
ConvertRecordDeclType(RT->getDecl());
|
ConvertRecordDeclType(RT->getDecl());
|
||||||
if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(FT))
|
if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(FT))
|
||||||
for (unsigned i = 0, e = FPT->getNumArgs(); i != e; i++)
|
for (unsigned i = 0, e = FPT->getNumParams(); i != e; i++)
|
||||||
if (const RecordType *RT = FPT->getArgType(i)->getAs<RecordType>())
|
if (const RecordType *RT = FPT->getParamType(i)->getAs<RecordType>())
|
||||||
ConvertRecordDeclType(RT->getDecl());
|
ConvertRecordDeclType(RT->getDecl());
|
||||||
|
|
||||||
// Return a placeholder type.
|
// Return a placeholder type.
|
||||||
|
|
|
@ -628,8 +628,9 @@ void USRGenerator::VisitType(QualType T) {
|
||||||
if (const FunctionProtoType *FT = T->getAs<FunctionProtoType>()) {
|
if (const FunctionProtoType *FT = T->getAs<FunctionProtoType>()) {
|
||||||
Out << 'F';
|
Out << 'F';
|
||||||
VisitType(FT->getResultType());
|
VisitType(FT->getResultType());
|
||||||
for (FunctionProtoType::arg_type_iterator
|
for (FunctionProtoType::param_type_iterator I = FT->param_type_begin(),
|
||||||
I = FT->arg_type_begin(), E = FT->arg_type_end(); I!=E; ++I) {
|
E = FT->param_type_end();
|
||||||
|
I != E; ++I) {
|
||||||
VisitType(*I);
|
VisitType(*I);
|
||||||
}
|
}
|
||||||
if (FT->isVariadic())
|
if (FT->isVariadic())
|
||||||
|
|
|
@ -615,8 +615,9 @@ void RewriteModernObjC::RewriteBlocksInFunctionProtoType(QualType funcType,
|
||||||
NamedDecl *D) {
|
NamedDecl *D) {
|
||||||
if (const FunctionProtoType *fproto
|
if (const FunctionProtoType *fproto
|
||||||
= dyn_cast<FunctionProtoType>(funcType.IgnoreParens())) {
|
= dyn_cast<FunctionProtoType>(funcType.IgnoreParens())) {
|
||||||
for (FunctionProtoType::arg_type_iterator I = fproto->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator I = fproto->param_type_begin(),
|
||||||
E = fproto->arg_type_end(); I && (I != E); ++I)
|
E = fproto->param_type_end();
|
||||||
|
I && (I != E); ++I)
|
||||||
if (isTopLevelBlockPointerType(*I)) {
|
if (isTopLevelBlockPointerType(*I)) {
|
||||||
// All the args are checked/rewritten. Don't call twice!
|
// All the args are checked/rewritten. Don't call twice!
|
||||||
RewriteBlockPointerDecl(D);
|
RewriteBlockPointerDecl(D);
|
||||||
|
@ -984,14 +985,15 @@ void RewriteModernObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID,
|
||||||
// Now, emit the argument types (if any).
|
// Now, emit the argument types (if any).
|
||||||
if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FPRetType)){
|
if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FPRetType)){
|
||||||
Getr += "(";
|
Getr += "(";
|
||||||
for (unsigned i = 0, e = FT->getNumArgs(); i != e; ++i) {
|
for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) {
|
||||||
if (i) Getr += ", ";
|
if (i) Getr += ", ";
|
||||||
std::string ParamStr = FT->getArgType(i).getAsString(
|
std::string ParamStr =
|
||||||
Context->getPrintingPolicy());
|
FT->getParamType(i).getAsString(Context->getPrintingPolicy());
|
||||||
Getr += ParamStr;
|
Getr += ParamStr;
|
||||||
}
|
}
|
||||||
if (FT->isVariadic()) {
|
if (FT->isVariadic()) {
|
||||||
if (FT->getNumArgs()) Getr += ", ";
|
if (FT->getNumParams())
|
||||||
|
Getr += ", ";
|
||||||
Getr += "...";
|
Getr += "...";
|
||||||
}
|
}
|
||||||
Getr += ")";
|
Getr += ")";
|
||||||
|
@ -1353,14 +1355,15 @@ void RewriteModernObjC::RewriteObjCMethodDecl(const ObjCInterfaceDecl *IDecl,
|
||||||
// Now, emit the argument types (if any).
|
// Now, emit the argument types (if any).
|
||||||
if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FPRetType)) {
|
if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FPRetType)) {
|
||||||
ResultStr += "(";
|
ResultStr += "(";
|
||||||
for (unsigned i = 0, e = FT->getNumArgs(); i != e; ++i) {
|
for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) {
|
||||||
if (i) ResultStr += ", ";
|
if (i) ResultStr += ", ";
|
||||||
std::string ParamStr = FT->getArgType(i).getAsString(
|
std::string ParamStr =
|
||||||
Context->getPrintingPolicy());
|
FT->getParamType(i).getAsString(Context->getPrintingPolicy());
|
||||||
ResultStr += ParamStr;
|
ResultStr += ParamStr;
|
||||||
}
|
}
|
||||||
if (FT->isVariadic()) {
|
if (FT->isVariadic()) {
|
||||||
if (FT->getNumArgs()) ResultStr += ", ";
|
if (FT->getNumParams())
|
||||||
|
ResultStr += ", ";
|
||||||
ResultStr += "...";
|
ResultStr += "...";
|
||||||
}
|
}
|
||||||
ResultStr += ")";
|
ResultStr += ")";
|
||||||
|
@ -2304,8 +2307,8 @@ void RewriteModernObjC::RewriteObjCQualifiedInterfaceTypes(Decl *Dcl) {
|
||||||
// Now check arguments.
|
// Now check arguments.
|
||||||
const char *startBuf = SM->getCharacterData(Loc);
|
const char *startBuf = SM->getCharacterData(Loc);
|
||||||
const char *startFuncBuf = startBuf;
|
const char *startFuncBuf = startBuf;
|
||||||
for (unsigned i = 0; i < proto->getNumArgs(); i++) {
|
for (unsigned i = 0; i < proto->getNumParams(); i++) {
|
||||||
if (needToScanForQualifiers(proto->getArgType(i))) {
|
if (needToScanForQualifiers(proto->getParamType(i))) {
|
||||||
// Since types are unique, we need to scan the buffer.
|
// Since types are unique, we need to scan the buffer.
|
||||||
|
|
||||||
const char *endBuf = startBuf;
|
const char *endBuf = startBuf;
|
||||||
|
@ -2448,9 +2451,9 @@ void RewriteModernObjC::RewriteBlockLiteralFunctionDecl(FunctionDecl *FD) {
|
||||||
FdStr += " ";
|
FdStr += " ";
|
||||||
FdStr += FD->getName();
|
FdStr += FD->getName();
|
||||||
FdStr += "(";
|
FdStr += "(";
|
||||||
unsigned numArgs = proto->getNumArgs();
|
unsigned numArgs = proto->getNumParams();
|
||||||
for (unsigned i = 0; i < numArgs; i++) {
|
for (unsigned i = 0; i < numArgs; i++) {
|
||||||
QualType ArgType = proto->getArgType(i);
|
QualType ArgType = proto->getParamType(i);
|
||||||
RewriteBlockPointerType(FdStr, ArgType);
|
RewriteBlockPointerType(FdStr, ArgType);
|
||||||
if (i+1 < numArgs)
|
if (i+1 < numArgs)
|
||||||
FdStr += ", ";
|
FdStr += ", ";
|
||||||
|
@ -4732,8 +4735,9 @@ QualType RewriteModernObjC::convertFunctionTypeOfBlocks(const FunctionType *FT)
|
||||||
bool modified = convertObjCTypeToCStyleType(Res);
|
bool modified = convertObjCTypeToCStyleType(Res);
|
||||||
|
|
||||||
if (FTP) {
|
if (FTP) {
|
||||||
for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(),
|
||||||
E = FTP->arg_type_end(); I && (I != E); ++I) {
|
E = FTP->param_type_end();
|
||||||
|
I && (I != E); ++I) {
|
||||||
QualType t = *I;
|
QualType t = *I;
|
||||||
// Make sure we convert "t (^)(...)" to "t (*)(...)".
|
// Make sure we convert "t (^)(...)" to "t (*)(...)".
|
||||||
if (convertObjCTypeToCStyleType(t))
|
if (convertObjCTypeToCStyleType(t))
|
||||||
|
@ -4800,8 +4804,9 @@ Stmt *RewriteModernObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp
|
||||||
// Push the block argument type.
|
// Push the block argument type.
|
||||||
ArgTypes.push_back(PtrBlock);
|
ArgTypes.push_back(PtrBlock);
|
||||||
if (FTP) {
|
if (FTP) {
|
||||||
for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(),
|
||||||
E = FTP->arg_type_end(); I && (I != E); ++I) {
|
E = FTP->param_type_end();
|
||||||
|
I && (I != E); ++I) {
|
||||||
QualType t = *I;
|
QualType t = *I;
|
||||||
// Make sure we convert "t (^)(...)" to "t (*)(...)".
|
// Make sure we convert "t (^)(...)" to "t (*)(...)".
|
||||||
if (!convertBlockPointerToFunctionPointer(t))
|
if (!convertBlockPointerToFunctionPointer(t))
|
||||||
|
@ -5020,8 +5025,9 @@ bool RewriteModernObjC::PointerTypeTakesAnyBlockArguments(QualType QT) {
|
||||||
FTP = BPT->getPointeeType()->getAs<FunctionProtoType>();
|
FTP = BPT->getPointeeType()->getAs<FunctionProtoType>();
|
||||||
}
|
}
|
||||||
if (FTP) {
|
if (FTP) {
|
||||||
for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(),
|
||||||
E = FTP->arg_type_end(); I != E; ++I)
|
E = FTP->param_type_end();
|
||||||
|
I != E; ++I)
|
||||||
if (isTopLevelBlockPointerType(*I))
|
if (isTopLevelBlockPointerType(*I))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -5039,8 +5045,9 @@ bool RewriteModernObjC::PointerTypeTakesAnyObjCQualifiedType(QualType QT) {
|
||||||
FTP = BPT->getPointeeType()->getAs<FunctionProtoType>();
|
FTP = BPT->getPointeeType()->getAs<FunctionProtoType>();
|
||||||
}
|
}
|
||||||
if (FTP) {
|
if (FTP) {
|
||||||
for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(),
|
||||||
E = FTP->arg_type_end(); I != E; ++I) {
|
E = FTP->param_type_end();
|
||||||
|
I != E; ++I) {
|
||||||
if ((*I)->isObjCQualifiedIdType())
|
if ((*I)->isObjCQualifiedIdType())
|
||||||
return true;
|
return true;
|
||||||
if ((*I)->isObjCObjectPointerType() &&
|
if ((*I)->isObjCObjectPointerType() &&
|
||||||
|
|
|
@ -547,8 +547,9 @@ void RewriteObjC::RewriteBlocksInFunctionProtoType(QualType funcType,
|
||||||
NamedDecl *D) {
|
NamedDecl *D) {
|
||||||
if (const FunctionProtoType *fproto
|
if (const FunctionProtoType *fproto
|
||||||
= dyn_cast<FunctionProtoType>(funcType.IgnoreParens())) {
|
= dyn_cast<FunctionProtoType>(funcType.IgnoreParens())) {
|
||||||
for (FunctionProtoType::arg_type_iterator I = fproto->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator I = fproto->param_type_begin(),
|
||||||
E = fproto->arg_type_end(); I && (I != E); ++I)
|
E = fproto->param_type_end();
|
||||||
|
I && (I != E); ++I)
|
||||||
if (isTopLevelBlockPointerType(*I)) {
|
if (isTopLevelBlockPointerType(*I)) {
|
||||||
// All the args are checked/rewritten. Don't call twice!
|
// All the args are checked/rewritten. Don't call twice!
|
||||||
RewriteBlockPointerDecl(D);
|
RewriteBlockPointerDecl(D);
|
||||||
|
@ -818,14 +819,15 @@ void RewriteObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID,
|
||||||
// Now, emit the argument types (if any).
|
// Now, emit the argument types (if any).
|
||||||
if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FPRetType)){
|
if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FPRetType)){
|
||||||
Getr += "(";
|
Getr += "(";
|
||||||
for (unsigned i = 0, e = FT->getNumArgs(); i != e; ++i) {
|
for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) {
|
||||||
if (i) Getr += ", ";
|
if (i) Getr += ", ";
|
||||||
std::string ParamStr = FT->getArgType(i).getAsString(
|
std::string ParamStr =
|
||||||
Context->getPrintingPolicy());
|
FT->getParamType(i).getAsString(Context->getPrintingPolicy());
|
||||||
Getr += ParamStr;
|
Getr += ParamStr;
|
||||||
}
|
}
|
||||||
if (FT->isVariadic()) {
|
if (FT->isVariadic()) {
|
||||||
if (FT->getNumArgs()) Getr += ", ";
|
if (FT->getNumParams())
|
||||||
|
Getr += ", ";
|
||||||
Getr += "...";
|
Getr += "...";
|
||||||
}
|
}
|
||||||
Getr += ")";
|
Getr += ")";
|
||||||
|
@ -1157,14 +1159,15 @@ void RewriteObjC::RewriteObjCMethodDecl(const ObjCInterfaceDecl *IDecl,
|
||||||
// Now, emit the argument types (if any).
|
// Now, emit the argument types (if any).
|
||||||
if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FPRetType)) {
|
if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FPRetType)) {
|
||||||
ResultStr += "(";
|
ResultStr += "(";
|
||||||
for (unsigned i = 0, e = FT->getNumArgs(); i != e; ++i) {
|
for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) {
|
||||||
if (i) ResultStr += ", ";
|
if (i) ResultStr += ", ";
|
||||||
std::string ParamStr = FT->getArgType(i).getAsString(
|
std::string ParamStr =
|
||||||
Context->getPrintingPolicy());
|
FT->getParamType(i).getAsString(Context->getPrintingPolicy());
|
||||||
ResultStr += ParamStr;
|
ResultStr += ParamStr;
|
||||||
}
|
}
|
||||||
if (FT->isVariadic()) {
|
if (FT->isVariadic()) {
|
||||||
if (FT->getNumArgs()) ResultStr += ", ";
|
if (FT->getNumParams())
|
||||||
|
ResultStr += ", ";
|
||||||
ResultStr += "...";
|
ResultStr += "...";
|
||||||
}
|
}
|
||||||
ResultStr += ")";
|
ResultStr += ")";
|
||||||
|
@ -2190,8 +2193,8 @@ void RewriteObjC::RewriteObjCQualifiedInterfaceTypes(Decl *Dcl) {
|
||||||
// Now check arguments.
|
// Now check arguments.
|
||||||
const char *startBuf = SM->getCharacterData(Loc);
|
const char *startBuf = SM->getCharacterData(Loc);
|
||||||
const char *startFuncBuf = startBuf;
|
const char *startFuncBuf = startBuf;
|
||||||
for (unsigned i = 0; i < proto->getNumArgs(); i++) {
|
for (unsigned i = 0; i < proto->getNumParams(); i++) {
|
||||||
if (needToScanForQualifiers(proto->getArgType(i))) {
|
if (needToScanForQualifiers(proto->getParamType(i))) {
|
||||||
// Since types are unique, we need to scan the buffer.
|
// Since types are unique, we need to scan the buffer.
|
||||||
|
|
||||||
const char *endBuf = startBuf;
|
const char *endBuf = startBuf;
|
||||||
|
@ -2335,9 +2338,9 @@ void RewriteObjC::RewriteBlockLiteralFunctionDecl(FunctionDecl *FD) {
|
||||||
FdStr += " ";
|
FdStr += " ";
|
||||||
FdStr += FD->getName();
|
FdStr += FD->getName();
|
||||||
FdStr += "(";
|
FdStr += "(";
|
||||||
unsigned numArgs = proto->getNumArgs();
|
unsigned numArgs = proto->getNumParams();
|
||||||
for (unsigned i = 0; i < numArgs; i++) {
|
for (unsigned i = 0; i < numArgs; i++) {
|
||||||
QualType ArgType = proto->getArgType(i);
|
QualType ArgType = proto->getParamType(i);
|
||||||
RewriteBlockPointerType(FdStr, ArgType);
|
RewriteBlockPointerType(FdStr, ArgType);
|
||||||
if (i+1 < numArgs)
|
if (i+1 < numArgs)
|
||||||
FdStr += ", ";
|
FdStr += ", ";
|
||||||
|
@ -3788,8 +3791,9 @@ QualType RewriteObjC::convertFunctionTypeOfBlocks(const FunctionType *FT) {
|
||||||
bool HasBlockType = convertBlockPointerToFunctionPointer(Res);
|
bool HasBlockType = convertBlockPointerToFunctionPointer(Res);
|
||||||
|
|
||||||
if (FTP) {
|
if (FTP) {
|
||||||
for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(),
|
||||||
E = FTP->arg_type_end(); I && (I != E); ++I) {
|
E = FTP->param_type_end();
|
||||||
|
I && (I != E); ++I) {
|
||||||
QualType t = *I;
|
QualType t = *I;
|
||||||
// Make sure we convert "t (^)(...)" to "t (*)(...)".
|
// Make sure we convert "t (^)(...)" to "t (*)(...)".
|
||||||
if (convertBlockPointerToFunctionPointer(t))
|
if (convertBlockPointerToFunctionPointer(t))
|
||||||
|
@ -3858,8 +3862,9 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp) {
|
||||||
// Push the block argument type.
|
// Push the block argument type.
|
||||||
ArgTypes.push_back(PtrBlock);
|
ArgTypes.push_back(PtrBlock);
|
||||||
if (FTP) {
|
if (FTP) {
|
||||||
for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(),
|
||||||
E = FTP->arg_type_end(); I && (I != E); ++I) {
|
E = FTP->param_type_end();
|
||||||
|
I && (I != E); ++I) {
|
||||||
QualType t = *I;
|
QualType t = *I;
|
||||||
// Make sure we convert "t (^)(...)" to "t (*)(...)".
|
// Make sure we convert "t (^)(...)" to "t (*)(...)".
|
||||||
if (!convertBlockPointerToFunctionPointer(t))
|
if (!convertBlockPointerToFunctionPointer(t))
|
||||||
|
@ -4061,8 +4066,9 @@ bool RewriteObjC::PointerTypeTakesAnyBlockArguments(QualType QT) {
|
||||||
FTP = BPT->getPointeeType()->getAs<FunctionProtoType>();
|
FTP = BPT->getPointeeType()->getAs<FunctionProtoType>();
|
||||||
}
|
}
|
||||||
if (FTP) {
|
if (FTP) {
|
||||||
for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(),
|
||||||
E = FTP->arg_type_end(); I != E; ++I)
|
E = FTP->param_type_end();
|
||||||
|
I != E; ++I)
|
||||||
if (isTopLevelBlockPointerType(*I))
|
if (isTopLevelBlockPointerType(*I))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -4080,8 +4086,9 @@ bool RewriteObjC::PointerTypeTakesAnyObjCQualifiedType(QualType QT) {
|
||||||
FTP = BPT->getPointeeType()->getAs<FunctionProtoType>();
|
FTP = BPT->getPointeeType()->getAs<FunctionProtoType>();
|
||||||
}
|
}
|
||||||
if (FTP) {
|
if (FTP) {
|
||||||
for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(),
|
||||||
E = FTP->arg_type_end(); I != E; ++I) {
|
E = FTP->param_type_end();
|
||||||
|
I != E; ++I) {
|
||||||
if ((*I)->isObjCQualifiedIdType())
|
if ((*I)->isObjCQualifiedIdType())
|
||||||
return true;
|
return true;
|
||||||
if ((*I)->isObjCObjectPointerType() &&
|
if ((*I)->isObjCObjectPointerType() &&
|
||||||
|
|
|
@ -1286,7 +1286,7 @@ bool Sema::tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
|
||||||
|
|
||||||
if (const FunctionProtoType *FPT =
|
if (const FunctionProtoType *FPT =
|
||||||
dyn_cast_or_null<FunctionProtoType>(FunTy)) {
|
dyn_cast_or_null<FunctionProtoType>(FunTy)) {
|
||||||
if (FPT->getNumArgs() == 0)
|
if (FPT->getNumParams() == 0)
|
||||||
ZeroArgCallReturnTy = FunTy->getResultType();
|
ZeroArgCallReturnTy = FunTy->getResultType();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -376,7 +376,7 @@ static bool MightInstantiateTo(Sema &S,
|
||||||
if (FriendTy.getQualifiers() != ContextTy.getQualifiers())
|
if (FriendTy.getQualifiers() != ContextTy.getQualifiers())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (FriendTy->getNumArgs() != ContextTy->getNumArgs())
|
if (FriendTy->getNumParams() != ContextTy->getNumParams())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!MightInstantiateTo(S,
|
if (!MightInstantiateTo(S,
|
||||||
|
@ -384,10 +384,9 @@ static bool MightInstantiateTo(Sema &S,
|
||||||
FriendTy->getResultType()))
|
FriendTy->getResultType()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (unsigned I = 0, E = FriendTy->getNumArgs(); I != E; ++I)
|
for (unsigned I = 0, E = FriendTy->getNumParams(); I != E; ++I)
|
||||||
if (!MightInstantiateTo(S,
|
if (!MightInstantiateTo(S, ContextTy->getParamType(I),
|
||||||
ContextTy->getArgType(I),
|
FriendTy->getParamType(I)))
|
||||||
FriendTy->getArgType(I)))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -767,12 +767,9 @@ static void CheckNonNullArguments(Sema &S,
|
||||||
|
|
||||||
/// Handles the checks for format strings, non-POD arguments to vararg
|
/// Handles the checks for format strings, non-POD arguments to vararg
|
||||||
/// functions, and NULL arguments passed to non-NULL parameters.
|
/// functions, and NULL arguments passed to non-NULL parameters.
|
||||||
void Sema::checkCall(NamedDecl *FDecl,
|
void Sema::checkCall(NamedDecl *FDecl, ArrayRef<const Expr *> Args,
|
||||||
ArrayRef<const Expr *> Args,
|
unsigned NumParams, bool IsMemberFunction,
|
||||||
unsigned NumProtoArgs,
|
SourceLocation Loc, SourceRange Range,
|
||||||
bool IsMemberFunction,
|
|
||||||
SourceLocation Loc,
|
|
||||||
SourceRange Range,
|
|
||||||
VariadicCallType CallType) {
|
VariadicCallType CallType) {
|
||||||
// FIXME: We should check as much as we can in the template definition.
|
// FIXME: We should check as much as we can in the template definition.
|
||||||
if (CurContext->isDependentContext())
|
if (CurContext->isDependentContext())
|
||||||
|
@ -796,7 +793,7 @@ void Sema::checkCall(NamedDecl *FDecl,
|
||||||
// Refuse POD arguments that weren't caught by the format string
|
// Refuse POD arguments that weren't caught by the format string
|
||||||
// checks above.
|
// checks above.
|
||||||
if (CallType != VariadicDoesNotApply) {
|
if (CallType != VariadicDoesNotApply) {
|
||||||
for (unsigned ArgIdx = NumProtoArgs; ArgIdx < Args.size(); ++ArgIdx) {
|
for (unsigned ArgIdx = NumParams; ArgIdx < Args.size(); ++ArgIdx) {
|
||||||
// Args[ArgIdx] can be null in malformed code.
|
// Args[ArgIdx] can be null in malformed code.
|
||||||
if (const Expr *Arg = Args[ArgIdx]) {
|
if (const Expr *Arg = Args[ArgIdx]) {
|
||||||
if (CheckedVarArgs.empty() || !CheckedVarArgs[ArgIdx])
|
if (CheckedVarArgs.empty() || !CheckedVarArgs[ArgIdx])
|
||||||
|
@ -826,7 +823,7 @@ void Sema::CheckConstructorCall(FunctionDecl *FDecl,
|
||||||
SourceLocation Loc) {
|
SourceLocation Loc) {
|
||||||
VariadicCallType CallType =
|
VariadicCallType CallType =
|
||||||
Proto->isVariadic() ? VariadicConstructor : VariadicDoesNotApply;
|
Proto->isVariadic() ? VariadicConstructor : VariadicDoesNotApply;
|
||||||
checkCall(FDecl, Args, Proto->getNumArgs(),
|
checkCall(FDecl, Args, Proto->getNumParams(),
|
||||||
/*IsMemberFunction=*/true, Loc, SourceRange(), CallType);
|
/*IsMemberFunction=*/true, Loc, SourceRange(), CallType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -840,7 +837,7 @@ bool Sema::CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall,
|
||||||
IsMemberOperatorCall;
|
IsMemberOperatorCall;
|
||||||
VariadicCallType CallType = getVariadicCallType(FDecl, Proto,
|
VariadicCallType CallType = getVariadicCallType(FDecl, Proto,
|
||||||
TheCall->getCallee());
|
TheCall->getCallee());
|
||||||
unsigned NumProtoArgs = Proto ? Proto->getNumArgs() : 0;
|
unsigned NumParams = Proto ? Proto->getNumParams() : 0;
|
||||||
Expr** Args = TheCall->getArgs();
|
Expr** Args = TheCall->getArgs();
|
||||||
unsigned NumArgs = TheCall->getNumArgs();
|
unsigned NumArgs = TheCall->getNumArgs();
|
||||||
if (IsMemberOperatorCall) {
|
if (IsMemberOperatorCall) {
|
||||||
|
@ -850,8 +847,7 @@ bool Sema::CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall,
|
||||||
++Args;
|
++Args;
|
||||||
--NumArgs;
|
--NumArgs;
|
||||||
}
|
}
|
||||||
checkCall(FDecl, llvm::makeArrayRef<const Expr *>(Args, NumArgs),
|
checkCall(FDecl, llvm::makeArrayRef<const Expr *>(Args, NumArgs), NumParams,
|
||||||
NumProtoArgs,
|
|
||||||
IsMemberFunction, TheCall->getRParenLoc(),
|
IsMemberFunction, TheCall->getRParenLoc(),
|
||||||
TheCall->getCallee()->getSourceRange(), CallType);
|
TheCall->getCallee()->getSourceRange(), CallType);
|
||||||
|
|
||||||
|
@ -906,13 +902,11 @@ bool Sema::CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall,
|
||||||
} else { // Ty->isFunctionPointerType()
|
} else { // Ty->isFunctionPointerType()
|
||||||
CallType = VariadicFunction;
|
CallType = VariadicFunction;
|
||||||
}
|
}
|
||||||
unsigned NumProtoArgs = Proto ? Proto->getNumArgs() : 0;
|
unsigned NumParams = Proto ? Proto->getNumParams() : 0;
|
||||||
|
|
||||||
checkCall(NDecl,
|
checkCall(NDecl, llvm::makeArrayRef<const Expr *>(TheCall->getArgs(),
|
||||||
llvm::makeArrayRef<const Expr *>(TheCall->getArgs(),
|
|
||||||
TheCall->getNumArgs()),
|
TheCall->getNumArgs()),
|
||||||
NumProtoArgs, /*IsMemberFunction=*/false,
|
NumParams, /*IsMemberFunction=*/false, TheCall->getRParenLoc(),
|
||||||
TheCall->getRParenLoc(),
|
|
||||||
TheCall->getCallee()->getSourceRange(), CallType);
|
TheCall->getCallee()->getSourceRange(), CallType);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -923,13 +917,11 @@ bool Sema::CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall,
|
||||||
bool Sema::CheckOtherCall(CallExpr *TheCall, const FunctionProtoType *Proto) {
|
bool Sema::CheckOtherCall(CallExpr *TheCall, const FunctionProtoType *Proto) {
|
||||||
VariadicCallType CallType = getVariadicCallType(/*FDecl=*/0, Proto,
|
VariadicCallType CallType = getVariadicCallType(/*FDecl=*/0, Proto,
|
||||||
TheCall->getCallee());
|
TheCall->getCallee());
|
||||||
unsigned NumProtoArgs = Proto ? Proto->getNumArgs() : 0;
|
unsigned NumParams = Proto ? Proto->getNumParams() : 0;
|
||||||
|
|
||||||
checkCall(/*FDecl=*/0,
|
checkCall(/*FDecl=*/0, llvm::makeArrayRef<const Expr *>(
|
||||||
llvm::makeArrayRef<const Expr *>(TheCall->getArgs(),
|
TheCall->getArgs(), TheCall->getNumArgs()),
|
||||||
TheCall->getNumArgs()),
|
NumParams, /*IsMemberFunction=*/false, TheCall->getRParenLoc(),
|
||||||
NumProtoArgs, /*IsMemberFunction=*/false,
|
|
||||||
TheCall->getRParenLoc(),
|
|
||||||
TheCall->getCallee()->getSourceRange(), CallType);
|
TheCall->getCallee()->getSourceRange(), CallType);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -2297,7 +2297,7 @@ static void AddFunctionParameterChunks(ASTContext &Context,
|
||||||
if (const FunctionProtoType *Proto
|
if (const FunctionProtoType *Proto
|
||||||
= Function->getType()->getAs<FunctionProtoType>())
|
= Function->getType()->getAs<FunctionProtoType>())
|
||||||
if (Proto->isVariadic()) {
|
if (Proto->isVariadic()) {
|
||||||
if (Proto->getNumArgs() == 0)
|
if (Proto->getNumParams() == 0)
|
||||||
Result.AddPlaceholderChunk("...");
|
Result.AddPlaceholderChunk("...");
|
||||||
|
|
||||||
MaybeAddSentinel(Context, Function, Result);
|
MaybeAddSentinel(Context, Function, Result);
|
||||||
|
@ -2854,7 +2854,7 @@ CodeCompleteConsumer::OverloadCandidate::CreateSignatureString(
|
||||||
Proto->getResultType().getAsString(Policy)));
|
Proto->getResultType().getAsString(Policy)));
|
||||||
|
|
||||||
Result.AddChunk(CodeCompletionString::CK_LeftParen);
|
Result.AddChunk(CodeCompletionString::CK_LeftParen);
|
||||||
unsigned NumParams = FDecl? FDecl->getNumParams() : Proto->getNumArgs();
|
unsigned NumParams = FDecl ? FDecl->getNumParams() : Proto->getNumParams();
|
||||||
for (unsigned I = 0; I != NumParams; ++I) {
|
for (unsigned I = 0; I != NumParams; ++I) {
|
||||||
if (I)
|
if (I)
|
||||||
Result.AddChunk(CodeCompletionString::CK_Comma);
|
Result.AddChunk(CodeCompletionString::CK_Comma);
|
||||||
|
@ -2866,7 +2866,7 @@ CodeCompleteConsumer::OverloadCandidate::CreateSignatureString(
|
||||||
ArgString = FDecl->getParamDecl(I)->getNameAsString();
|
ArgString = FDecl->getParamDecl(I)->getNameAsString();
|
||||||
ArgType = FDecl->getParamDecl(I)->getOriginalType();
|
ArgType = FDecl->getParamDecl(I)->getOriginalType();
|
||||||
} else {
|
} else {
|
||||||
ArgType = Proto->getArgType(I);
|
ArgType = Proto->getParamType(I);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArgType.getAsStringInternal(ArgString, Policy);
|
ArgType.getAsStringInternal(ArgString, Policy);
|
||||||
|
@ -3925,12 +3925,13 @@ void Sema::CodeCompleteCall(Scope *S, Expr *FnIn, ArrayRef<Expr *> Args) {
|
||||||
for (unsigned I = 0, N = Results.size(); I != N; ++I) {
|
for (unsigned I = 0, N = Results.size(); I != N; ++I) {
|
||||||
if (const FunctionType *FType = Results[I].getFunctionType())
|
if (const FunctionType *FType = Results[I].getFunctionType())
|
||||||
if (const FunctionProtoType *Proto = dyn_cast<FunctionProtoType>(FType))
|
if (const FunctionProtoType *Proto = dyn_cast<FunctionProtoType>(FType))
|
||||||
if (Args.size() < Proto->getNumArgs()) {
|
if (Args.size() < Proto->getNumParams()) {
|
||||||
if (ParamType.isNull())
|
if (ParamType.isNull())
|
||||||
ParamType = Proto->getArgType(Args.size());
|
ParamType = Proto->getParamType(Args.size());
|
||||||
else if (!Context.hasSameUnqualifiedType(
|
else if (!Context.hasSameUnqualifiedType(
|
||||||
ParamType.getNonReferenceType(),
|
ParamType.getNonReferenceType(),
|
||||||
Proto->getArgType(Args.size()).getNonReferenceType())) {
|
Proto->getParamType(Args.size())
|
||||||
|
.getNonReferenceType())) {
|
||||||
ParamType = QualType();
|
ParamType = QualType();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3951,8 +3952,8 @@ void Sema::CodeCompleteCall(Scope *S, Expr *FnIn, ArrayRef<Expr *> Args) {
|
||||||
|
|
||||||
if (const FunctionProtoType *Proto
|
if (const FunctionProtoType *Proto
|
||||||
= FunctionType->getAs<FunctionProtoType>()) {
|
= FunctionType->getAs<FunctionProtoType>()) {
|
||||||
if (Args.size() < Proto->getNumArgs())
|
if (Args.size() < Proto->getNumParams())
|
||||||
ParamType = Proto->getArgType(Args.size());
|
ParamType = Proto->getParamType(Args.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1563,12 +1563,10 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid,
|
||||||
// FunctionDecl.
|
// FunctionDecl.
|
||||||
if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(R)) {
|
if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(R)) {
|
||||||
SmallVector<ParmVarDecl*, 16> Params;
|
SmallVector<ParmVarDecl*, 16> Params;
|
||||||
for (unsigned i = 0, e = FT->getNumArgs(); i != e; ++i) {
|
for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) {
|
||||||
ParmVarDecl *parm =
|
ParmVarDecl *parm =
|
||||||
ParmVarDecl::Create(Context, New, SourceLocation(),
|
ParmVarDecl::Create(Context, New, SourceLocation(), SourceLocation(),
|
||||||
SourceLocation(), 0,
|
0, FT->getParamType(i), /*TInfo=*/0, SC_None, 0);
|
||||||
FT->getArgType(i), /*TInfo=*/0,
|
|
||||||
SC_None, 0);
|
|
||||||
parm->setScopeInfo(0, i);
|
parm->setScopeInfo(0, i);
|
||||||
Params.push_back(parm);
|
Params.push_back(parm);
|
||||||
}
|
}
|
||||||
|
@ -2649,8 +2647,8 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, Scope *S,
|
||||||
// The old declaration provided a function prototype, but the
|
// The old declaration provided a function prototype, but the
|
||||||
// new declaration does not. Merge in the prototype.
|
// new declaration does not. Merge in the prototype.
|
||||||
assert(!OldProto->hasExceptionSpec() && "Exception spec in C");
|
assert(!OldProto->hasExceptionSpec() && "Exception spec in C");
|
||||||
SmallVector<QualType, 16> ParamTypes(OldProto->arg_type_begin(),
|
SmallVector<QualType, 16> ParamTypes(OldProto->param_type_begin(),
|
||||||
OldProto->arg_type_end());
|
OldProto->param_type_end());
|
||||||
NewQType = Context.getFunctionType(NewFuncType->getResultType(),
|
NewQType = Context.getFunctionType(NewFuncType->getResultType(),
|
||||||
ParamTypes,
|
ParamTypes,
|
||||||
OldProto->getExtProtoInfo());
|
OldProto->getExtProtoInfo());
|
||||||
|
@ -2659,9 +2657,9 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, Scope *S,
|
||||||
|
|
||||||
// Synthesize a parameter for each argument type.
|
// Synthesize a parameter for each argument type.
|
||||||
SmallVector<ParmVarDecl*, 16> Params;
|
SmallVector<ParmVarDecl*, 16> Params;
|
||||||
for (FunctionProtoType::arg_type_iterator
|
for (FunctionProtoType::param_type_iterator
|
||||||
ParamType = OldProto->arg_type_begin(),
|
ParamType = OldProto->param_type_begin(),
|
||||||
ParamEnd = OldProto->arg_type_end();
|
ParamEnd = OldProto->param_type_end();
|
||||||
ParamType != ParamEnd; ++ParamType) {
|
ParamType != ParamEnd; ++ParamType) {
|
||||||
ParmVarDecl *Param = ParmVarDecl::Create(Context, New,
|
ParmVarDecl *Param = ParmVarDecl::Create(Context, New,
|
||||||
SourceLocation(),
|
SourceLocation(),
|
||||||
|
@ -2711,13 +2709,13 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, Scope *S,
|
||||||
ParmVarDecl *OldParm = Old->getParamDecl(Idx);
|
ParmVarDecl *OldParm = Old->getParamDecl(Idx);
|
||||||
ParmVarDecl *NewParm = New->getParamDecl(Idx);
|
ParmVarDecl *NewParm = New->getParamDecl(Idx);
|
||||||
if (Context.typesAreCompatible(OldParm->getType(),
|
if (Context.typesAreCompatible(OldParm->getType(),
|
||||||
NewProto->getArgType(Idx))) {
|
NewProto->getParamType(Idx))) {
|
||||||
ArgTypes.push_back(NewParm->getType());
|
ArgTypes.push_back(NewParm->getType());
|
||||||
} else if (Context.typesAreCompatible(OldParm->getType(),
|
} else if (Context.typesAreCompatible(OldParm->getType(),
|
||||||
NewParm->getType(),
|
NewParm->getType(),
|
||||||
/*CompareUnqualified=*/true)) {
|
/*CompareUnqualified=*/true)) {
|
||||||
GNUCompatibleParamWarning Warn
|
GNUCompatibleParamWarning Warn = { OldParm, NewParm,
|
||||||
= { OldParm, NewParm, NewProto->getArgType(Idx) };
|
NewProto->getParamType(Idx) };
|
||||||
Warnings.push_back(Warn);
|
Warnings.push_back(Warn);
|
||||||
ArgTypes.push_back(NewParm->getType());
|
ArgTypes.push_back(NewParm->getType());
|
||||||
} else
|
} else
|
||||||
|
@ -6735,7 +6733,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
|
||||||
NewFD->getType()->castAs<FunctionProtoType>();
|
NewFD->getType()->castAs<FunctionProtoType>();
|
||||||
QualType Result = SubstAutoType(FPT->getResultType(),
|
QualType Result = SubstAutoType(FPT->getResultType(),
|
||||||
Context.DependentTy);
|
Context.DependentTy);
|
||||||
NewFD->setType(Context.getFunctionType(Result, FPT->getArgTypes(),
|
NewFD->setType(Context.getFunctionType(Result, FPT->getParamTypes(),
|
||||||
FPT->getExtProtoInfo()));
|
FPT->getExtProtoInfo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6854,7 +6852,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
|
||||||
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
|
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
|
||||||
EPI.ExceptionSpecType = EST_BasicNoexcept;
|
EPI.ExceptionSpecType = EST_BasicNoexcept;
|
||||||
NewFD->setType(Context.getFunctionType(FPT->getResultType(),
|
NewFD->setType(Context.getFunctionType(FPT->getResultType(),
|
||||||
FPT->getArgTypes(), EPI));
|
FPT->getParamTypes(), EPI));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6918,8 +6916,9 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
|
||||||
// @endcode
|
// @endcode
|
||||||
|
|
||||||
// Synthesize a parameter for each argument type.
|
// Synthesize a parameter for each argument type.
|
||||||
for (FunctionProtoType::arg_type_iterator AI = FT->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator AI = FT->param_type_begin(),
|
||||||
AE = FT->arg_type_end(); AI != AE; ++AI) {
|
AE = FT->param_type_end();
|
||||||
|
AI != AE; ++AI) {
|
||||||
ParmVarDecl *Param =
|
ParmVarDecl *Param =
|
||||||
BuildParmVarDeclForTypedef(NewFD, D.getIdentifierLoc(), *AI);
|
BuildParmVarDeclForTypedef(NewFD, D.getIdentifierLoc(), *AI);
|
||||||
Param->setScopeInfo(0, Params.size());
|
Param->setScopeInfo(0, Params.size());
|
||||||
|
@ -7480,7 +7479,7 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD,
|
||||||
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
|
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
|
||||||
EPI.TypeQuals |= Qualifiers::Const;
|
EPI.TypeQuals |= Qualifiers::Const;
|
||||||
MD->setType(Context.getFunctionType(FPT->getResultType(),
|
MD->setType(Context.getFunctionType(FPT->getResultType(),
|
||||||
FPT->getArgTypes(), EPI));
|
FPT->getParamTypes(), EPI));
|
||||||
|
|
||||||
// Warn that we did this, if we're not performing template instantiation.
|
// Warn that we did this, if we're not performing template instantiation.
|
||||||
// In that case, we'll have warned already when the template was defined.
|
// In that case, we'll have warned already when the template was defined.
|
||||||
|
@ -7740,7 +7739,7 @@ void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& DS) {
|
||||||
if (isa<FunctionNoProtoType>(FT)) return;
|
if (isa<FunctionNoProtoType>(FT)) return;
|
||||||
|
|
||||||
const FunctionProtoType* FTP = cast<const FunctionProtoType>(FT);
|
const FunctionProtoType* FTP = cast<const FunctionProtoType>(FT);
|
||||||
unsigned nparams = FTP->getNumArgs();
|
unsigned nparams = FTP->getNumParams();
|
||||||
assert(FD->getNumParams() == nparams);
|
assert(FD->getNumParams() == nparams);
|
||||||
|
|
||||||
bool HasExtraParameters = (nparams > 3);
|
bool HasExtraParameters = (nparams > 3);
|
||||||
|
@ -7765,7 +7764,7 @@ void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& DS) {
|
||||||
QualType Expected[] = { Context.IntTy, CharPP, CharPP, CharPP };
|
QualType Expected[] = { Context.IntTy, CharPP, CharPP, CharPP };
|
||||||
|
|
||||||
for (unsigned i = 0; i < nparams; ++i) {
|
for (unsigned i = 0; i < nparams; ++i) {
|
||||||
QualType AT = FTP->getArgType(i);
|
QualType AT = FTP->getParamType(i);
|
||||||
|
|
||||||
bool mismatch = true;
|
bool mismatch = true;
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ static bool hasFunctionProto(const Decl *D) {
|
||||||
/// hasFunctionProto first).
|
/// hasFunctionProto first).
|
||||||
static unsigned getFunctionOrMethodNumArgs(const Decl *D) {
|
static unsigned getFunctionOrMethodNumArgs(const Decl *D) {
|
||||||
if (const FunctionType *FnTy = D->getFunctionType())
|
if (const FunctionType *FnTy = D->getFunctionType())
|
||||||
return cast<FunctionProtoType>(FnTy)->getNumArgs();
|
return cast<FunctionProtoType>(FnTy)->getNumParams();
|
||||||
if (const BlockDecl *BD = dyn_cast<BlockDecl>(D))
|
if (const BlockDecl *BD = dyn_cast<BlockDecl>(D))
|
||||||
return BD->getNumParams();
|
return BD->getNumParams();
|
||||||
return cast<ObjCMethodDecl>(D)->param_size();
|
return cast<ObjCMethodDecl>(D)->param_size();
|
||||||
|
@ -80,7 +80,7 @@ static unsigned getFunctionOrMethodNumArgs(const Decl *D) {
|
||||||
|
|
||||||
static QualType getFunctionOrMethodArgType(const Decl *D, unsigned Idx) {
|
static QualType getFunctionOrMethodArgType(const Decl *D, unsigned Idx) {
|
||||||
if (const FunctionType *FnTy = D->getFunctionType())
|
if (const FunctionType *FnTy = D->getFunctionType())
|
||||||
return cast<FunctionProtoType>(FnTy)->getArgType(Idx);
|
return cast<FunctionProtoType>(FnTy)->getParamType(Idx);
|
||||||
if (const BlockDecl *BD = dyn_cast<BlockDecl>(D))
|
if (const BlockDecl *BD = dyn_cast<BlockDecl>(D))
|
||||||
return BD->getParamDecl(Idx)->getType();
|
return BD->getParamDecl(Idx)->getType();
|
||||||
|
|
||||||
|
@ -4343,8 +4343,9 @@ NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II,
|
||||||
QualType FDTy = FD->getType();
|
QualType FDTy = FD->getType();
|
||||||
if (const FunctionProtoType *FT = FDTy->getAs<FunctionProtoType>()) {
|
if (const FunctionProtoType *FT = FDTy->getAs<FunctionProtoType>()) {
|
||||||
SmallVector<ParmVarDecl*, 16> Params;
|
SmallVector<ParmVarDecl*, 16> Params;
|
||||||
for (FunctionProtoType::arg_type_iterator AI = FT->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator AI = FT->param_type_begin(),
|
||||||
AE = FT->arg_type_end(); AI != AE; ++AI) {
|
AE = FT->param_type_end();
|
||||||
|
AI != AE; ++AI) {
|
||||||
ParmVarDecl *Param = BuildParmVarDeclForTypedef(NewFD, Loc, *AI);
|
ParmVarDecl *Param = BuildParmVarDeclForTypedef(NewFD, Loc, *AI);
|
||||||
Param->setScopeInfo(0, Params.size());
|
Param->setScopeInfo(0, Params.size());
|
||||||
Params.push_back(Param);
|
Params.push_back(Param);
|
||||||
|
|
|
@ -714,8 +714,9 @@ static bool CheckConstexprParameterTypes(Sema &SemaRef,
|
||||||
const FunctionDecl *FD) {
|
const FunctionDecl *FD) {
|
||||||
unsigned ArgIndex = 0;
|
unsigned ArgIndex = 0;
|
||||||
const FunctionProtoType *FT = FD->getType()->getAs<FunctionProtoType>();
|
const FunctionProtoType *FT = FD->getType()->getAs<FunctionProtoType>();
|
||||||
for (FunctionProtoType::arg_type_iterator i = FT->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator i = FT->param_type_begin(),
|
||||||
e = FT->arg_type_end(); i != e; ++i, ++ArgIndex) {
|
e = FT->param_type_end();
|
||||||
|
i != e; ++i, ++ArgIndex) {
|
||||||
const ParmVarDecl *PD = FD->getParamDecl(ArgIndex);
|
const ParmVarDecl *PD = FD->getParamDecl(ArgIndex);
|
||||||
SourceLocation ParamLoc = PD->getLocation();
|
SourceLocation ParamLoc = PD->getLocation();
|
||||||
if (!(*i)->isDependentType() &&
|
if (!(*i)->isDependentType() &&
|
||||||
|
@ -4717,7 +4718,7 @@ updateExceptionSpec(Sema &S, FunctionDecl *FD, const FunctionProtoType *FPT,
|
||||||
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
|
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
|
||||||
ExceptSpec.getEPI(EPI);
|
ExceptSpec.getEPI(EPI);
|
||||||
FD->setType(S.Context.getFunctionType(FPT->getResultType(),
|
FD->setType(S.Context.getFunctionType(FPT->getResultType(),
|
||||||
FPT->getArgTypes(), EPI));
|
FPT->getParamTypes(), EPI));
|
||||||
}
|
}
|
||||||
|
|
||||||
static FunctionProtoType::ExtProtoInfo getImplicitMethodEPI(Sema &S,
|
static FunctionProtoType::ExtProtoInfo getImplicitMethodEPI(Sema &S,
|
||||||
|
@ -4822,7 +4823,7 @@ void Sema::CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for parameter type matching.
|
// Check for parameter type matching.
|
||||||
QualType ArgType = ExpectedParams ? Type->getArgType(0) : QualType();
|
QualType ArgType = ExpectedParams ? Type->getParamType(0) : QualType();
|
||||||
bool HasConstParam = false;
|
bool HasConstParam = false;
|
||||||
if (ExpectedParams && ArgType->isReferenceType()) {
|
if (ExpectedParams && ArgType->isReferenceType()) {
|
||||||
// Argument must be reference to possibly-const T.
|
// Argument must be reference to possibly-const T.
|
||||||
|
@ -6226,7 +6227,7 @@ QualType Sema::CheckConstructorDeclarator(Declarator &D, QualType R,
|
||||||
EPI.TypeQuals = 0;
|
EPI.TypeQuals = 0;
|
||||||
EPI.RefQualifier = RQ_None;
|
EPI.RefQualifier = RQ_None;
|
||||||
|
|
||||||
return Context.getFunctionType(Context.VoidTy, Proto->getArgTypes(), EPI);
|
return Context.getFunctionType(Context.VoidTy, Proto->getParamTypes(), EPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// CheckConstructor - Checks a fully-formed constructor for
|
/// CheckConstructor - Checks a fully-formed constructor for
|
||||||
|
@ -6454,7 +6455,7 @@ void Sema::CheckConversionDeclarator(Declarator &D, QualType &R,
|
||||||
const FunctionProtoType *Proto = R->getAs<FunctionProtoType>();
|
const FunctionProtoType *Proto = R->getAs<FunctionProtoType>();
|
||||||
|
|
||||||
// Make sure we don't have any parameters.
|
// Make sure we don't have any parameters.
|
||||||
if (Proto->getNumArgs() > 0) {
|
if (Proto->getNumParams() > 0) {
|
||||||
Diag(D.getIdentifierLoc(), diag::err_conv_function_with_params);
|
Diag(D.getIdentifierLoc(), diag::err_conv_function_with_params);
|
||||||
|
|
||||||
// Delete the parameters.
|
// Delete the parameters.
|
||||||
|
@ -8388,7 +8389,7 @@ private:
|
||||||
void inherit(const CXXConstructorDecl *Ctor) {
|
void inherit(const CXXConstructorDecl *Ctor) {
|
||||||
const FunctionProtoType *CtorType =
|
const FunctionProtoType *CtorType =
|
||||||
Ctor->getType()->castAs<FunctionProtoType>();
|
Ctor->getType()->castAs<FunctionProtoType>();
|
||||||
ArrayRef<QualType> ArgTypes(CtorType->getArgTypes());
|
ArrayRef<QualType> ArgTypes(CtorType->getParamTypes());
|
||||||
FunctionProtoType::ExtProtoInfo EPI = CtorType->getExtProtoInfo();
|
FunctionProtoType::ExtProtoInfo EPI = CtorType->getExtProtoInfo();
|
||||||
|
|
||||||
SourceLocation UsingLoc = getUsingLoc(Ctor->getParent());
|
SourceLocation UsingLoc = getUsingLoc(Ctor->getParent());
|
||||||
|
@ -8531,16 +8532,16 @@ private:
|
||||||
EPI.ExceptionSpecType = EST_Unevaluated;
|
EPI.ExceptionSpecType = EST_Unevaluated;
|
||||||
EPI.ExceptionSpecDecl = DerivedCtor;
|
EPI.ExceptionSpecDecl = DerivedCtor;
|
||||||
DerivedCtor->setType(Context.getFunctionType(FPT->getResultType(),
|
DerivedCtor->setType(Context.getFunctionType(FPT->getResultType(),
|
||||||
FPT->getArgTypes(), EPI));
|
FPT->getParamTypes(), EPI));
|
||||||
|
|
||||||
// Build the parameter declarations.
|
// Build the parameter declarations.
|
||||||
SmallVector<ParmVarDecl *, 16> ParamDecls;
|
SmallVector<ParmVarDecl *, 16> ParamDecls;
|
||||||
for (unsigned I = 0, N = FPT->getNumArgs(); I != N; ++I) {
|
for (unsigned I = 0, N = FPT->getNumParams(); I != N; ++I) {
|
||||||
TypeSourceInfo *TInfo =
|
TypeSourceInfo *TInfo =
|
||||||
Context.getTrivialTypeSourceInfo(FPT->getArgType(I), UsingLoc);
|
Context.getTrivialTypeSourceInfo(FPT->getParamType(I), UsingLoc);
|
||||||
ParmVarDecl *PD = ParmVarDecl::Create(
|
ParmVarDecl *PD = ParmVarDecl::Create(
|
||||||
Context, DerivedCtor, UsingLoc, UsingLoc, /*IdentifierInfo=*/0,
|
Context, DerivedCtor, UsingLoc, UsingLoc, /*IdentifierInfo=*/0,
|
||||||
FPT->getArgType(I), TInfo, SC_None, /*DefaultArg=*/0);
|
FPT->getParamType(I), TInfo, SC_None, /*DefaultArg=*/0);
|
||||||
PD->setScopeInfo(0, I);
|
PD->setScopeInfo(0, I);
|
||||||
PD->setImplicit();
|
PD->setImplicit();
|
||||||
ParamDecls.push_back(PD);
|
ParamDecls.push_back(PD);
|
||||||
|
@ -9237,8 +9238,9 @@ Sema::ComputeDefaultedCopyAssignmentExceptionSpec(CXXMethodDecl *MD) {
|
||||||
return ExceptSpec;
|
return ExceptSpec;
|
||||||
|
|
||||||
const FunctionProtoType *T = MD->getType()->castAs<FunctionProtoType>();
|
const FunctionProtoType *T = MD->getType()->castAs<FunctionProtoType>();
|
||||||
assert(T->getNumArgs() == 1 && "not a copy assignment op");
|
assert(T->getNumParams() == 1 && "not a copy assignment op");
|
||||||
unsigned ArgQuals = T->getArgType(0).getNonReferenceType().getCVRQualifiers();
|
unsigned ArgQuals =
|
||||||
|
T->getParamType(0).getNonReferenceType().getCVRQualifiers();
|
||||||
|
|
||||||
// C++ [except.spec]p14:
|
// C++ [except.spec]p14:
|
||||||
// An implicitly declared special member function (Clause 12) shall have an
|
// An implicitly declared special member function (Clause 12) shall have an
|
||||||
|
@ -10061,8 +10063,8 @@ Sema::ComputeDefaultedCopyCtorExceptionSpec(CXXMethodDecl *MD) {
|
||||||
return ExceptSpec;
|
return ExceptSpec;
|
||||||
|
|
||||||
const FunctionProtoType *T = MD->getType()->castAs<FunctionProtoType>();
|
const FunctionProtoType *T = MD->getType()->castAs<FunctionProtoType>();
|
||||||
assert(T->getNumArgs() >= 1 && "not a copy ctor");
|
assert(T->getNumParams() >= 1 && "not a copy ctor");
|
||||||
unsigned Quals = T->getArgType(0).getNonReferenceType().getCVRQualifiers();
|
unsigned Quals = T->getParamType(0).getNonReferenceType().getCVRQualifiers();
|
||||||
|
|
||||||
// C++ [except.spec]p14:
|
// C++ [except.spec]p14:
|
||||||
// An implicitly declared special member function (Clause 12) shall have an
|
// An implicitly declared special member function (Clause 12) shall have an
|
||||||
|
@ -10635,7 +10637,7 @@ Sema::CompleteConstructorCall(CXXConstructorDecl *Constructor,
|
||||||
const FunctionProtoType *Proto
|
const FunctionProtoType *Proto
|
||||||
= Constructor->getType()->getAs<FunctionProtoType>();
|
= Constructor->getType()->getAs<FunctionProtoType>();
|
||||||
assert(Proto && "Constructor without a prototype?");
|
assert(Proto && "Constructor without a prototype?");
|
||||||
unsigned NumArgsInProto = Proto->getNumArgs();
|
unsigned NumArgsInProto = Proto->getNumParams();
|
||||||
|
|
||||||
// If too few arguments are available, we'll fill in the rest with defaults.
|
// If too few arguments are available, we'll fill in the rest with defaults.
|
||||||
if (NumArgs < NumArgsInProto)
|
if (NumArgs < NumArgsInProto)
|
||||||
|
|
|
@ -204,7 +204,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) {
|
||||||
FunctionProtoType::ExtProtoInfo EPI = NewProto->getExtProtoInfo();
|
FunctionProtoType::ExtProtoInfo EPI = NewProto->getExtProtoInfo();
|
||||||
EPI.ExceptionSpecType = EST_DynamicNone;
|
EPI.ExceptionSpecType = EST_DynamicNone;
|
||||||
QualType NewType = Context.getFunctionType(NewProto->getResultType(),
|
QualType NewType = Context.getFunctionType(NewProto->getResultType(),
|
||||||
NewProto->getArgTypes(), EPI);
|
NewProto->getParamTypes(), EPI);
|
||||||
New->setType(NewType);
|
New->setType(NewType);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) {
|
||||||
// Update the type of the function with the appropriate exception
|
// Update the type of the function with the appropriate exception
|
||||||
// specification.
|
// specification.
|
||||||
QualType NewType = Context.getFunctionType(NewProto->getResultType(),
|
QualType NewType = Context.getFunctionType(NewProto->getResultType(),
|
||||||
NewProto->getArgTypes(), EPI);
|
NewProto->getParamTypes(), EPI);
|
||||||
New->setType(NewType);
|
New->setType(NewType);
|
||||||
|
|
||||||
// Warn about the lack of exception specification.
|
// Warn about the lack of exception specification.
|
||||||
|
@ -720,14 +720,13 @@ bool Sema::CheckParamExceptionSpec(const PartialDiagnostic & NoteID,
|
||||||
|
|
||||||
// We shouldn't even be testing this unless the arguments are otherwise
|
// We shouldn't even be testing this unless the arguments are otherwise
|
||||||
// compatible.
|
// compatible.
|
||||||
assert(Target->getNumArgs() == Source->getNumArgs() &&
|
assert(Target->getNumParams() == Source->getNumParams() &&
|
||||||
"Functions have different argument counts.");
|
"Functions have different argument counts.");
|
||||||
for (unsigned i = 0, E = Target->getNumArgs(); i != E; ++i) {
|
for (unsigned i = 0, E = Target->getNumParams(); i != E; ++i) {
|
||||||
if (CheckSpecForTypesEquivalent(*this,
|
if (CheckSpecForTypesEquivalent(
|
||||||
PDiag(diag::err_deep_exception_specs_differ) << 1,
|
*this, PDiag(diag::err_deep_exception_specs_differ) << 1, PDiag(),
|
||||||
PDiag(),
|
Target->getParamType(i), TargetLoc, Source->getParamType(i),
|
||||||
Target->getArgType(i), TargetLoc,
|
SourceLoc))
|
||||||
Source->getArgType(i), SourceLoc))
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -352,7 +352,7 @@ void Sema::DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const FunctionProtoType *proto = dyn_cast<FunctionProtoType>(fn)) {
|
if (const FunctionProtoType *proto = dyn_cast<FunctionProtoType>(fn)) {
|
||||||
numFormalParams = proto->getNumArgs();
|
numFormalParams = proto->getNumParams();
|
||||||
} else {
|
} else {
|
||||||
numFormalParams = 0;
|
numFormalParams = 0;
|
||||||
}
|
}
|
||||||
|
@ -4017,7 +4017,7 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
|
||||||
|
|
||||||
// C99 6.5.2.2p7 - the arguments are implicitly converted, as if by
|
// C99 6.5.2.2p7 - the arguments are implicitly converted, as if by
|
||||||
// assignment, to the types of the corresponding parameter, ...
|
// assignment, to the types of the corresponding parameter, ...
|
||||||
unsigned NumArgsInProto = Proto->getNumArgs();
|
unsigned NumArgsInProto = Proto->getNumParams();
|
||||||
bool Invalid = false;
|
bool Invalid = false;
|
||||||
unsigned MinArgs = FDecl ? FDecl->getMinRequiredArguments() : NumArgsInProto;
|
unsigned MinArgs = FDecl ? FDecl->getMinRequiredArguments() : NumArgsInProto;
|
||||||
unsigned FnKind = Fn->getType()->isBlockPointerType()
|
unsigned FnKind = Fn->getType()->isBlockPointerType()
|
||||||
|
@ -4138,7 +4138,7 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc,
|
||||||
VariadicCallType CallType,
|
VariadicCallType CallType,
|
||||||
bool AllowExplicit,
|
bool AllowExplicit,
|
||||||
bool IsListInitialization) {
|
bool IsListInitialization) {
|
||||||
unsigned NumArgsInProto = Proto->getNumArgs();
|
unsigned NumArgsInProto = Proto->getNumParams();
|
||||||
unsigned NumArgsToCheck = Args.size();
|
unsigned NumArgsToCheck = Args.size();
|
||||||
bool Invalid = false;
|
bool Invalid = false;
|
||||||
if (Args.size() != NumArgsInProto)
|
if (Args.size() != NumArgsInProto)
|
||||||
|
@ -4147,7 +4147,7 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc,
|
||||||
unsigned ArgIx = 0;
|
unsigned ArgIx = 0;
|
||||||
// Continue to check argument types (even if we have too few/many args).
|
// Continue to check argument types (even if we have too few/many args).
|
||||||
for (unsigned i = FirstProtoArg; i != NumArgsToCheck; i++) {
|
for (unsigned i = FirstProtoArg; i != NumArgsToCheck; i++) {
|
||||||
QualType ProtoArgType = Proto->getArgType(i);
|
QualType ProtoArgType = Proto->getParamType(i);
|
||||||
|
|
||||||
Expr *Arg;
|
Expr *Arg;
|
||||||
ParmVarDecl *Param;
|
ParmVarDecl *Param;
|
||||||
|
@ -4175,10 +4175,11 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc,
|
||||||
(!Param || !Param->hasAttr<CFConsumedAttr>()))
|
(!Param || !Param->hasAttr<CFConsumedAttr>()))
|
||||||
CFAudited = true;
|
CFAudited = true;
|
||||||
|
|
||||||
InitializedEntity Entity = Param ?
|
InitializedEntity Entity =
|
||||||
InitializedEntity::InitializeParameter(Context, Param, ProtoArgType)
|
Param ? InitializedEntity::InitializeParameter(Context, Param,
|
||||||
: InitializedEntity::InitializeParameter(Context, ProtoArgType,
|
ProtoArgType)
|
||||||
Proto->isArgConsumed(i));
|
: InitializedEntity::InitializeParameter(
|
||||||
|
Context, ProtoArgType, Proto->isParamConsumed(i));
|
||||||
|
|
||||||
// Remember that parameter belongs to a CF audited API.
|
// Remember that parameter belongs to a CF audited API.
|
||||||
if (CFAudited)
|
if (CFAudited)
|
||||||
|
@ -4674,11 +4675,9 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
|
||||||
for (unsigned i = 0, e = Args.size(); i != e; i++) {
|
for (unsigned i = 0, e = Args.size(); i != e; i++) {
|
||||||
Expr *Arg = Args[i];
|
Expr *Arg = Args[i];
|
||||||
|
|
||||||
if (Proto && i < Proto->getNumArgs()) {
|
if (Proto && i < Proto->getNumParams()) {
|
||||||
InitializedEntity Entity
|
InitializedEntity Entity = InitializedEntity::InitializeParameter(
|
||||||
= InitializedEntity::InitializeParameter(Context,
|
Context, Proto->getParamType(i), Proto->isParamConsumed(i));
|
||||||
Proto->getArgType(i),
|
|
||||||
Proto->isArgConsumed(i));
|
|
||||||
ExprResult ArgE = PerformCopyInitialization(Entity,
|
ExprResult ArgE = PerformCopyInitialization(Entity,
|
||||||
SourceLocation(),
|
SourceLocation(),
|
||||||
Owned(Arg));
|
Owned(Arg));
|
||||||
|
@ -10356,8 +10355,9 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
|
||||||
// Fake up parameter variables if we have a typedef, like
|
// Fake up parameter variables if we have a typedef, like
|
||||||
// ^ fntype { ... }
|
// ^ fntype { ... }
|
||||||
} else if (const FunctionProtoType *Fn = T->getAs<FunctionProtoType>()) {
|
} else if (const FunctionProtoType *Fn = T->getAs<FunctionProtoType>()) {
|
||||||
for (FunctionProtoType::arg_type_iterator
|
for (FunctionProtoType::param_type_iterator I = Fn->param_type_begin(),
|
||||||
I = Fn->arg_type_begin(), E = Fn->arg_type_end(); I != E; ++I) {
|
E = Fn->param_type_end();
|
||||||
|
I != E; ++I) {
|
||||||
ParmVarDecl *Param =
|
ParmVarDecl *Param =
|
||||||
BuildParmVarDeclForTypedef(CurBlock->TheDecl,
|
BuildParmVarDeclForTypedef(CurBlock->TheDecl,
|
||||||
ParamInfo.getLocStart(),
|
ParamInfo.getLocStart(),
|
||||||
|
@ -10470,7 +10470,7 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
|
||||||
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
|
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
|
||||||
EPI.TypeQuals = 0; // FIXME: silently?
|
EPI.TypeQuals = 0; // FIXME: silently?
|
||||||
EPI.ExtInfo = Ext;
|
EPI.ExtInfo = Ext;
|
||||||
BlockTy = Context.getFunctionType(RetTy, FPT->getArgTypes(), EPI);
|
BlockTy = Context.getFunctionType(RetTy, FPT->getParamTypes(), EPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we don't have a function type, just build one from nothing.
|
// If we don't have a function type, just build one from nothing.
|
||||||
|
@ -12897,7 +12897,7 @@ ExprResult RebuildUnknownAnyExpr::VisitCallExpr(CallExpr *E) {
|
||||||
// This is a hack, but it is far superior to moving the
|
// This is a hack, but it is far superior to moving the
|
||||||
// corresponding target-specific code from IR-gen to Sema/AST.
|
// corresponding target-specific code from IR-gen to Sema/AST.
|
||||||
|
|
||||||
ArrayRef<QualType> ParamTypes = Proto->getArgTypes();
|
ArrayRef<QualType> ParamTypes = Proto->getParamTypes();
|
||||||
SmallVector<QualType, 8> ArgTypes;
|
SmallVector<QualType, 8> ArgTypes;
|
||||||
if (ParamTypes.empty() && Proto->isVariadic()) { // the special case
|
if (ParamTypes.empty() && Proto->isVariadic()) { // the special case
|
||||||
ArgTypes.reserve(E->getNumArgs());
|
ArgTypes.reserve(E->getNumArgs());
|
||||||
|
|
|
@ -1735,8 +1735,8 @@ bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range,
|
||||||
|
|
||||||
SmallVector<QualType, 4> ArgTypes;
|
SmallVector<QualType, 4> ArgTypes;
|
||||||
ArgTypes.push_back(Context.VoidPtrTy);
|
ArgTypes.push_back(Context.VoidPtrTy);
|
||||||
for (unsigned I = 1, N = Proto->getNumArgs(); I < N; ++I)
|
for (unsigned I = 1, N = Proto->getNumParams(); I < N; ++I)
|
||||||
ArgTypes.push_back(Proto->getArgType(I));
|
ArgTypes.push_back(Proto->getParamType(I));
|
||||||
|
|
||||||
FunctionProtoType::ExtProtoInfo EPI;
|
FunctionProtoType::ExtProtoInfo EPI;
|
||||||
EPI.Variadic = Proto->isVariadic();
|
EPI.Variadic = Proto->isVariadic();
|
||||||
|
@ -3513,7 +3513,7 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT,
|
||||||
return false;
|
return false;
|
||||||
// TODO: check whether evaluating default arguments can throw.
|
// TODO: check whether evaluating default arguments can throw.
|
||||||
// For now, we'll be conservative and assume that they can throw.
|
// For now, we'll be conservative and assume that they can throw.
|
||||||
if (!CPT->isNothrow(Self.Context) || CPT->getNumArgs() > 1)
|
if (!CPT->isNothrow(Self.Context) || CPT->getNumParams() > 1)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3551,7 +3551,7 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT,
|
||||||
return false;
|
return false;
|
||||||
// FIXME: check whether evaluating default arguments can throw.
|
// FIXME: check whether evaluating default arguments can throw.
|
||||||
// For now, we'll be conservative and assume that they can throw.
|
// For now, we'll be conservative and assume that they can throw.
|
||||||
if (!CPT->isNothrow(Self.Context) || CPT->getNumArgs() > 0)
|
if (!CPT->isNothrow(Self.Context) || CPT->getNumParams() > 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,7 +367,7 @@ CXXMethodDecl *Sema::startLambdaDefinition(CXXRecordDecl *Class,
|
||||||
QualType Result = FPT->getResultType();
|
QualType Result = FPT->getResultType();
|
||||||
if (Result->isUndeducedType()) {
|
if (Result->isUndeducedType()) {
|
||||||
Result = SubstAutoType(Result, Context.DependentTy);
|
Result = SubstAutoType(Result, Context.DependentTy);
|
||||||
MethodType = Context.getFunctionType(Result, FPT->getArgTypes(),
|
MethodType = Context.getFunctionType(Result, FPT->getParamTypes(),
|
||||||
FPT->getExtProtoInfo());
|
FPT->getExtProtoInfo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1164,8 +1164,9 @@ static void addFunctionPointerConversion(Sema &S,
|
||||||
InvokerExtInfo.TypeQuals = 0;
|
InvokerExtInfo.TypeQuals = 0;
|
||||||
assert(InvokerExtInfo.RefQualifier == RQ_None &&
|
assert(InvokerExtInfo.RefQualifier == RQ_None &&
|
||||||
"Lambda's call operator should not have a reference qualifier");
|
"Lambda's call operator should not have a reference qualifier");
|
||||||
InvokerFunctionTy = S.Context.getFunctionType(CallOpProto->getResultType(),
|
InvokerFunctionTy =
|
||||||
CallOpProto->getArgTypes(), InvokerExtInfo);
|
S.Context.getFunctionType(CallOpProto->getResultType(),
|
||||||
|
CallOpProto->getParamTypes(), InvokerExtInfo);
|
||||||
PtrToFunctionTy = S.Context.getPointerType(InvokerFunctionTy);
|
PtrToFunctionTy = S.Context.getPointerType(InvokerFunctionTy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1331,7 +1332,7 @@ static void addBlockPointerConversion(Sema &S,
|
||||||
FunctionProtoType::ExtProtoInfo ExtInfo = Proto->getExtProtoInfo();
|
FunctionProtoType::ExtProtoInfo ExtInfo = Proto->getExtProtoInfo();
|
||||||
ExtInfo.TypeQuals = 0;
|
ExtInfo.TypeQuals = 0;
|
||||||
QualType FunctionTy = S.Context.getFunctionType(
|
QualType FunctionTy = S.Context.getFunctionType(
|
||||||
Proto->getResultType(), Proto->getArgTypes(), ExtInfo);
|
Proto->getResultType(), Proto->getParamTypes(), ExtInfo);
|
||||||
BlockPtrTy = S.Context.getBlockPointerType(FunctionTy);
|
BlockPtrTy = S.Context.getBlockPointerType(FunctionTy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1456,7 +1457,7 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body,
|
||||||
const FunctionProtoType *Proto
|
const FunctionProtoType *Proto
|
||||||
= CallOperator->getType()->getAs<FunctionProtoType>();
|
= CallOperator->getType()->getAs<FunctionProtoType>();
|
||||||
QualType FunctionTy = Context.getFunctionType(
|
QualType FunctionTy = Context.getFunctionType(
|
||||||
LSI->ReturnType, Proto->getArgTypes(), Proto->getExtProtoInfo());
|
LSI->ReturnType, Proto->getParamTypes(), Proto->getExtProtoInfo());
|
||||||
CallOperator->setType(FunctionTy);
|
CallOperator->setType(FunctionTy);
|
||||||
}
|
}
|
||||||
// C++ [expr.prim.lambda]p7:
|
// C++ [expr.prim.lambda]p7:
|
||||||
|
|
|
@ -2193,8 +2193,9 @@ addAssociatedClassesAndNamespaces(AssociatedLookup &Result, QualType Ty) {
|
||||||
// types and those associated with the return type.
|
// types and those associated with the return type.
|
||||||
case Type::FunctionProto: {
|
case Type::FunctionProto: {
|
||||||
const FunctionProtoType *Proto = cast<FunctionProtoType>(T);
|
const FunctionProtoType *Proto = cast<FunctionProtoType>(T);
|
||||||
for (FunctionProtoType::arg_type_iterator Arg = Proto->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator
|
||||||
ArgEnd = Proto->arg_type_end();
|
Arg = Proto->param_type_begin(),
|
||||||
|
ArgEnd = Proto->param_type_end();
|
||||||
Arg != ArgEnd; ++Arg)
|
Arg != ArgEnd; ++Arg)
|
||||||
Queue.push_back(Arg->getTypePtr());
|
Queue.push_back(Arg->getTypePtr());
|
||||||
// fallthrough
|
// fallthrough
|
||||||
|
@ -2348,20 +2349,20 @@ IsAcceptableNonMemberOperatorCandidate(FunctionDecl *Fn,
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
const FunctionProtoType *Proto = Fn->getType()->getAs<FunctionProtoType>();
|
const FunctionProtoType *Proto = Fn->getType()->getAs<FunctionProtoType>();
|
||||||
if (Proto->getNumArgs() < 1)
|
if (Proto->getNumParams() < 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (T1->isEnumeralType()) {
|
if (T1->isEnumeralType()) {
|
||||||
QualType ArgType = Proto->getArgType(0).getNonReferenceType();
|
QualType ArgType = Proto->getParamType(0).getNonReferenceType();
|
||||||
if (Context.hasSameUnqualifiedType(T1, ArgType))
|
if (Context.hasSameUnqualifiedType(T1, ArgType))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Proto->getNumArgs() < 2)
|
if (Proto->getNumParams() < 2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!T2.isNull() && T2->isEnumeralType()) {
|
if (!T2.isNull() && T2->isEnumeralType()) {
|
||||||
QualType ArgType = Proto->getArgType(1).getNonReferenceType();
|
QualType ArgType = Proto->getParamType(1).getNonReferenceType();
|
||||||
if (Context.hasSameUnqualifiedType(T2, ArgType))
|
if (Context.hasSameUnqualifiedType(T2, ArgType))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -4590,7 +4591,7 @@ bool FunctionCallFilterCCC::ValidateCandidate(const TypoCorrection &candidate) {
|
||||||
if (ValType->isAnyPointerType() || ValType->isReferenceType())
|
if (ValType->isAnyPointerType() || ValType->isReferenceType())
|
||||||
ValType = ValType->getPointeeType();
|
ValType = ValType->getPointeeType();
|
||||||
if (const FunctionProtoType *FPT = ValType->getAs<FunctionProtoType>())
|
if (const FunctionProtoType *FPT = ValType->getAs<FunctionProtoType>())
|
||||||
if (FPT->getNumArgs() == NumArgs)
|
if (FPT->getNumParams() == NumArgs)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1015,9 +1015,9 @@ bool Sema::IsOverload(FunctionDecl *New, FunctionDecl *Old,
|
||||||
// parameters (C++ 1.3.10), which includes the presence or absence
|
// parameters (C++ 1.3.10), which includes the presence or absence
|
||||||
// of the ellipsis; see C++ DR 357).
|
// of the ellipsis; see C++ DR 357).
|
||||||
if (OldQType != NewQType &&
|
if (OldQType != NewQType &&
|
||||||
(OldType->getNumArgs() != NewType->getNumArgs() ||
|
(OldType->getNumParams() != NewType->getNumParams() ||
|
||||||
OldType->isVariadic() != NewType->isVariadic() ||
|
OldType->isVariadic() != NewType->isVariadic() ||
|
||||||
!FunctionArgTypesAreEqual(OldType, NewType)))
|
!FunctionParamTypesAreEqual(OldType, NewType)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// C++ [temp.over.link]p4:
|
// C++ [temp.over.link]p4:
|
||||||
|
@ -2305,7 +2305,7 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
|
||||||
|
|
||||||
// Perform the quick checks that will tell us whether these
|
// Perform the quick checks that will tell us whether these
|
||||||
// function types are obviously different.
|
// function types are obviously different.
|
||||||
if (FromFunctionType->getNumArgs() != ToFunctionType->getNumArgs() ||
|
if (FromFunctionType->getNumParams() != ToFunctionType->getNumParams() ||
|
||||||
FromFunctionType->isVariadic() != ToFunctionType->isVariadic() ||
|
FromFunctionType->isVariadic() != ToFunctionType->isVariadic() ||
|
||||||
FromFunctionType->getTypeQuals() != ToFunctionType->getTypeQuals())
|
FromFunctionType->getTypeQuals() != ToFunctionType->getTypeQuals())
|
||||||
return false;
|
return false;
|
||||||
|
@ -2325,10 +2325,10 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check argument types.
|
// Check argument types.
|
||||||
for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumArgs();
|
for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumParams();
|
||||||
ArgIdx != NumArgs; ++ArgIdx) {
|
ArgIdx != NumArgs; ++ArgIdx) {
|
||||||
QualType FromArgType = FromFunctionType->getArgType(ArgIdx);
|
QualType FromArgType = FromFunctionType->getParamType(ArgIdx);
|
||||||
QualType ToArgType = ToFunctionType->getArgType(ArgIdx);
|
QualType ToArgType = ToFunctionType->getParamType(ArgIdx);
|
||||||
if (Context.getCanonicalType(FromArgType)
|
if (Context.getCanonicalType(FromArgType)
|
||||||
== Context.getCanonicalType(ToArgType)) {
|
== Context.getCanonicalType(ToArgType)) {
|
||||||
// Okay, the types match exactly. Nothing to do.
|
// Okay, the types match exactly. Nothing to do.
|
||||||
|
@ -2453,7 +2453,7 @@ bool Sema::IsBlockPointerConversion(QualType FromType, QualType ToType,
|
||||||
|
|
||||||
// Perform the quick checks that will tell us whether these
|
// Perform the quick checks that will tell us whether these
|
||||||
// function types are obviously different.
|
// function types are obviously different.
|
||||||
if (FromFunctionType->getNumArgs() != ToFunctionType->getNumArgs() ||
|
if (FromFunctionType->getNumParams() != ToFunctionType->getNumParams() ||
|
||||||
FromFunctionType->isVariadic() != ToFunctionType->isVariadic())
|
FromFunctionType->isVariadic() != ToFunctionType->isVariadic())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -2486,11 +2486,11 @@ bool Sema::IsBlockPointerConversion(QualType FromType, QualType ToType,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check argument types.
|
// Check argument types.
|
||||||
for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumArgs();
|
for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumParams();
|
||||||
ArgIdx != NumArgs; ++ArgIdx) {
|
ArgIdx != NumArgs; ++ArgIdx) {
|
||||||
IncompatibleObjC = false;
|
IncompatibleObjC = false;
|
||||||
QualType FromArgType = FromFunctionType->getArgType(ArgIdx);
|
QualType FromArgType = FromFunctionType->getParamType(ArgIdx);
|
||||||
QualType ToArgType = ToFunctionType->getArgType(ArgIdx);
|
QualType ToArgType = ToFunctionType->getParamType(ArgIdx);
|
||||||
if (Context.hasSameType(FromArgType, ToArgType)) {
|
if (Context.hasSameType(FromArgType, ToArgType)) {
|
||||||
// Okay, the types match exactly. Nothing to do.
|
// Okay, the types match exactly. Nothing to do.
|
||||||
} else if (isObjCPointerConversion(ToArgType, FromArgType,
|
} else if (isObjCPointerConversion(ToArgType, FromArgType,
|
||||||
|
@ -2575,18 +2575,18 @@ void Sema::HandleFunctionTypeMismatch(PartialDiagnostic &PDiag,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FromFunction->getNumArgs() != ToFunction->getNumArgs()) {
|
if (FromFunction->getNumParams() != ToFunction->getNumParams()) {
|
||||||
PDiag << ft_parameter_arity << ToFunction->getNumArgs()
|
PDiag << ft_parameter_arity << ToFunction->getNumParams()
|
||||||
<< FromFunction->getNumArgs();
|
<< FromFunction->getNumParams();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle different parameter types.
|
// Handle different parameter types.
|
||||||
unsigned ArgPos;
|
unsigned ArgPos;
|
||||||
if (!FunctionArgTypesAreEqual(FromFunction, ToFunction, &ArgPos)) {
|
if (!FunctionParamTypesAreEqual(FromFunction, ToFunction, &ArgPos)) {
|
||||||
PDiag << ft_parameter_mismatch << ArgPos + 1
|
PDiag << ft_parameter_mismatch << ArgPos + 1
|
||||||
<< ToFunction->getArgType(ArgPos)
|
<< ToFunction->getParamType(ArgPos)
|
||||||
<< FromFunction->getArgType(ArgPos);
|
<< FromFunction->getParamType(ArgPos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2609,19 +2609,21 @@ void Sema::HandleFunctionTypeMismatch(PartialDiagnostic &PDiag,
|
||||||
PDiag << ft_default;
|
PDiag << ft_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// FunctionArgTypesAreEqual - This routine checks two function proto types
|
/// FunctionParamTypesAreEqual - This routine checks two function proto types
|
||||||
/// for equality of their argument types. Caller has already checked that
|
/// for equality of their argument types. Caller has already checked that
|
||||||
/// they have same number of arguments. If the parameters are different,
|
/// they have same number of arguments. If the parameters are different,
|
||||||
/// ArgPos will have the parameter index of the first different parameter.
|
/// ArgPos will have the parameter index of the first different parameter.
|
||||||
bool Sema::FunctionArgTypesAreEqual(const FunctionProtoType *OldType,
|
bool Sema::FunctionParamTypesAreEqual(const FunctionProtoType *OldType,
|
||||||
const FunctionProtoType *NewType,
|
const FunctionProtoType *NewType,
|
||||||
unsigned *ArgPos) {
|
unsigned *ArgPos) {
|
||||||
for (FunctionProtoType::arg_type_iterator O = OldType->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator O = OldType->param_type_begin(),
|
||||||
N = NewType->arg_type_begin(),
|
N = NewType->param_type_begin(),
|
||||||
E = OldType->arg_type_end(); O && (O != E); ++O, ++N) {
|
E = OldType->param_type_end();
|
||||||
|
O && (O != E); ++O, ++N) {
|
||||||
if (!Context.hasSameType(O->getUnqualifiedType(),
|
if (!Context.hasSameType(O->getUnqualifiedType(),
|
||||||
N->getUnqualifiedType())) {
|
N->getUnqualifiedType())) {
|
||||||
if (ArgPos) *ArgPos = O - OldType->arg_type_begin();
|
if (ArgPos)
|
||||||
|
*ArgPos = O - OldType->param_type_begin();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2936,8 +2938,8 @@ static bool isFirstArgumentCompatibleWithType(ASTContext &Context,
|
||||||
QualType Type) {
|
QualType Type) {
|
||||||
const FunctionProtoType *CtorType =
|
const FunctionProtoType *CtorType =
|
||||||
Constructor->getType()->getAs<FunctionProtoType>();
|
Constructor->getType()->getAs<FunctionProtoType>();
|
||||||
if (CtorType->getNumArgs() > 0) {
|
if (CtorType->getNumParams() > 0) {
|
||||||
QualType FirstArg = CtorType->getArgType(0);
|
QualType FirstArg = CtorType->getParamType(0);
|
||||||
if (Context.hasSameUnqualifiedType(Type, FirstArg.getNonReferenceType()))
|
if (Context.hasSameUnqualifiedType(Type, FirstArg.getNonReferenceType()))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -5560,7 +5562,7 @@ Sema::AddOverloadCandidate(FunctionDecl *Function,
|
||||||
Candidate.IgnoreObjectArgument = false;
|
Candidate.IgnoreObjectArgument = false;
|
||||||
Candidate.ExplicitCallArguments = Args.size();
|
Candidate.ExplicitCallArguments = Args.size();
|
||||||
|
|
||||||
unsigned NumArgsInProto = Proto->getNumArgs();
|
unsigned NumArgsInProto = Proto->getNumParams();
|
||||||
|
|
||||||
// (C++ 13.3.2p2): A candidate function having fewer than m
|
// (C++ 13.3.2p2): A candidate function having fewer than m
|
||||||
// parameters is viable only if it has an ellipsis in its parameter
|
// parameters is viable only if it has an ellipsis in its parameter
|
||||||
|
@ -5602,7 +5604,7 @@ Sema::AddOverloadCandidate(FunctionDecl *Function,
|
||||||
// exist for each argument an implicit conversion sequence
|
// exist for each argument an implicit conversion sequence
|
||||||
// (13.3.3.1) that converts that argument to the corresponding
|
// (13.3.3.1) that converts that argument to the corresponding
|
||||||
// parameter of F.
|
// parameter of F.
|
||||||
QualType ParamType = Proto->getArgType(ArgIdx);
|
QualType ParamType = Proto->getParamType(ArgIdx);
|
||||||
Candidate.Conversions[ArgIdx]
|
Candidate.Conversions[ArgIdx]
|
||||||
= TryCopyInitialization(*this, Args[ArgIdx], ParamType,
|
= TryCopyInitialization(*this, Args[ArgIdx], ParamType,
|
||||||
SuppressUserConversions,
|
SuppressUserConversions,
|
||||||
|
@ -5803,7 +5805,7 @@ Sema::AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl,
|
||||||
Candidate.IgnoreObjectArgument = false;
|
Candidate.IgnoreObjectArgument = false;
|
||||||
Candidate.ExplicitCallArguments = Args.size();
|
Candidate.ExplicitCallArguments = Args.size();
|
||||||
|
|
||||||
unsigned NumArgsInProto = Proto->getNumArgs();
|
unsigned NumArgsInProto = Proto->getNumParams();
|
||||||
|
|
||||||
// (C++ 13.3.2p2): A candidate function having fewer than m
|
// (C++ 13.3.2p2): A candidate function having fewer than m
|
||||||
// parameters is viable only if it has an ellipsis in its parameter
|
// parameters is viable only if it has an ellipsis in its parameter
|
||||||
|
@ -5853,7 +5855,7 @@ Sema::AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl,
|
||||||
// exist for each argument an implicit conversion sequence
|
// exist for each argument an implicit conversion sequence
|
||||||
// (13.3.3.1) that converts that argument to the corresponding
|
// (13.3.3.1) that converts that argument to the corresponding
|
||||||
// parameter of F.
|
// parameter of F.
|
||||||
QualType ParamType = Proto->getArgType(ArgIdx);
|
QualType ParamType = Proto->getParamType(ArgIdx);
|
||||||
Candidate.Conversions[ArgIdx + 1]
|
Candidate.Conversions[ArgIdx + 1]
|
||||||
= TryCopyInitialization(*this, Args[ArgIdx], ParamType,
|
= TryCopyInitialization(*this, Args[ArgIdx], ParamType,
|
||||||
SuppressUserConversions,
|
SuppressUserConversions,
|
||||||
|
@ -6285,7 +6287,7 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion,
|
||||||
Candidate.Conversions[0].UserDefined.After.setAsIdentityConversion();
|
Candidate.Conversions[0].UserDefined.After.setAsIdentityConversion();
|
||||||
|
|
||||||
// Find the
|
// Find the
|
||||||
unsigned NumArgsInProto = Proto->getNumArgs();
|
unsigned NumArgsInProto = Proto->getNumParams();
|
||||||
|
|
||||||
// (C++ 13.3.2p2): A candidate function having fewer than m
|
// (C++ 13.3.2p2): A candidate function having fewer than m
|
||||||
// parameters is viable only if it has an ellipsis in its parameter
|
// parameters is viable only if it has an ellipsis in its parameter
|
||||||
|
@ -6313,7 +6315,7 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion,
|
||||||
// exist for each argument an implicit conversion sequence
|
// exist for each argument an implicit conversion sequence
|
||||||
// (13.3.3.1) that converts that argument to the corresponding
|
// (13.3.3.1) that converts that argument to the corresponding
|
||||||
// parameter of F.
|
// parameter of F.
|
||||||
QualType ParamType = Proto->getArgType(ArgIdx);
|
QualType ParamType = Proto->getParamType(ArgIdx);
|
||||||
Candidate.Conversions[ArgIdx + 1]
|
Candidate.Conversions[ArgIdx + 1]
|
||||||
= TryCopyInitialization(*this, Args[ArgIdx], ParamType,
|
= TryCopyInitialization(*this, Args[ArgIdx], ParamType,
|
||||||
/*SuppressUserConversions=*/false,
|
/*SuppressUserConversions=*/false,
|
||||||
|
@ -8739,18 +8741,18 @@ void DiagnoseArityMismatch(Sema &S, Decl *D, unsigned NumFormalArgs) {
|
||||||
// at least / at most / exactly
|
// at least / at most / exactly
|
||||||
unsigned mode, modeCount;
|
unsigned mode, modeCount;
|
||||||
if (NumFormalArgs < MinParams) {
|
if (NumFormalArgs < MinParams) {
|
||||||
if (MinParams != FnTy->getNumArgs() ||
|
if (MinParams != FnTy->getNumParams() || FnTy->isVariadic() ||
|
||||||
FnTy->isVariadic() || FnTy->isTemplateVariadic())
|
FnTy->isTemplateVariadic())
|
||||||
mode = 0; // "at least"
|
mode = 0; // "at least"
|
||||||
else
|
else
|
||||||
mode = 2; // "exactly"
|
mode = 2; // "exactly"
|
||||||
modeCount = MinParams;
|
modeCount = MinParams;
|
||||||
} else {
|
} else {
|
||||||
if (MinParams != FnTy->getNumArgs())
|
if (MinParams != FnTy->getNumParams())
|
||||||
mode = 1; // "at most"
|
mode = 1; // "at most"
|
||||||
else
|
else
|
||||||
mode = 2; // "exactly"
|
mode = 2; // "exactly"
|
||||||
modeCount = FnTy->getNumArgs();
|
modeCount = FnTy->getNumParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Description;
|
std::string Description;
|
||||||
|
@ -9354,12 +9356,11 @@ void CompleteNonViableCandidate(Sema &S, OverloadCandidate *Cand,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in the rest of the conversions.
|
// Fill in the rest of the conversions.
|
||||||
unsigned NumArgsInProto = Proto->getNumArgs();
|
unsigned NumArgsInProto = Proto->getNumParams();
|
||||||
for (; ConvIdx != ConvCount; ++ConvIdx, ++ArgIdx) {
|
for (; ConvIdx != ConvCount; ++ConvIdx, ++ArgIdx) {
|
||||||
if (ArgIdx < NumArgsInProto) {
|
if (ArgIdx < NumArgsInProto) {
|
||||||
Cand->Conversions[ConvIdx]
|
Cand->Conversions[ConvIdx] = TryCopyInitialization(
|
||||||
= TryCopyInitialization(S, Args[ArgIdx], Proto->getArgType(ArgIdx),
|
S, Args[ArgIdx], Proto->getParamType(ArgIdx), SuppressUserConversions,
|
||||||
SuppressUserConversions,
|
|
||||||
/*InOverloadResolution=*/true,
|
/*InOverloadResolution=*/true,
|
||||||
/*AllowObjCWritebackConversion=*/
|
/*AllowObjCWritebackConversion=*/
|
||||||
S.getLangOpts().ObjCAutoRefCount);
|
S.getLangOpts().ObjCAutoRefCount);
|
||||||
|
@ -11683,7 +11684,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
|
||||||
const FunctionProtoType *Proto =
|
const FunctionProtoType *Proto =
|
||||||
Method->getType()->getAs<FunctionProtoType>();
|
Method->getType()->getAs<FunctionProtoType>();
|
||||||
|
|
||||||
unsigned NumArgsInProto = Proto->getNumArgs();
|
unsigned NumArgsInProto = Proto->getNumParams();
|
||||||
|
|
||||||
DeclarationNameInfo OpLocInfo(
|
DeclarationNameInfo OpLocInfo(
|
||||||
Context.DeclarationNames.getCXXOperatorName(OO_Call), LParenLoc);
|
Context.DeclarationNames.getCXXOperatorName(OO_Call), LParenLoc);
|
||||||
|
|
|
@ -3892,8 +3892,8 @@ bool UnnamedLocalNoLinkageFinder::VisitExtVectorType(const ExtVectorType* T) {
|
||||||
|
|
||||||
bool UnnamedLocalNoLinkageFinder::VisitFunctionProtoType(
|
bool UnnamedLocalNoLinkageFinder::VisitFunctionProtoType(
|
||||||
const FunctionProtoType* T) {
|
const FunctionProtoType* T) {
|
||||||
for (FunctionProtoType::arg_type_iterator A = T->arg_type_begin(),
|
for (FunctionProtoType::param_type_iterator A = T->param_type_begin(),
|
||||||
AEnd = T->arg_type_end();
|
AEnd = T->param_type_end();
|
||||||
A != AEnd; ++A) {
|
A != AEnd; ++A) {
|
||||||
if (Visit(*A))
|
if (Visit(*A))
|
||||||
return true;
|
return true;
|
||||||
|
@ -6514,8 +6514,8 @@ bool Sema::CheckFunctionTemplateSpecialization(
|
||||||
const FunctionProtoType *FPT = FT->castAs<FunctionProtoType>();
|
const FunctionProtoType *FPT = FT->castAs<FunctionProtoType>();
|
||||||
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
|
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
|
||||||
EPI.TypeQuals |= Qualifiers::Const;
|
EPI.TypeQuals |= Qualifiers::Const;
|
||||||
FT = Context.getFunctionType(FPT->getResultType(), FPT->getArgTypes(),
|
FT = Context.getFunctionType(FPT->getResultType(),
|
||||||
EPI);
|
FPT->getParamTypes(), EPI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1382,12 +1382,11 @@ DeduceTemplateArgumentsByTypeMatch(Sema &S,
|
||||||
Info, Deduced, 0))
|
Info, Deduced, 0))
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
return DeduceTemplateArguments(S, TemplateParams,
|
return DeduceTemplateArguments(
|
||||||
FunctionProtoParam->arg_type_begin(),
|
S, TemplateParams, FunctionProtoParam->param_type_begin(),
|
||||||
FunctionProtoParam->getNumArgs(),
|
FunctionProtoParam->getNumParams(),
|
||||||
FunctionProtoArg->arg_type_begin(),
|
FunctionProtoArg->param_type_begin(),
|
||||||
FunctionProtoArg->getNumArgs(),
|
FunctionProtoArg->getNumParams(), Info, Deduced, SubTDF);
|
||||||
Info, Deduced, SubTDF);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case Type::InjectedClassName: {
|
case Type::InjectedClassName: {
|
||||||
|
@ -3751,7 +3750,7 @@ SpecializeCorrespondingLambdaCallOperatorAndInvoker(
|
||||||
FunctionProtoType::ExtProtoInfo EPI = InvokerFPT->getExtProtoInfo();
|
FunctionProtoType::ExtProtoInfo EPI = InvokerFPT->getExtProtoInfo();
|
||||||
EPI.TypeQuals = 0;
|
EPI.TypeQuals = 0;
|
||||||
InvokerSpecialized->setType(S.Context.getFunctionType(
|
InvokerSpecialized->setType(S.Context.getFunctionType(
|
||||||
InvokerFPT->getResultType(), InvokerFPT->getArgTypes(),EPI));
|
InvokerFPT->getResultType(), InvokerFPT->getParamTypes(), EPI));
|
||||||
return Sema::TDK_Success;
|
return Sema::TDK_Success;
|
||||||
}
|
}
|
||||||
/// \brief Deduce template arguments for a templated conversion
|
/// \brief Deduce template arguments for a templated conversion
|
||||||
|
@ -4231,10 +4230,10 @@ static bool isAtLeastAsSpecializedAs(Sema &S,
|
||||||
++Skip1;
|
++Skip1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Args1.insert(Args1.end(),
|
Args1.insert(Args1.end(), Proto1->param_type_begin() + Skip1,
|
||||||
Proto1->arg_type_begin() + Skip1, Proto1->arg_type_end());
|
Proto1->param_type_end());
|
||||||
Args2.insert(Args2.end(),
|
Args2.insert(Args2.end(), Proto2->param_type_begin() + Skip2,
|
||||||
Proto2->arg_type_begin() + Skip2, Proto2->arg_type_end());
|
Proto2->param_type_end());
|
||||||
|
|
||||||
// C++ [temp.func.order]p5:
|
// C++ [temp.func.order]p5:
|
||||||
// The presence of unused ellipsis and default arguments has no effect on
|
// The presence of unused ellipsis and default arguments has no effect on
|
||||||
|
@ -4883,8 +4882,8 @@ MarkUsedTemplateParameters(ASTContext &Ctx, QualType T,
|
||||||
const FunctionProtoType *Proto = cast<FunctionProtoType>(T);
|
const FunctionProtoType *Proto = cast<FunctionProtoType>(T);
|
||||||
MarkUsedTemplateParameters(Ctx, Proto->getResultType(), OnlyDeduced,
|
MarkUsedTemplateParameters(Ctx, Proto->getResultType(), OnlyDeduced,
|
||||||
Depth, Used);
|
Depth, Used);
|
||||||
for (unsigned I = 0, N = Proto->getNumArgs(); I != N; ++I)
|
for (unsigned I = 0, N = Proto->getNumParams(); I != N; ++I)
|
||||||
MarkUsedTemplateParameters(Ctx, Proto->getArgType(I), OnlyDeduced,
|
MarkUsedTemplateParameters(Ctx, Proto->getParamType(I), OnlyDeduced,
|
||||||
Depth, Used);
|
Depth, Used);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1218,7 +1218,7 @@ static QualType adjustFunctionTypeForInstantiation(ASTContext &Context,
|
||||||
FunctionProtoType::ExtProtoInfo NewEPI = NewFunc->getExtProtoInfo();
|
FunctionProtoType::ExtProtoInfo NewEPI = NewFunc->getExtProtoInfo();
|
||||||
NewEPI.ExtInfo = OrigFunc->getExtInfo();
|
NewEPI.ExtInfo = OrigFunc->getExtInfo();
|
||||||
return Context.getFunctionType(NewFunc->getResultType(),
|
return Context.getFunctionType(NewFunc->getResultType(),
|
||||||
NewFunc->getArgTypes(), NewEPI);
|
NewFunc->getParamTypes(), NewEPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Normal class members are of more specific types and therefore
|
/// Normal class members are of more specific types and therefore
|
||||||
|
@ -2969,7 +2969,7 @@ TemplateDeclInstantiator::SubstFunctionType(FunctionDecl *D,
|
||||||
ParmVarDecl *OldParam = OldProtoLoc.getArg(i);
|
ParmVarDecl *OldParam = OldProtoLoc.getArg(i);
|
||||||
if (!OldParam) {
|
if (!OldParam) {
|
||||||
Params.push_back(SemaRef.BuildParmVarDeclForTypedef(
|
Params.push_back(SemaRef.BuildParmVarDeclForTypedef(
|
||||||
D, D->getLocation(), OldProto->getArgType(i)));
|
D, D->getLocation(), OldProto->getParamType(i)));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3160,7 +3160,7 @@ static void InstantiateExceptionSpec(Sema &SemaRef, FunctionDecl *New,
|
||||||
EPI.NoexceptExpr = NoexceptExpr;
|
EPI.NoexceptExpr = NoexceptExpr;
|
||||||
|
|
||||||
New->setType(SemaRef.Context.getFunctionType(NewProto->getResultType(),
|
New->setType(SemaRef.Context.getFunctionType(NewProto->getResultType(),
|
||||||
NewProto->getArgTypes(), EPI));
|
NewProto->getParamTypes(), EPI));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sema::InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
|
void Sema::InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
|
||||||
|
@ -3177,7 +3177,7 @@ void Sema::InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
|
||||||
FunctionProtoType::ExtProtoInfo EPI = Proto->getExtProtoInfo();
|
FunctionProtoType::ExtProtoInfo EPI = Proto->getExtProtoInfo();
|
||||||
EPI.ExceptionSpecType = EST_None;
|
EPI.ExceptionSpecType = EST_None;
|
||||||
Decl->setType(Context.getFunctionType(Proto->getResultType(),
|
Decl->setType(Context.getFunctionType(Proto->getResultType(),
|
||||||
Proto->getArgTypes(), EPI));
|
Proto->getParamTypes(), EPI));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3261,7 +3261,7 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New,
|
||||||
EPI.ExceptionSpecDecl = New;
|
EPI.ExceptionSpecDecl = New;
|
||||||
EPI.ExceptionSpecTemplate = ExceptionSpecTemplate;
|
EPI.ExceptionSpecTemplate = ExceptionSpecTemplate;
|
||||||
New->setType(SemaRef.Context.getFunctionType(
|
New->setType(SemaRef.Context.getFunctionType(
|
||||||
NewProto->getResultType(), NewProto->getArgTypes(), EPI));
|
NewProto->getResultType(), NewProto->getParamTypes(), EPI));
|
||||||
} else {
|
} else {
|
||||||
::InstantiateExceptionSpec(SemaRef, New, Proto, TemplateArgs);
|
::InstantiateExceptionSpec(SemaRef, New, Proto, TemplateArgs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3114,7 +3114,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
|
||||||
EPI.TypeQuals = 0;
|
EPI.TypeQuals = 0;
|
||||||
EPI.RefQualifier = RQ_None;
|
EPI.RefQualifier = RQ_None;
|
||||||
|
|
||||||
T = Context.getFunctionType(FnTy->getResultType(), FnTy->getArgTypes(),
|
T = Context.getFunctionType(FnTy->getResultType(), FnTy->getParamTypes(),
|
||||||
EPI);
|
EPI);
|
||||||
// Rebuild any parens around the identifier in the function type.
|
// Rebuild any parens around the identifier in the function type.
|
||||||
for (unsigned i = 0, e = D.getNumTypeObjects(); i != e; ++i) {
|
for (unsigned i = 0, e = D.getNumTypeObjects(); i != e; ++i) {
|
||||||
|
|
|
@ -4356,11 +4356,9 @@ TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder &TLB,
|
||||||
QualType ResultType;
|
QualType ResultType;
|
||||||
|
|
||||||
if (T->hasTrailingReturn()) {
|
if (T->hasTrailingReturn()) {
|
||||||
if (getDerived().TransformFunctionTypeParams(TL.getBeginLoc(),
|
if (getDerived().TransformFunctionTypeParams(
|
||||||
TL.getParmArray(),
|
TL.getBeginLoc(), TL.getParmArray(), TL.getNumArgs(),
|
||||||
TL.getNumArgs(),
|
TL.getTypePtr()->param_type_begin(), ParamTypes, &ParamDecls))
|
||||||
TL.getTypePtr()->arg_type_begin(),
|
|
||||||
ParamTypes, &ParamDecls))
|
|
||||||
return QualType();
|
return QualType();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -4382,21 +4380,19 @@ TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder &TLB,
|
||||||
if (ResultType.isNull())
|
if (ResultType.isNull())
|
||||||
return QualType();
|
return QualType();
|
||||||
|
|
||||||
if (getDerived().TransformFunctionTypeParams(TL.getBeginLoc(),
|
if (getDerived().TransformFunctionTypeParams(
|
||||||
TL.getParmArray(),
|
TL.getBeginLoc(), TL.getParmArray(), TL.getNumArgs(),
|
||||||
TL.getNumArgs(),
|
TL.getTypePtr()->param_type_begin(), ParamTypes, &ParamDecls))
|
||||||
TL.getTypePtr()->arg_type_begin(),
|
|
||||||
ParamTypes, &ParamDecls))
|
|
||||||
return QualType();
|
return QualType();
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Need to transform the exception-specification too.
|
// FIXME: Need to transform the exception-specification too.
|
||||||
|
|
||||||
QualType Result = TL.getType();
|
QualType Result = TL.getType();
|
||||||
if (getDerived().AlwaysRebuild() ||
|
if (getDerived().AlwaysRebuild() || ResultType != T->getResultType() ||
|
||||||
ResultType != T->getResultType() ||
|
T->getNumParams() != ParamTypes.size() ||
|
||||||
T->getNumArgs() != ParamTypes.size() ||
|
!std::equal(T->param_type_begin(), T->param_type_end(),
|
||||||
!std::equal(T->arg_type_begin(), T->arg_type_end(), ParamTypes.begin())) {
|
ParamTypes.begin())) {
|
||||||
Result = getDerived().RebuildFunctionProtoType(ResultType, ParamTypes,
|
Result = getDerived().RebuildFunctionProtoType(ResultType, ParamTypes,
|
||||||
T->getExtProtoInfo());
|
T->getExtProtoInfo());
|
||||||
if (Result.isNull())
|
if (Result.isNull())
|
||||||
|
|
|
@ -196,9 +196,9 @@ void ASTTypeWriter::VisitFunctionNoProtoType(const FunctionNoProtoType *T) {
|
||||||
|
|
||||||
void ASTTypeWriter::VisitFunctionProtoType(const FunctionProtoType *T) {
|
void ASTTypeWriter::VisitFunctionProtoType(const FunctionProtoType *T) {
|
||||||
VisitFunctionType(T);
|
VisitFunctionType(T);
|
||||||
Record.push_back(T->getNumArgs());
|
Record.push_back(T->getNumParams());
|
||||||
for (unsigned I = 0, N = T->getNumArgs(); I != N; ++I)
|
for (unsigned I = 0, N = T->getNumParams(); I != N; ++I)
|
||||||
Writer.AddTypeRef(T->getArgType(I), Record);
|
Writer.AddTypeRef(T->getParamType(I), Record);
|
||||||
Record.push_back(T->isVariadic());
|
Record.push_back(T->isVariadic());
|
||||||
Record.push_back(T->hasTrailingReturn());
|
Record.push_back(T->hasTrailingReturn());
|
||||||
Record.push_back(T->getTypeQuals());
|
Record.push_back(T->getTypeQuals());
|
||||||
|
|
|
@ -302,11 +302,11 @@ void WalkAST::checkCall_gets(const CallExpr *CE, const FunctionDecl *FD) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Verify that the function takes a single argument.
|
// Verify that the function takes a single argument.
|
||||||
if (FPT->getNumArgs() != 1)
|
if (FPT->getNumParams() != 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Is the argument a 'char*'?
|
// Is the argument a 'char*'?
|
||||||
const PointerType *PT = FPT->getArgType(0)->getAs<PointerType>();
|
const PointerType *PT = FPT->getParamType(0)->getAs<PointerType>();
|
||||||
if (!PT)
|
if (!PT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -338,15 +338,15 @@ void WalkAST::checkCall_getpw(const CallExpr *CE, const FunctionDecl *FD) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Verify that the function takes two arguments.
|
// Verify that the function takes two arguments.
|
||||||
if (FPT->getNumArgs() != 2)
|
if (FPT->getNumParams() != 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Verify the first argument type is integer.
|
// Verify the first argument type is integer.
|
||||||
if (!FPT->getArgType(0)->isIntegralOrUnscopedEnumerationType())
|
if (!FPT->getParamType(0)->isIntegralOrUnscopedEnumerationType())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Verify the second argument type is char*.
|
// Verify the second argument type is char*.
|
||||||
const PointerType *PT = FPT->getArgType(1)->getAs<PointerType>();
|
const PointerType *PT = FPT->getParamType(1)->getAs<PointerType>();
|
||||||
if (!PT)
|
if (!PT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -382,11 +382,11 @@ void WalkAST::checkCall_mktemp(const CallExpr *CE, const FunctionDecl *FD) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Verify that the function takes a single argument.
|
// Verify that the function takes a single argument.
|
||||||
if (FPT->getNumArgs() != 1)
|
if (FPT->getNumParams() != 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Verify that the argument is Pointer Type.
|
// Verify that the argument is Pointer Type.
|
||||||
const PointerType *PT = FPT->getArgType(0)->getAs<PointerType>();
|
const PointerType *PT = FPT->getParamType(0)->getAs<PointerType>();
|
||||||
if (!PT)
|
if (!PT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -551,14 +551,14 @@ bool WalkAST::checkCall_strCommon(const CallExpr *CE, const FunctionDecl *FD) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Verify the function takes two arguments, three in the _chk version.
|
// Verify the function takes two arguments, three in the _chk version.
|
||||||
int numArgs = FPT->getNumArgs();
|
int numArgs = FPT->getNumParams();
|
||||||
if (numArgs != 2 && numArgs != 3)
|
if (numArgs != 2 && numArgs != 3)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Verify the type for both arguments.
|
// Verify the type for both arguments.
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
// Verify that the arguments are pointers.
|
// Verify that the arguments are pointers.
|
||||||
const PointerType *PT = FPT->getArgType(i)->getAs<PointerType>();
|
const PointerType *PT = FPT->getParamType(i)->getAs<PointerType>();
|
||||||
if (!PT)
|
if (!PT)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -584,17 +584,16 @@ void WalkAST::checkCall_rand(const CallExpr *CE, const FunctionDecl *FD) {
|
||||||
if (!FTP)
|
if (!FTP)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (FTP->getNumArgs() == 1) {
|
if (FTP->getNumParams() == 1) {
|
||||||
// Is the argument an 'unsigned short *'?
|
// Is the argument an 'unsigned short *'?
|
||||||
// (Actually any integer type is allowed.)
|
// (Actually any integer type is allowed.)
|
||||||
const PointerType *PT = FTP->getArgType(0)->getAs<PointerType>();
|
const PointerType *PT = FTP->getParamType(0)->getAs<PointerType>();
|
||||||
if (!PT)
|
if (!PT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (! PT->getPointeeType()->isIntegralOrUnscopedEnumerationType())
|
if (! PT->getPointeeType()->isIntegralOrUnscopedEnumerationType())
|
||||||
return;
|
return;
|
||||||
}
|
} else if (FTP->getNumParams() != 0)
|
||||||
else if (FTP->getNumArgs() != 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Issue a warning.
|
// Issue a warning.
|
||||||
|
@ -628,7 +627,7 @@ void WalkAST::checkCall_random(const CallExpr *CE, const FunctionDecl *FD) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Verify that the function takes no argument.
|
// Verify that the function takes no argument.
|
||||||
if (FTP->getNumArgs() != 0)
|
if (FTP->getNumParams() != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Issue a warning.
|
// Issue a warning.
|
||||||
|
@ -704,12 +703,12 @@ void WalkAST::checkUncheckedReturnValue(CallExpr *CE) {
|
||||||
|
|
||||||
// Verify that the function takes one or two arguments (depending on
|
// Verify that the function takes one or two arguments (depending on
|
||||||
// the function).
|
// the function).
|
||||||
if (FTP->getNumArgs() != (identifierid < 4 ? 1 : 2))
|
if (FTP->getNumParams() != (identifierid < 4 ? 1 : 2))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// The arguments must be integers.
|
// The arguments must be integers.
|
||||||
for (unsigned i = 0; i < FTP->getNumArgs(); i++)
|
for (unsigned i = 0; i < FTP->getNumParams(); i++)
|
||||||
if (! FTP->getArgType(i)->isIntegralOrUnscopedEnumerationType())
|
if (!FTP->getParamType(i)->isIntegralOrUnscopedEnumerationType())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Issue a warning.
|
// Issue a warning.
|
||||||
|
|
|
@ -1174,7 +1174,7 @@ RetainSummaryManager::getUnarySummary(const FunctionType* FT,
|
||||||
// Sanity check that this is *really* a unary function. This can
|
// Sanity check that this is *really* a unary function. This can
|
||||||
// happen if people do weird things.
|
// happen if people do weird things.
|
||||||
const FunctionProtoType* FTP = dyn_cast<FunctionProtoType>(FT);
|
const FunctionProtoType* FTP = dyn_cast<FunctionProtoType>(FT);
|
||||||
if (!FTP || FTP->getNumArgs() != 1)
|
if (!FTP || FTP->getNumParams() != 1)
|
||||||
return getPersistentStopSummary();
|
return getPersistentStopSummary();
|
||||||
|
|
||||||
assert (ScratchArgs.isEmpty());
|
assert (ScratchArgs.isEmpty());
|
||||||
|
|
|
@ -538,7 +538,7 @@ int clang_getNumArgTypes(CXType X) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (const FunctionProtoType *FD = T->getAs<FunctionProtoType>()) {
|
if (const FunctionProtoType *FD = T->getAs<FunctionProtoType>()) {
|
||||||
return FD->getNumArgs();
|
return FD->getNumParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (T->getAs<FunctionNoProtoType>()) {
|
if (T->getAs<FunctionNoProtoType>()) {
|
||||||
|
@ -554,11 +554,11 @@ CXType clang_getArgType(CXType X, unsigned i) {
|
||||||
return MakeCXType(QualType(), GetTU(X));
|
return MakeCXType(QualType(), GetTU(X));
|
||||||
|
|
||||||
if (const FunctionProtoType *FD = T->getAs<FunctionProtoType>()) {
|
if (const FunctionProtoType *FD = T->getAs<FunctionProtoType>()) {
|
||||||
unsigned numArgs = FD->getNumArgs();
|
unsigned numArgs = FD->getNumParams();
|
||||||
if (i >= numArgs)
|
if (i >= numArgs)
|
||||||
return MakeCXType(QualType(), GetTU(X));
|
return MakeCXType(QualType(), GetTU(X));
|
||||||
|
|
||||||
return MakeCXType(FD->getArgType(i), GetTU(X));
|
return MakeCXType(FD->getParamType(i), GetTU(X));
|
||||||
}
|
}
|
||||||
|
|
||||||
return MakeCXType(QualType(), GetTU(X));
|
return MakeCXType(QualType(), GetTU(X));
|
||||||
|
|
Loading…
Reference in New Issue