[PATCH] D26522: Improve handling of __FUNCTION__ and other predefined expression for Objective-C Blocks
Alex Lorenz via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 11 08:53:48 PST 2016
arphaman added inline comments.
================
Comment at: clang/lib/AST/Expr.cpp:531
+ llvm::raw_svector_ostream Out(Buffer);
+ if (auto *DCFunc = dyn_cast<FunctionDecl>(DC)) {
+ Out << ComputeName(IT, DCFunc);
----------------
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));
```
================
Comment at: clang/lib/CodeGen/CGExpr.cpp:2325
+ if (!Name.empty()) {
+ unsigned discriminator =
+ CGM.getCXXABI().getMangleContext().getBlockId(BD, true);
----------------
`discriminator` should be `Discriminator`
================
Comment at: clang/lib/CodeGen/CGExpr.cpp:2327
+ CGM.getCXXABI().getMangleContext().getBlockId(BD, true);
+ if (discriminator != 0)
+ Name += "_" + Twine(discriminator + 1).str();
----------------
`!= 0` is redundant here
https://reviews.llvm.org/D26522
More information about the cfe-commits
mailing list