diff options
author | Nico Weber <nicolasweber@gmx.de> | 2014-07-31 17:19:18 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2014-07-31 17:19:18 +0000 |
commit | be39a87e1126c229ed69985881d8fb8fc53ce4ff (patch) | |
tree | 50992ba6b12c1647df925bdff22bf2c24a34776d /clang/lib/Sema/SemaDecl.cpp | |
parent | 8ed8dbd96a8de3da0213f7863de7ba3e588277f9 (diff) | |
download | bcm5719-llvm-be39a87e1126c229ed69985881d8fb8fc53ce4ff.tar.gz bcm5719-llvm-be39a87e1126c229ed69985881d8fb8fc53ce4ff.zip |
Delay check for prototype on __fastcall functions until after MergeFunctionDecl.
In C, it is only known after merging decls if a function with 0 arguments has
a prototype. Fixes PR20386, see that for more notes.
llvm-svn: 214408
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 9ce09288de1..4abbbebf808 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -7821,6 +7821,18 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, } // Semantic checking for this function declaration (in isolation). + + // Diagnose the use of X86 fastcall on unprototyped functions. + QualType NewQType = Context.getCanonicalType(NewFD->getType()); + const FunctionType *NewType = cast<FunctionType>(NewQType); + if (isa<FunctionNoProtoType>(NewType)) { + FunctionType::ExtInfo NewTypeInfo = NewType->getExtInfo(); + if (NewTypeInfo.getCC() == CC_X86FastCall) + Diag(NewFD->getLocation(), diag::err_cconv_knr) + << FunctionType::getNameForCallConv(CC_X86FastCall); + // TODO: Also diagnose unprototyped stdcall functions? + } + if (getLangOpts().CPlusPlus) { // C++-specific checks. if (CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(NewFD)) { |