mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-10 18:11:19 +00:00
b7760210d3
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
23 lines
873 B
C++
23 lines
873 B
C++
// RUN: rm -rf %t
|
|
// RUN: %clang_cc1 -I%S/Inputs/overloadable-attrs -fmodules \
|
|
// RUN: -fmodule-map-file=%S/Inputs/overloadable-attrs/module.modulemap \
|
|
// RUN: -fmodules-cache-path=%t -verify %s -std=c++11
|
|
//
|
|
// Ensures that we don't merge decls with attrs that we allow overloading on.
|
|
//
|
|
// expected-no-diagnostics
|
|
|
|
#include "a.h"
|
|
|
|
static_assert(enable_if_attrs::fn1() == 1, "");
|
|
static_assert(enable_if_attrs::fn2() == 1, "");
|
|
static_assert(enable_if_attrs::fn3(0) == 0, "");
|
|
static_assert(enable_if_attrs::fn3(1) == 1, "");
|
|
static_assert(enable_if_attrs::fn4(0) == 0, "");
|
|
static_assert(enable_if_attrs::fn4(1) == 1, "");
|
|
static_assert(enable_if_attrs::fn5(0) == 0, "");
|
|
static_assert(enable_if_attrs::fn5(1) == 1, "");
|
|
|
|
static_assert(pass_object_size_attrs::fn1(nullptr) == 1, "");
|
|
static_assert(pass_object_size_attrs::fn2(nullptr) == 1, "");
|