forked from OSchip/llvm-project
Loosening the restriction on variadic function definitions so that extern "C" function definitions are permissible.
llvm-svn: 249555
This commit is contained in:
parent
fcc7f6622f
commit
fd3a3b3f29
|
@ -20,9 +20,12 @@ void VariadicFunctionDefCheck::registerMatchers(MatchFinder *Finder) {
|
|||
if (!getLangOpts().CPlusPlus)
|
||||
return;
|
||||
|
||||
// We only care about function *definitions* that are variadic.
|
||||
Finder->addMatcher(functionDecl(isDefinition(), isVariadic()).bind("func"),
|
||||
this);
|
||||
// We only care about function *definitions* that are variadic, and do not
|
||||
// have extern "C" language linkage.
|
||||
Finder->addMatcher(
|
||||
functionDecl(isDefinition(), isVariadic(), unless(isExternC()))
|
||||
.bind("func"),
|
||||
this);
|
||||
}
|
||||
|
||||
void VariadicFunctionDefCheck::check(const MatchFinder::MatchResult &Result) {
|
||||
|
|
|
@ -16,3 +16,9 @@ struct S {
|
|||
void f1(int, ...) {}
|
||||
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: do not define a C-style variadic function; consider using a function parameter pack or currying instead
|
||||
};
|
||||
|
||||
// Function definitions that are extern "C" are good.
|
||||
extern "C" void f4(int, ...) {} // ok
|
||||
extern "C" {
|
||||
void f5(int, ...) {} // ok
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue