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 | f98c88757d5873fcb5ca3d54656b5380b71c4e95 (patch) | |
tree | 045ff918d5d87f49ca377779fb21971e8308964f /lib/Sema/SemaType.cpp | |
parent | 60ec5f80d2f681874cf2199dbd38b77346f30bb4 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214408 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 4ad066a7a7..47df3a69aa 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -4564,23 +4564,12 @@ static bool handleFunctionTypeAttr(TypeProcessingState &state, } } - // Diagnose the use of X86 fastcall on unprototyped functions. - if (CC == CC_X86FastCall) { - if (isa<FunctionNoProtoType>(fn)) { - S.Diag(attr.getLoc(), diag::err_cconv_knr) - << FunctionType::getNameForCallConv(CC); - attr.setInvalid(); - return true; - } - - // Also diagnose fastcall with regparm. - if (fn->getHasRegParm()) { - S.Diag(attr.getLoc(), diag::err_attributes_are_not_compatible) - << "regparm" - << FunctionType::getNameForCallConv(CC); - attr.setInvalid(); - return true; - } + // Also diagnose fastcall with regparm. + if (CC == CC_X86FastCall && fn->getHasRegParm()) { + S.Diag(attr.getLoc(), diag::err_attributes_are_not_compatible) + << "regparm" << FunctionType::getNameForCallConv(CC_X86FastCall); + attr.setInvalid(); + return true; } // Modify the CC from the wrapped function type, wrap it all back, and then |