Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
clang/unittests/Analysis/FlowSensitive/TransferTest.cpp | ||
---|---|---|
5433 | assert that the result is non-null? |
clang/unittests/Analysis/FlowSensitive/TransferTest.cpp | ||
---|---|---|
5433 | getChild() returns a reference, so the result can't be null. It asserts internally that the child exists, so if the child doesn't exist, we'll get an assertion failure. |
clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp | ||
---|---|---|
305 | 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. | |
clang/unittests/Analysis/FlowSensitive/TransferTest.cpp | ||
5427 | 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. |
Undo all of the non-test changes. This patch now only introduces a test that
we can access fields of anonymous structs.
I realized based on gribozavr2's comment that we shouldn't be lumping all fields
of anonymous records into the parent record, as this goes against the grain of
the Clang AST and, for example, requires special-case code in MemberExpr.
Instead, I realized that everything essentially already works -- anonymous
records were already being correctly added as fields of their parent record.
The only thing that needs to be fixed is handling IndirectFieldDecl correctly
when transferring CXXCtorInitializer. This will come in a followup patch.
PTAL
clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp | ||
---|---|---|
305 | Thanks for pointing this out. I realized I was really working against the grain of the Clang AST. I've changed this patch so that it merely adds a new test (to demonstrate that we are already representing fields of anonymous records correctly). The thing that actually needs to be fixed is the handling of CXXCtorInitializer; I'll do this in a followup patch. | |
clang/unittests/Analysis/FlowSensitive/TransferTest.cpp | ||
5427 | Good point, done. |
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.