[PATCH] D99517: Implemented [[clang::musttail]] attribute for guaranteed tail calls.
Josh Haberman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 9 10:27:43 PDT 2021
haberman added inline comments.
================
Comment at: clang/lib/Sema/SemaStmt.cpp:636-637
+
+ if (!CE->getCalleeDecl()) {
+ assert(hasUncompilableErrorOccurred() && "expected previous error");
+ return false;
----------------
aaron.ballman wrote:
> This worries me slightly -- not all `CallExpr` objects have a callee declaration (https://github.com/llvm/llvm-project/blob/main/clang/lib/AST/Expr.cpp#L1367). That said, I'm struggling to come up with an example that isn't covered so this may be fine.
That was my experience too, I wasn't able to find a case that isn't covered. I tried to avoid adding any diagnostics that I didn't know how to trigger or test.
================
Comment at: clang/lib/Sema/SemaStmt.cpp:700
+ // Call is: obj->*method_ptr or obj.*method_ptr
+ const MemberPointerType *MPT = VD->getType()->castAs<MemberPointerType>();
+ CalleeType.This = QualType(MPT->getClass(), 0);
----------------
aaron.ballman wrote:
> It'd be better not to go through the cast machinery twice -- you cast to the `MemberPointerType` and then cast to the same thing again (but in a different way).
I changed to `auto`, but I can't tell if you have another suggestion here also. I can't see how any of these casts can be removed.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99517/new/
https://reviews.llvm.org/D99517
More information about the cfe-commits
mailing list