diff options
| author | Erich Keane <erich.keane@intel.com> | 2017-11-02 21:08:00 +0000 |
|---|---|---|
| committer | Erich Keane <erich.keane@intel.com> | 2017-11-02 21:08:00 +0000 |
| commit | a957ffbce3920d7c07eb1c73ee616c4e96d57be0 (patch) | |
| tree | e617693bc21960d9cbbd36e74971ef58b4f78e7c /clang/lib/Sema | |
| parent | f2593d028fbaea554a6f499eb535b54e6d3b297a (diff) | |
| download | bcm5719-llvm-a957ffbce3920d7c07eb1c73ee616c4e96d57be0.tar.gz bcm5719-llvm-a957ffbce3920d7c07eb1c73ee616c4e96d57be0.zip | |
Add default calling convention support for regcall.
Added support for regcall as default calling convention. Also added code to
exclude main when applying default calling conventions.
Patch-By: eandrews
Differential Revision: https://reviews.llvm.org/D39210
llvm-svn: 317268
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 0c00ef7e26c..ab1a66ad8fb 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -9673,6 +9673,13 @@ void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& DS) { assert(T->isFunctionType() && "function decl is not of function type"); const FunctionType* FT = T->castAs<FunctionType>(); + // Set default calling convention for main() + if (FT->getCallConv() != CC_C) { + FT = Context.adjustFunctionType(FT, FT->getExtInfo().withCallingConv(CC_C)); + FD->setType(QualType(FT, 0)); + T = Context.getCanonicalType(FD->getType()); + } + if (getLangOpts().GNUMode && !getLangOpts().CPlusPlus) { // In C with GNU extensions we allow main() to have non-integer return // type, but we should warn about the extension, and we disable the |

