diff options
| author | Roman Divacky <rdivacky@freebsd.org> | 2011-03-01 17:40:53 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@freebsd.org> | 2011-03-01 17:40:53 +0000 |
| commit | 65b88cdb3bd34e5000b30533fa1599c959029719 (patch) | |
| tree | 6dce558afa64f27e884fc34800991ed09b31ed5a /clang/lib/AST/ASTContext.cpp | |
| parent | dc1f68d0a5c09231298995d42711a88ef9df1426 (diff) | |
| download | bcm5719-llvm-65b88cdb3bd34e5000b30533fa1599c959029719.tar.gz bcm5719-llvm-65b88cdb3bd34e5000b30533fa1599c959029719.zip | |
Implement -mrtd which sets the StdCall calling convention to be the default
one.
llvm-svn: 126756
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 77686307495..5335a8b0c88 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -1862,7 +1862,9 @@ ASTContext::getDependentSizedExtVectorType(QualType vecType, QualType ASTContext::getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const { - const CallingConv CallConv = Info.getCC(); + const CallingConv DefaultCC = Info.getCC(); + const CallingConv CallConv = (LangOpts.MRTD && DefaultCC == CC_Default) ? + CC_X86StdCall : DefaultCC; // Unique functions, to guarantee there is only one function of a particular // structure. llvm::FoldingSetNodeID ID; @@ -1886,8 +1888,9 @@ ASTContext::getFunctionNoProtoType(QualType ResultTy, assert(NewIP == 0 && "Shouldn't be in the map!"); (void)NewIP; } + FunctionProtoType::ExtInfo newInfo = Info.withCallingConv(CallConv); FunctionNoProtoType *New = new (*this, TypeAlignment) - FunctionNoProtoType(ResultTy, Canonical, Info); + FunctionNoProtoType(ResultTy, Canonical, newInfo); Types.push_back(New); FunctionNoProtoTypes.InsertNode(New, InsertPos); return QualType(New, 0); @@ -1915,7 +1918,9 @@ ASTContext::getFunctionType(QualType ResultTy, if (!ArgArray[i].isCanonicalAsParam()) isCanonical = false; - const CallingConv CallConv = EPI.ExtInfo.getCC(); + const CallingConv DefaultCC = EPI.ExtInfo.getCC(); + const CallingConv CallConv = (LangOpts.MRTD && DefaultCC == CC_Default) ? + CC_X86StdCall : DefaultCC; // If this type isn't canonical, get the canonical version of it. // The exception spec is not part of the canonical type. @@ -1952,7 +1957,9 @@ ASTContext::getFunctionType(QualType ResultTy, NumArgs * sizeof(QualType) + EPI.NumExceptions * sizeof(QualType); FunctionProtoType *FTP = (FunctionProtoType*) Allocate(Size, TypeAlignment); - new (FTP) FunctionProtoType(ResultTy, ArgArray, NumArgs, Canonical, EPI); + FunctionProtoType::ExtProtoInfo newEPI = EPI; + newEPI.ExtInfo = EPI.ExtInfo.withCallingConv(CallConv); + new (FTP) FunctionProtoType(ResultTy, ArgArray, NumArgs, Canonical, newEPI); Types.push_back(FTP); FunctionProtoTypes.InsertNode(FTP, InsertPos); return QualType(FTP, 0); |

