summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReaderDecl.cpp
diff options
context:
space:
mode:
authorGeorge Burgess IV <george.burgess.iv@gmail.com>2017-02-24 02:49:47 +0000
committerGeorge Burgess IV <george.burgess.iv@gmail.com>2017-02-24 02:49:47 +0000
commitb7760210d3d42356e3a89db3a468c6959d0d6745 (patch)
treec3a01b216bf616deda97e1560d203ab2243238e8 /clang/lib/Serialization/ASTReaderDecl.cpp
parent741cc4be7efc4d397c39e16c8412019ca0917566 (diff)
downloadbcm5719-llvm-b7760210d3d42356e3a89db3a468c6959d0d6745.tar.gz
bcm5719-llvm-b7760210d3d42356e3a89db3a468c6959d0d6745.zip
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. llvm-svn: 296076
Diffstat (limited to 'clang/lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r--clang/lib/Serialization/ASTReaderDecl.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp
index 0f43e9fcf64..7971c30b488 100644
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -2664,9 +2664,12 @@ static bool isSameTemplateParameterList(const TemplateParameterList *X,
}
/// Determine whether the attributes we can overload on are identical for A and
-/// B. Expects A and B to (otherwise) have the same type.
+/// B. Will ignore any overloadable attrs represented in the type of A and B.
static bool hasSameOverloadableAttrs(const FunctionDecl *A,
const FunctionDecl *B) {
+ // Note that pass_object_size attributes are represented in the function's
+ // ExtParameterInfo, so we don't need to check them here.
+
SmallVector<const EnableIfAttr *, 4> AEnableIfs;
// Since this is an equality check, we can ignore that enable_if attrs show up
// in reverse order.
@@ -2696,8 +2699,6 @@ static bool hasSameOverloadableAttrs(const FunctionDecl *A,
return false;
}
- // FIXME: This doesn't currently consider pass_object_size attributes, since
- // we aren't guaranteed that A and B have valid parameter lists yet.
return true;
}
OpenPOWER on IntegriCloud