[PATCH] D153409: [clang][dataflow] Treat fields of anonymous records as being part of their parent.
Dmitri Gribenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 21 05:52:01 PDT 2023
gribozavr2 accepted this revision.
gribozavr2 added inline comments.
================
Comment at: clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp:305
+ if (Field->isAnonymousStructOrUnion())
+ getFieldsFromClassHierarchy(Field->getType(), Fields);
+ else
----------------
Could we somehow take advantage of the IndirectFieldDecl instead of recursing ourselves? Seems like that way we would be delegating to Clang the questions of the name injection/lookup.
================
Comment at: clang/unittests/Analysis/FlowSensitive/TransferTest.cpp:5427
+ const ValueDecl *SDecl = findValueDecl(ASTCtx, "s");
+ const ValueDecl *IDecl = findValueDecl(ASTCtx, "i");
+
----------------
Could we make some stronger assertion to prove that the transfer function works? It seems to me that getChild() by itself does not prove that.
For example, store and load the value and assert that it is the same.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153409/new/
https://reviews.llvm.org/D153409
More information about the cfe-commits
mailing list