[PATCH] D158069: [clang][Interp] Fix getIndex() for composite array elements
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 28 09:10:06 PDT 2023
aaron.ballman added inline comments.
================
Comment at: clang/lib/AST/Interp/Context.h:88
+ /// Returns the program. This is only needed for unittests.
+ Program &getProgram() const { return *P.get(); }
+
----------------
tbaeder wrote:
> cor3ntin wrote:
> > This should return a const ref
> Things like `getGlobal()` aren't const so that doesn't work.
If this is only needed for testing, can we make it a private function and use friendship to expose it to just what needs it? (Esp because it's got some odd const-correctness properties to it.)
================
Comment at: clang/lib/AST/Interp/Pointer.h:81-88
+ /// Equality operators are just for tests.
+ bool operator==(const Pointer &P) const {
+ return Pointee == P.Pointee && Base == P.Base && Offset == P.Offset;
+ }
+
+ bool operator!=(const Pointer &P) const {
+ return Pointee != P.Pointee || Base != P.Base || Offset != P.Offset;
----------------
Same here -- can these be private and friended?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158069/new/
https://reviews.llvm.org/D158069
More information about the cfe-commits
mailing list