r347812 permitted forward declarations for cpu-dispatch functions, which
are occassionally useful as exposition in header files. However, this inadvertently
permitted this function to become multiversioned after a usage. This
patch ensures that the "CausesMV" checks are still run in the
forward-declaration case.
Change-Id: Icb6f975a2d068f088b89e3bbe26cf1d24f5a972c
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351212
91177308-0d34-0410-b5e6-
96231b3b80d8
return true;
}
- if (CheckMultiVersionAdditionalRules(S, OldFD, NewFD, false, NewMVType)) {
+ if (CheckMultiVersionAdditionalRules(S, OldFD, NewFD,
+ !OldFD->isMultiVersion(), NewMVType)) {
NewFD->setInvalidDecl();
return true;
}
int allow_fwd_decl(void);
int __attribute__((cpu_dispatch(atom))) allow_fwd_decl(void) {}
+int allow_fwd_decl2(void);
+void use_fwd_decl(void) {
+ allow_fwd_decl2();
+}
+// expected-error@+1 {{function declaration cannot become a multiversioned function after first usage}}
+int __attribute__((cpu_dispatch(atom))) allow_fwd_decl2(void) {}
+
+
int __attribute__((cpu_specific(atom))) redecl4(void);
// expected-error@+1 {{function declaration is missing 'cpu_specific' or 'cpu_dispatch' attribute in a multiversioned function}}
int redecl4(void);