[PATCH] D136815: [clang][Interp] Ignore visitDecl() for local declarations

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 26 22:46:45 PDT 2022


tbaeder created this revision.
tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

  We reach visitDecl() for both local and global variables, but we used to
  call Program::createGlobal() for both of them. Stop doing that.

I was working on something different and noticed that we register the same variable declaration twice.

Clang calls `EvaluateAsInitializer()` for local (const, probably) declarations as well, so we shouldn't register those as global variables.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136815

Files:
  clang/lib/AST/Interp/ByteCodeExprGen.cpp
  clang/lib/AST/Interp/ByteCodeExprGen.h
  clang/lib/AST/Interp/ByteCodeStmtGen.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136815.471028.patch
Type: text/x-patch
Size: 4316 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221027/ddaab0cc/attachment.bin>


More information about the cfe-commits mailing list