`Issue 57169 <https://github.com/llvm/llvm-project/issues/57169>`_
- Clang configuration files are now read through the virtual file system
rather than the physical one, if these are different.
+- Clang will now no longer treat a C 'overloadable' function without a prototype as
+ a variadic function with the attribute. This should make further diagnostics more
+ clear.
Improvements to Clang's diagnostics
Diag(NewFD->getLocation(),
diag::err_attribute_overloadable_no_prototype)
<< NewFD;
-
- // Turn this into a variadic function with no parameters.
- const auto *FT = NewFD->getType()->castAs<FunctionType>();
- FunctionProtoType::ExtProtoInfo EPI(
- Context.getDefaultCallingConvention(true, false));
- EPI.Variadic = true;
- EPI.ExtInfo = FT->getExtInfo();
-
- QualType R = Context.getFunctionType(FT->getReturnType(), None, EPI);
- NewFD->setType(R);
+ NewFD->dropAttr<OverloadableAttr>();
}
// If there's a #pragma GCC visibility in scope, and this isn't a class
f1();
}
+// Validate that the invalid function doesn't stay overloadable.
+int __attribute__((overloadable)) invalid(); // expected-error{{'overloadable' function 'invalid' must have a prototype}}
+int __attribute__((overloadable)) invalid(int); // expected-error{{redeclaration of 'invalid' must not have the 'overloadable' attribute}}
+ // expected-note@-2{{previous unmarked overload of function is here}}
+void use_invalid(void) {
+ invalid(); // expected-error{{too few arguments to function call, expected 1, have 0}}
+ // expected-note@-4{{'invalid' declared here}}
+ invalid(1);
+}
+
void before_local_1(int) __attribute__((overloadable));
void before_local_2(int); // expected-note {{here}}
void before_local_3(int) __attribute__((overloadable));