[PATCH] D136936: [clang][Interp] Handle undefined functions better

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 2 11:41:44 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeEmitter.cpp:30
   if (!FuncDecl->isDefined(FuncDecl) ||
-      (!FuncDecl->hasBody() && FuncDecl->willHaveBody()))
-    return nullptr;
+      (FuncDecl->hasBody() && FuncDecl->willHaveBody()))
+    HasBody = false;
----------------
tbaeder wrote:
> aaron.ballman wrote:
> > `hasBody()` returns `true` if any body in the redeclaration chain already has a body, so I'm surprised to see this change -- I don't know if we reset `willHaveBody()` when we give the function a body, but the logic here seems wrong to me.
> I was confused by your question, but it's just about `hasBody()` vs `!hasBody()`, right? The old code used a negation and of course that way it makes sense, at least the way I read it. Yes I forgot the negation. :)
Heh, you managed to decipher my word salad correctly -- I was tying to figure out if you dropped the `!` for a reason. :-D


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

https://reviews.llvm.org/D136936



More information about the cfe-commits mailing list