]> granicus.if.org Git - clang/commit
Represent pass_object_size attrs in ExtParameterInfo
authorGeorge Burgess IV <george.burgess.iv@gmail.com>
Fri, 24 Feb 2017 02:49:47 +0000 (02:49 +0000)
committerGeorge Burgess IV <george.burgess.iv@gmail.com>
Fri, 24 Feb 2017 02:49:47 +0000 (02:49 +0000)
commit8d92d799c7fd1127f4fa004c26dca45e7eab8ed0
tree7b1535aeb824baa4749972d39110aea3aa6e294a
parent9120d612824ea7eb445fa105841a1fbab6a6cfc2
Represent pass_object_size attrs in ExtParameterInfo

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296076 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/Type.h
lib/CodeGen/CGCall.cpp
lib/Sema/SemaType.cpp
lib/Serialization/ASTReaderDecl.cpp
test/CodeGenObjCXX/arc-attrs-abi.mm
test/Modules/Inputs/overloadable-attrs/a.h
test/Modules/overloadable-attrs.cpp