The noderef attribute is for catching code that accesses pointers in
a different address space. Unevaluated code is always safe in that regard.
Details
- Reviewers
leonardchan rsmith aaron.ballman mcgrathr
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
430 ms | linux > HWAddressSanitizer-x86_64.TestCases::sizes.cpp |
Event Timeline
re-uploading to trigger a new build, since the build error looks unrelated.
maybe current trunk is flaky?
LGTM but you should probably also wait for @aaron.ballman or @rsmith to also chime in.
clang/test/Frontend/noderef.c | ||
---|---|---|
71 | Can you add tests for the weird situations where the expression actually is evaluated? e.g., struct S { virtual ~S(); // Make S polymorphic }; S NODEREF *s; typeid(*s); // Actually evaluates *s at runtime struct T { unsigned i; }; T t1; T NODEREF *t2 = &t1; sizeof(int[++t2->i]); // Actually evaluates t2->i at runtime |
As requested by @aaron.ballman, added tests for edgecases where
sizeof()/typeid() can cause memory access.
clang/test/Frontend/noderef.c | ||
---|---|---|
71 | Oh jeez, good point. I'm extremely happy that other people have done the hard work of building the ExpressionEvaluationContext logic... I've added tests for the cases you described. |
Happy to do so -- are you okay with "Jann Horn <jannh@google.com>" for author attribution?
Thank you for the patch! I've committed the changes for you in 00dad9d028ce31739b992a3ce2df5de054a9fa3c
Can you add tests for the weird situations where the expression actually is evaluated? e.g.,