diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2009-02-02 23:43:58 +0000 | 
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2009-02-02 23:43:58 +0000 | 
| commit | 3668cb2d3c0437c4f339a1596cab9e82b6af93c7 (patch) | |
| tree | 828a3084cc5e50f8da7d15b501c362e3346c0e95 | |
| parent | 8bd3c2ebaccc7c226282750eb23ef622f05ad0ce (diff) | |
| download | bcm5719-llvm-3668cb2d3c0437c4f339a1596cab9e82b6af93c7.tar.gz bcm5719-llvm-3668cb2d3c0437c4f339a1596cab9e82b6af93c7.zip  | |
Change CGFunctionInfo args iterator to not include the return type.
llvm-svn: 63571
| -rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 28 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGCall.h | 10 | 
2 files changed, 18 insertions, 20 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 7e2592206e0..898c780aaec 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -97,11 +97,11 @@ CGFunctionInfo::CGFunctionInfo(QualType ResTy,    ArgTypes.insert(ArgTypes.end(), ArgTys.begin(), ArgTys.end());  } -ArgTypeIterator CGFunctionInfo::argtypes_begin() const { -  return ArgTypes.begin(); +CGFunctionInfo::arg_iterator CGFunctionInfo::arg_begin() const { +  return ArgTypes.begin()+1;  } -ArgTypeIterator CGFunctionInfo::argtypes_end() const { +CGFunctionInfo::arg_iterator CGFunctionInfo::arg_end() const {    return ArgTypes.end();  } @@ -965,8 +965,7 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI, bool IsVariadic) {    const llvm::Type *ResultType = 0; -  ArgTypeIterator begin = FI.argtypes_begin(), end = FI.argtypes_end();   -  QualType RetTy = *begin; +  QualType RetTy = FI.getReturnType();    ABIArgInfo RetAI = getABIReturnInfo(RetTy, *this);    switch (RetAI.getKind()) {    case ABIArgInfo::ByVal: @@ -997,9 +996,10 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI, bool IsVariadic) {      break;    } -  for (++begin; begin != end; ++begin) { -    ABIArgInfo AI = getABIArgumentInfo(*begin, *this); -    const llvm::Type *Ty = ConvertType(*begin); +  for (CGFunctionInfo::arg_iterator it = FI.arg_begin(), ie = FI.arg_end();  +       it != ie; ++it) { +    ABIArgInfo AI = getABIArgumentInfo(*it, *this); +    const llvm::Type *Ty = ConvertType(*it);      switch (AI.getKind()) {      case ABIArgInfo::Ignore: @@ -1020,7 +1020,7 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI, bool IsVariadic) {        break;      case ABIArgInfo::Expand: -      GetExpandedTypes(*begin, ArgTys); +      GetExpandedTypes(*it, ArgTys);        break;      }    } @@ -1028,7 +1028,7 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI, bool IsVariadic) {    return llvm::FunctionType::get(ResultType, ArgTys, IsVariadic);  } -void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &Info, +void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,                                             const Decl *TargetDecl,                                             AttributeListType &PAL) {    unsigned FuncAttrs = 0; @@ -1045,8 +1045,7 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &Info,        FuncAttrs |= llvm::Attribute::ReadNone;    } -  ArgTypeIterator begin = Info.argtypes_begin(), end = Info.argtypes_end(); -  QualType RetTy = *begin; +  QualType RetTy = FI.getReturnType();    unsigned Index = 1;    ABIArgInfo RetAI = getABIReturnInfo(RetTy, getTypes());    switch (RetAI.getKind()) { @@ -1078,8 +1077,9 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &Info,    if (RetAttrs)      PAL.push_back(llvm::AttributeWithIndex::get(0, RetAttrs)); -  for (++begin; begin != end; ++begin) { -    QualType ParamType = *begin; +  for (CGFunctionInfo::arg_iterator it = FI.arg_begin(), ie = FI.arg_end();  +       it != ie; ++it) { +    QualType ParamType = *it;      unsigned Attributes = 0;      ABIArgInfo AI = getABIArgumentInfo(ParamType, getTypes()); diff --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h index f8fb32b15a4..aaab36ca83e 100644 --- a/clang/lib/CodeGen/CGCall.h +++ b/clang/lib/CodeGen/CGCall.h @@ -47,21 +47,19 @@ namespace CodeGen {    typedef llvm::SmallVector<std::pair<const VarDecl*, QualType>,                               16> FunctionArgList; -  // FIXME: This should be a better iterator type so that we can avoid -  // construction of the ArgTypes smallvectors. -  typedef llvm::SmallVector<QualType, 16>::const_iterator ArgTypeIterator; -    /// CGFunctionInfo - Class to encapsulate the information about a    /// function definition.    class CGFunctionInfo {      llvm::SmallVector<QualType, 16> ArgTypes;    public: +    typedef llvm::SmallVector<QualType, 16>::const_iterator arg_iterator; +      CGFunctionInfo(QualType ResTy,                      const llvm::SmallVector<QualType, 16> &ArgTys); -    ArgTypeIterator argtypes_begin() const; -    ArgTypeIterator argtypes_end() const; +    arg_iterator arg_begin() const; +    arg_iterator arg_end() const;      QualType getReturnType() const { return ArgTypes[0]; }    };  | 

