The goal of this is to fix a bug in modules where we'd merge FunctionDecls that differed in their pass_object_size attributes. Since we can overload on the presence of pass_object_size attributes, this behavior is incorrect. We don't represent `N` in `pass_object_size(N)` as part of ExtParameterInfo, since it's an error to overload solely on the value of N. This means that we have a bug if we have two modules that declare functions that differ only in their pass_object_size attrs, like so: // In module A, from a.h void foo(char *__attribute__((pass_object_size(0)))); // In module B, from b.h void foo(char *__attribute__((pass_object_size(1)))); // In module C, in main.c #include "a.h" #include "b.h" At the moment, we'll merge the foo decls, when we should instead emit a diagnostic about an invalid overload. We seem to have similar (silent) behavior if we overload only on the return type of `foo` instead; I'll try to find a good place to put a FIXME (or I'll just file a bug) soon. This patch also fixes a bug where we'd not output the proper extended parameter info for declarations with pass_object_size attrs. llvm-svn: 296076
29 lines
914 B
C++
29 lines
914 B
C++
namespace enable_if_attrs {
|
|
constexpr int fn1() __attribute__((enable_if(0, ""))) { return 0; }
|
|
constexpr int fn1() { return 1; }
|
|
|
|
constexpr int fn2() { return 1; }
|
|
constexpr int fn2() __attribute__((enable_if(0, ""))) { return 0; }
|
|
|
|
constexpr int fn3(int i) __attribute__((enable_if(!i, ""))) { return 0; }
|
|
constexpr int fn3(int i) __attribute__((enable_if(i, ""))) { return 1; }
|
|
|
|
constexpr int fn4(int i) { return 0; }
|
|
constexpr int fn4(int i) __attribute__((enable_if(i, ""))) { return 1; }
|
|
|
|
constexpr int fn5(int i) __attribute__((enable_if(i, ""))) { return 1; }
|
|
constexpr int fn5(int i) { return 0; }
|
|
}
|
|
|
|
namespace pass_object_size_attrs {
|
|
constexpr int fn1(void *const a __attribute__((pass_object_size(0)))) {
|
|
return 1;
|
|
}
|
|
constexpr int fn1(void *const a) { return 0; }
|
|
|
|
constexpr int fn2(void *const a) { return 0; }
|
|
constexpr int fn2(void *const a __attribute__((pass_object_size(0)))) {
|
|
return 1;
|
|
}
|
|
}
|