summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaLambda.cpp
diff options
context:
space:
mode:
authorGeorge Burgess IV <george.burgess.iv@gmail.com>2015-12-02 21:58:08 +0000
committerGeorge Burgess IV <george.burgess.iv@gmail.com>2015-12-02 21:58:08 +0000
commit3e3bb95b6951c313dd5dd1c099184c309a3952e2 (patch)
tree601f182e5509276b9319182864eac0e27a888b68 /clang/lib/Sema/SemaLambda.cpp
parentba904d4ecf66528be5dadd60665d5a979ce6b1a4 (diff)
downloadbcm5719-llvm-3e3bb95b6951c313dd5dd1c099184c309a3952e2.tar.gz
bcm5719-llvm-3e3bb95b6951c313dd5dd1c099184c309a3952e2.zip
Add the `pass_object_size` attribute to clang.
`pass_object_size` is our way of enabling `__builtin_object_size` to produce high quality results without requiring inlining to happen everywhere. A link to the design doc for this attribute is available at the Differential review link below. Differential Revision: http://reviews.llvm.org/D13263 llvm-svn: 254554
Diffstat (limited to 'clang/lib/Sema/SemaLambda.cpp')
-rw-r--r--clang/lib/Sema/SemaLambda.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp
index 80d497f4e50..3b81df4ef63 100644
--- a/clang/lib/Sema/SemaLambda.cpp
+++ b/clang/lib/Sema/SemaLambda.cpp
@@ -1141,6 +1141,12 @@ static void addFunctionPointerConversion(Sema &S,
SourceRange IntroducerRange,
CXXRecordDecl *Class,
CXXMethodDecl *CallOperator) {
+ // This conversion is explicitly disabled if the lambda's function has
+ // pass_object_size attributes on any of its parameters.
+ if (std::any_of(CallOperator->param_begin(), CallOperator->param_end(),
+ std::mem_fn(&ParmVarDecl::hasAttr<PassObjectSizeAttr>)))
+ return;
+
// Add the conversion to function pointer.
const FunctionProtoType *CallOpProto =
CallOperator->getType()->getAs<FunctionProtoType>();
OpenPOWER on IntegriCloud