[PATCH] D145861: [clang][Interp] Ignore more non-VarDecl declarations

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 14 06:21:51 PDT 2023


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeStmtGen.cpp:224
   for (auto *D : DS->decls()) {
-    if (isa<StaticAssertDecl>(D))
+    if (isa<StaticAssertDecl, RecordDecl, EnumDecl>(D))
       continue;
----------------
tbaeder wrote:
> aaron.ballman wrote:
> > What about other kinds of declarations, such as typedefs or functions?
> > ```
> > typedef int foo, bar;
> > extern int a(), b();
> > ```
> > (and so on)
> That's a good question, I added these now because I ran into them, but my follow-up question would've indeed been "what others are there?" :)
I was going to say: basically anything reachable from this grammar production: http://eel.is/c++draft/dcl.pre#nt:simple-declaration but then I was surprised to see `StaticAssertDecl` here. It turns out that any declaration at block scope gets wrapped in a DeclStmt. Well, almost any: https://godbolt.org/z/nMYdYTPEq


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145861



More information about the cfe-commits mailing list