[clang] [clang][dataflow] Fix result object location for builtin `<=>`. (PR #88726)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 15 07:20:13 PDT 2024
================
@@ -508,6 +508,11 @@ class ResultObjectVisitor : public RecursiveASTVisitor<ResultObjectVisitor> {
isa<CXXStdInitializerListExpr>(E)) {
return;
}
+ if (auto *Op = dyn_cast<BinaryOperator>(E);
----------------
martinboehme wrote:
I'm not sure.
* The cases involving a `dyn_cast` need a cast anyway, as they access properties of the cast class. So if we introduced a switch, we would need a `case` _and_ a cast.
* This leaves the `isa<>` cases above. IIUC, `isa<>` essentially compiles down to a test on `E->getStmtClass()`. So in terms of performance, replacing the `isa<>` calls above with a switch statement shouldn't make much of a difference. I think the `isa<>` version is more readable though.
So in all, I don't see a clear advantage, and I would prefer to keep this as-is.
https://github.com/llvm/llvm-project/pull/88726
More information about the cfe-commits
mailing list