[PATCH] D134057: [clang][Interp] Start implementing record types

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 28 05:45:18 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:689
+    const Decl *Callee = CE->getCalleeDecl();
+    const Function *Func = P.getFunction(dyn_cast<FunctionDecl>(Callee));
+
----------------
tbaeder wrote:
> aaron.ballman wrote:
> > tbaeder wrote:
> > > aaron.ballman wrote:
> > > > What if this comes back as `nullptr` (does `getFunction()` handle that gracefully)?
> > > It does not :) I was relying on a crash somewhere when I have a test case for it.
> > I'd rather use an explicit `assert` for that instead of relying on a crash; it's easier to spot the `assert` in that case.
> I forgot I hadn't posted this to phab yet, but https://reviews.llvm.org/D134699 introduces a `getFunction` that asserts that the given `FunctionDecl` is not null.
Ah, okay, that works fine for me then.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134057/new/

https://reviews.llvm.org/D134057



More information about the cfe-commits mailing list