This is an archive of the discontinued LLVM Phabricator instance.

Improve handling of __FUNCTION__ and other predefined expression for Objective-C Blocks
ClosedPublic

Authored by mehdi_amini on Nov 10 2016, 1:43 PM.

Event Timeline

mehdi_amini retitled this revision from to Improve handling of __FUNCTION__ and other predefined expression for Objective-C Blocks.
mehdi_amini updated this object.
mehdi_amini added a reviewer: arphaman.
mehdi_amini added a subscriber: cfe-commits.
arphaman added inline comments.Nov 11 2016, 8:53 AM
clang/lib/AST/Expr.cpp
538

I think it's possible to avoid the braces by simplifying down to something like this:

if (auto *DCFunc = dyn_cast<FunctionDecl>(DC))
  Out << ComputeName(IT, DCFunc) << "_block_invoke";
else
  // For nested blocks, propagate up to the parent.
  Out << ComputeName(IT, cast<BlockDecl>(DC));
clang/lib/CodeGen/CGExpr.cpp
2325

discriminator should be Discriminator

2327

!= 0 is redundant here

clang/test/CodeGen/block-with-perdefinedexpr.cpp
67

I think you should maybe add/change one of the tests to be a block inside of a lambda.

mehdi_amini marked 3 inline comments as done.

Address Alex's comment.

Fix warning for unused variable

Add a test inside a lambda

arphaman accepted this revision.Nov 14 2016, 4:48 AM
arphaman edited edge metadata.

LGTM, Thanks

This revision is now accepted and ready to land.Nov 14 2016, 4:48 AM
This revision was automatically updated to reflect the committed changes.

Already reverted