diff options
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)) { |