[PATCH] D134020: [clang][Interp] Handle enums

2022-09-29 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/test/AST/Interp/enums.cpp:25 + SIX = FIVE + 2, + +}; aaron.ballman wrote: > tbaeder wrote: > > aaron.ballman wrote: > > > tbaeder wrote: > > > > aaron.ballman wrote: > > > > > tbaeder wrote: > > > > > > shafik wro

[PATCH] D134749: [clang][Interp] Implement Div opcode

2022-09-29 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder marked an inline comment as done. tbaeder added inline comments. Comment at: clang/test/AST/Interp/literals.cpp:181 + + + constexpr int LHS = 12; aaron.ballman wrote: > The only test coverage is for integer division; do you intend to also cover > floati

[PATCH] D134744: [clang][Interp] Implement rem opcode

2022-09-29 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder marked an inline comment as done. tbaeder added inline comments. Comment at: clang/lib/AST/Interp/Interp.h:164 + + if (RHS.isZero()) { +const SourceInfo &Loc = S.Current->getSource(OpPC); shafik wrote: > You also need to catch when the result is not

[PATCH] D134804: [clang][Interp] Implement bitwise Not operations

2022-09-30 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 464155. tbaeder marked 4 inline comments as done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134804/new/ https://reviews.llvm.org/D134804 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/Integral.h clang/lib/AST/Interp/In

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-09-30 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 464156. tbaeder marked an inline comment as done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134859/new/ https://reviews.llvm.org/D134859 Files: clang/lib/AST/Interp/Boolean.h clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/Byt

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-09-30 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 464161. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134859/new/ https://reviews.llvm.org/D134859 Files: clang/lib/AST/Interp/Boolean.h clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGen.h clang/lib/AST/Interp/Cont

[PATCH] D134801: [clang][Interp] Implement ConditionalOperators

2022-09-30 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 464165. tbaeder marked 3 inline comments as done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134801/new/ https://reviews.llvm.org/D134801 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGen.h clang/test/AST/I

[PATCH] D134801: [clang][Interp] Implement ConditionalOperators

2022-09-30 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/ByteCodeExprGen.h:90 bool VisitOpaqueValueExpr(const OpaqueValueExpr *E); + bool VisitConditionalOperator(const ConditionalOperator *E); aaron.ballman wrote: > Do we want to handle `BinaryCondi

[PATCH] D134699: [clang][Interp] Implement This pointer passing to methods

2022-09-30 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 464179. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134699/new/ https://reviews.llvm.org/D134699 Files: clang/lib/AST/Interp/ByteCodeEmitter.cpp clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGen.h clang/lib/AST/I

[PATCH] D134958: [clang][Interp] Support __builtin_clz calls

2022-09-30 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. I was wondering how to best implement builtin funct

[PATCH] D134958: [clang][Interp] Support __builtin_clz calls

2022-09-30 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/InterpBuiltin.cpp:16-19 + auto Arg = S.Stk.pop>(); + auto Result = Arg.countLeadingZeros(); + S.Stk.push>(Integral<32, true>::from(Result)); + return true; This would also work as: ``` auto Ar

[PATCH] D134958: [clang][Interp] Support __builtin_clz calls

2022-09-30 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment. In D134958#3827024 , @erichkeane wrote: > This seems right enough to me, though you might consider CTZ as well since > it is equally as easy. A better/more useful attempt is going to be > builtin_strlen. Note that with built

[PATCH] D135012: [clang][Interp] Implement bitwise and operations

2022-10-01 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Repository: rG LLVM Github Monorepo https://revi

[PATCH] D135012: [clang][Interp] Implement bitwise and operations

2022-10-01 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 464478. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135012/new/ https://reviews.llvm.org/D135012 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/Integral.h clang/lib/AST/Interp/Interp.h clang/lib/AST/Interp/Opcodes.td

[PATCH] D135013: [clang][Interp] Array initialization via ImplicitValueInitExpr

2022-10-01 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Unfortunately, I have //no idea// how to test this,

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-10-01 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/Floating.h:27-29 + template struct Repr; + template <> struct Repr<32> { using Type = float; }; + template <> struct Repr<64> { using Type = double; }; jcranmer-intel wrote: > aaron.ballman wrote

[PATCH] D135025: [clang][Interp] Support base class constructors

2022-10-02 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. I think this is pretty simple since we get the prop

[PATCH] D135025: [clang][Interp] Support base class constructors

2022-10-02 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 464549. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135025/new/ https://reviews.llvm.org/D135025 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeStmtGen.cpp clang/test/AST/Interp/records.cpp Index: clang/test/AST

[PATCH] D135025: [clang][Interp] Support base class constructors

2022-10-03 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 464618. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135025/new/ https://reviews.llvm.org/D135025 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeStmtGen.cpp clang/test/AST/Interp/records.cpp Index: clang/test/AST

[PATCH] D134699: [clang][Interp] Implement This pointer passing to methods

2022-10-04 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment. Ping CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134699/new/ https://reviews.llvm.org/D134699 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-10-04 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/Floating.h:27-29 + template struct Repr; + template <> struct Repr<32> { using Type = float; }; + template <> struct Repr<64> { using Type = double; }; jcranmer-intel wrote: > tbaeder wrote: > >

[PATCH] D135012: [clang][Interp] Implement bitwise and operations

2022-10-04 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 464902. tbaeder marked 2 inline comments as done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135012/new/ https://reviews.llvm.org/D135012 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/Integral.h clang/lib/AST/Interp/In

[PATCH] D135025: [clang][Interp] Support base class constructors

2022-10-04 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 464913. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135025/new/ https://reviews.llvm.org/D135025 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeStmtGen.cpp clang/test/AST/Interp/records.cpp Index: clang/test/AST

[PATCH] D135025: [clang][Interp] Support base class constructors

2022-10-04 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 464915. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135025/new/ https://reviews.llvm.org/D135025 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGen.h clang/lib/AST/Interp/ByteCodeStmtGen.cpp clang/test/AST/

[PATCH] D135012: [clang][Interp] Implement bitwise and operations

2022-10-04 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/test/AST/Interp/literals.cpp:289 + static_assert((1337 & -1) == 1337, ""); + static_assert((0 & gimme(12)) == 0, ""); +}; shafik wrote: > Why `gimme(12)` and not just `12`? I just thought it might be useful to te

[PATCH] D135025: [clang][Interp] Support base class constructors

2022-10-04 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder marked an inline comment as done. tbaeder added inline comments. Comment at: clang/lib/AST/Interp/ByteCodeExprGen.h:263 +QualType T = E->getType(); +if (const auto *PT = dyn_cast(T)) + T = PT->getPointeeType(); erichkeane wrote: > We are de-p

[PATCH] D135025: [clang][Interp] Support base class constructors

2022-10-04 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder marked an inline comment as done. tbaeder added inline comments. Comment at: clang/test/AST/Interp/records.cpp:165 + +class A : public Base { +public: erichkeane wrote: > tbaeder wrote: > > erichkeane wrote: > > > shafik wrote: > > > > How about also test

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-10-04 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/Floating.h:27-29 + template struct Repr; + template <> struct Repr<32> { using Type = float; }; + template <> struct Repr<64> { using Type = double; }; aaron.ballman wrote: > tbaeder wrote: > > j

[PATCH] D135025: [clang][Interp] Support base class constructors

2022-10-04 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/test/AST/Interp/records.cpp:165 + +class A : public Base { +public: tbaeder wrote: > erichkeane wrote: > > tbaeder wrote: > > > erichkeane wrote: > > > > shafik wrote: > > > > > How about also testing `private` and

[PATCH] D135025: [clang][Interp] Support base class constructors

2022-10-04 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 465271. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135025/new/ https://reviews.llvm.org/D135025 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGen.h clang/lib/AST/Interp/ByteCodeStmtGen.cpp clang/test/AST/

[PATCH] D134699: [clang][Interp] Implement This pointer passing to methods

2022-10-04 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 465279. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134699/new/ https://reviews.llvm.org/D134699 Files: clang/lib/AST/Interp/ByteCodeEmitter.cpp clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGen.h clang/lib/AST/I

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-10-05 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/Floating.h:27-29 + template struct Repr; + template <> struct Repr<32> { using Type = float; }; + template <> struct Repr<64> { using Type = double; }; dblaikie wrote: > jcranmer-intel wrote: > >

[PATCH] D134749: [clang][Interp] Implement Div opcode

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 465667. tbaeder marked an inline comment as done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134749/new/ https://reviews.llvm.org/D134749 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/Integral.h clang/lib/AST/Interp/In

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 465702. tbaeder added a comment. Another try, this time without any underlying host type. There are a few things I'm uncertain about. The tests are obviously not enough, especially now that I had to add another `CastFP` opcode to cast floats between differe

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/Floating.h:33-34 + /// Primitive representing limits. + // static constexpr auto Min = std::numeric_limits::min(); + // static constexpr auto Max = std::numeric_limits::max(); + This is currently

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 465703. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134859/new/ https://reviews.llvm.org/D134859 Files: clang/lib/AST/CMakeLists.txt clang/lib/AST/Interp/Boolean.h clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGe

[PATCH] D134699: [clang][Interp] Implement This pointer passing to methods

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment. @aaron.ballman This one has working precommit CI \o/ (array filler patch is not needed for it though) CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134699/new/ https://reviews.llvm.org/D134699 ___ cfe-commits mailing

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 465708. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134859/new/ https://reviews.llvm.org/D134859 Files: clang/lib/AST/CMakeLists.txt clang/lib/AST/Interp/Boolean.h clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGe

[PATCH] D135361: [clang][Interp] Implement bitwise Or operations

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Repository: rG LLVM Github Monorepo https://revi

[PATCH] D135366: [clang][Interp] Implement String- and CharacterLiterals

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Repository: rG LLVM Github Monorepo https://revi

[PATCH] D134749: [clang][Interp] Implement Div opcode

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment. In D134749#3839980 , @aaron.ballman wrote: > LGTM aside from a simple refactoring (feel free to apply it when landing or > do it post-commit as an NFC change). I actually suggested something like this review :P I'll write it do

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/Interp.cpp:421 +bool CastFP(InterpState &S, CodePtr OpPC, const llvm::fltSemantics *Sem) { + Floating F = S.Stk.pop(); jcranmer-intel wrote: > FWIW, `const llvm::fltSemantics &` is the usual way i

[PATCH] D134699: [clang][Interp] Implement This pointer passing to methods

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder marked an inline comment as done. tbaeder added inline comments. Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:638 if (const auto CtorExpr = dyn_cast(Initializer)) { -const CXXConstructorDecl *Ctor = CtorExpr->getConstructor(); -const RecordDecl *RD = Ct

[PATCH] D134699: [clang][Interp] Implement This pointer passing to methods

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/test/AST/Interp/records.cpp:106 + +constexpr C RVOAndParams(const C *c) { + return C(); aaron.ballman wrote: > We're missing a fair amount of test coverage here in terms of calling member > functions. Can you add

[PATCH] D134699: [clang][Interp] Implement This pointer passing to methods

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 465966. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134699/new/ https://reviews.llvm.org/D134699 Files: clang/lib/AST/Interp/ByteCodeEmitter.cpp clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGen.h clang/lib/AST/I

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 465967. tbaeder marked 2 inline comments as done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134859/new/ https://reviews.llvm.org/D134859 Files: clang/lib/AST/CMakeLists.txt clang/lib/AST/Interp/Boolean.h clang/lib/AST/Interp/ByteCodeExprGen

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/Floating.h:33-34 + /// Primitive representing limits. + // static constexpr auto Min = std::numeric_limits::min(); + // static constexpr auto Max = std::numeric_limits::max(); + jcranmer-intel wro

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 465968. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134859/new/ https://reviews.llvm.org/D134859 Files: clang/lib/AST/CMakeLists.txt clang/lib/AST/Interp/Boolean.h clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGe

[PATCH] D135366: [clang][Interp] Implement String- and CharacterLiterals

2022-10-06 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:447 +APInt Val(getIntWidth(LitType), E->getValue()); +return this->emitConst(*T, 0, Val, E); + } The `0` here is unused in `emitConst` anyway. I have a follow-up NFC patc

[PATCH] D135433: [clang][Interp] Implement while and do-while loops

2022-10-07 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, shafik, tahonermann. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. I was wondering whether it is somehow possible to g

[PATCH] D135433: [clang][Interp] Implement while and do-while loops

2022-10-07 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 466022. tbaeder added a comment. Add `break` and `continue` support as well. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135433/new/ https://reviews.llvm.org/D135433 Files: clang/lib/AST/Interp/ByteCodeStmtGen.cpp clang/lib/AST/Interp/ByteCod

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-10-07 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 466027. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134859/new/ https://reviews.llvm.org/D134859 Files: clang/lib/AST/CMakeLists.txt clang/lib/AST/Interp/Boolean.h clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGe

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-10-07 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 466031. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134859/new/ https://reviews.llvm.org/D134859 Files: clang/lib/AST/CMakeLists.txt clang/lib/AST/Interp/Boolean.h clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGe

[PATCH] D135433: [clang][Interp] Implement while and do-while loops

2022-10-07 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/test/AST/Interp/loops.cpp:93 + } + static_assert(f4() == 5, ""); +}; aaron.ballman wrote: > Can you also add some tests that use nested loops with multiple levels of > `break` and `continue` use? > > Also, I th

[PATCH] D135433: [clang][Interp] Implement while and do-while loops

2022-10-07 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 466259. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135433/new/ https://reviews.llvm.org/D135433 Files: clang/lib/AST/Interp/ByteCodeStmtGen.cpp clang/lib/AST/Interp/ByteCodeStmtGen.h clang/test/AST/Interp/loops.cpp Index: clang/test/AST/Int

[PATCH] D135366: [clang][Interp] Implement String- and CharacterLiterals

2022-10-08 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 466262. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135366/new/ https://reviews.llvm.org/D135366 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGen.h clang/test/AST/Interp/arrays.cpp Index: clang/test/AST/I

[PATCH] D135366: [clang][Interp] Implement String- and CharacterLiterals

2022-10-08 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:446 + if (Optional T = classify(LitType)) { +APInt Val(getIntWidth(LitType), E->getValue()); +return this->emitConst(*T, 0, Val, E); aaron.ballman wrote: > Should this be

[PATCH] D135513: [clang][Interp] Check instance pointers before calling functions on them

2022-10-08 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, shafik, tahonermann. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Remove the double Call() implementation to reduce c

[PATCH] D135513: [clang][Interp] Check instance pointers before calling functions on them

2022-10-08 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 466280. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135513/new/ https://reviews.llvm.org/D135513 Files: clang/lib/AST/Interp/EvalEmitter.cpp clang/lib/AST/Interp/Function.cpp clang/lib/AST/Interp/Interp.cpp clang/lib/AST/Interp/Interp.h c

[PATCH] D135513: [clang][Interp] Check instance pointers before calling functions on them

2022-10-08 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 466281. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135513/new/ https://reviews.llvm.org/D135513 Files: clang/lib/AST/Interp/EvalEmitter.cpp clang/lib/AST/Interp/Function.cpp clang/lib/AST/Interp/Interp.cpp clang/lib/AST/Interp/Interp.h c

[PATCH] D135513: [clang][Interp] Check instance pointers before calling functions on them

2022-10-08 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 466282. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135513/new/ https://reviews.llvm.org/D135513 Files: clang/lib/AST/Interp/EvalEmitter.cpp clang/lib/AST/Interp/Function.cpp clang/lib/AST/Interp/Interp.cpp clang/lib/AST/Interp/Interp.h c

[PATCH] D135433: [clang][Interp] Implement while and do-while loops

2022-10-10 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/test/AST/Interp/loops.cpp:9 + +namespace WhileLoop { + constexpr int f() { shafik wrote: > infinite loop w/o a side effect are undefined behavior and so should be > ill-formed and generate a diagnostic e.g. `whil

[PATCH] D135366: [clang][Interp] Implement String- and CharacterLiterals

2022-10-10 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 466461. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135366/new/ https://reviews.llvm.org/D135366 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGen.h clang/test/AST/Interp/arrays.cpp Index: clang/test/AST/I

[PATCH] D135569: [clang][Interp] Don't run functions immediately after compiling them

2022-10-10 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. I'm not 100% sure why this was done in the first pl

[PATCH] D135569: [clang][Interp] Don't run functions immediately after compiling them

2022-10-10 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment. In D135569#3847493 , @aaron.ballman wrote: > This function is testing whether something is potentially a constant > expression. Something might not be a valid constant expression for two > reasons: 1) it uses some prohibited la

[PATCH] D135513: [clang][Interp] Check instance pointers before calling functions on them

2022-10-10 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/Interp.h:1166 +// TODO: CheckCallable + } + I think this is okay to do for now, but in the long run we need to check *all* the parameters passed to function calls... CHANGES SINCE LAST ACTION

[PATCH] D135366: [clang][Interp] Implement String- and CharacterLiterals

2022-10-10 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder marked 3 inline comments as done. tbaeder added inline comments. Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:445-446 +const CharacterLiteral *E) { + if (Optional T = classify(E->getType())) +return this->emitConst(E, E->getValue()); + ta

[PATCH] D135366: [clang][Interp] Implement String- and CharacterLiterals

2022-10-10 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 466700. tbaeder marked an inline comment as done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135366/new/ https://reviews.llvm.org/D135366 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGen.h clang/test/AST/I

[PATCH] D135558: [Clang][NFC]Use isa instead of dyn_cast in shouldAddReversedEqEq

2022-10-10 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment. This was fixed as https://github.com/llvm/llvm-project/commit/6c49d5db30227d21e929bb12dc046c36ede67fad. Note that for such patches, you don't need to wait for review, like Erich didn't. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews

[PATCH] D135513: [clang][Interp] Check instance pointers before calling functions on them

2022-10-11 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/Function.cpp:39 + assert(It != SrcMap.end()); + It--; // We want the offset *before* the given one. return It->second; While I think the comment here is correct, the decrement itself certainly i

[PATCH] D135750: [clang][Interp] Track initialization state of local variables

2022-10-11 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. This patch is a bit all over the place, sorry for t

[PATCH] D135025: [clang][Interp] Support base class constructors

2022-10-11 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment. Anything still missing here? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135025/new/ https://reviews.llvm.org/D135025 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/li

[PATCH] D135013: [clang][Interp] Array initialization via ImplicitValueInitExpr

2022-10-11 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment. Ping Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135013/new/ https://reviews.llvm.org/D135013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[PATCH] D134859: [clang][Interp] Implement basic support for floating point values

2022-10-11 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment. Any other opinions on the new approach? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134859/new/ https://reviews.llvm.org/D134859 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[PATCH] D134699: [clang][Interp] Implement This pointer passing to methods

2022-10-11 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/test/AST/Interp/records.cpp:139 + // ref-note {{in call to 'foo()'}} +}; aaron.ballman wrote: > The other thing I think we need some tests for are constructor and destructor > call

[PATCH] D135366: [clang][Interp] Implement String- and CharacterLiterals

2022-10-12 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/test/AST/Interp/arrays.cpp:143 + +}; cor3ntin wrote: > tahonermann wrote: > > cor3ntin wrote: > > > tbaeder wrote: > > > > cor3ntin wrote: > > > > > tahonermann wrote: > > > > > > As others already noted, additiona

[PATCH] D135764: [clang][Interp] Implement for loops

2022-10-12 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Repository: rG LLVM Github Monorepo https://revi

[PATCH] D135858: [clang][Interp] Support pointer arithmethic in binary operators

2022-10-13 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Repository: rG LLVM Github Monorepo https://revi

[PATCH] D135366: [clang][Interp] Implement String- and CharacterLiterals

2022-10-13 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 467399. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135366/new/ https://reviews.llvm.org/D135366 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGen.h clang/test/AST/Interp/literals.cpp clang/test/Lexer/char

[PATCH] D134699: [clang][Interp] Implement This pointer passing to methods

2022-10-13 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder marked an inline comment as done. tbaeder added inline comments. Comment at: clang/lib/AST/Interp/EvalEmitter.cpp:108 - S.Current = - new InterpFrame(S, const_cast(Func), S.Current, {}, {}); + S.Current = new InterpFrame(S, const_cast(Func), {}); // Result of

[PATCH] D135013: [clang][Interp] Array initialization via ImplicitValueInitExpr

2022-10-13 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 467691. tbaeder marked 2 inline comments as done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135013/new/ https://reviews.llvm.org/D135013 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/test/AST/Interp/arrays.cpp Index: clang/test/AST/

[PATCH] D135013: [clang][Interp] Array initialization via ImplicitValueInitExpr

2022-10-13 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment. Thanks for the reproducer! Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:748 + } else { +assert(false && "default initializer for non-primitive type"); + } shafik wrote: > I guess this covers both arrays and cla

[PATCH] D135025: [clang][Interp] Support base class constructors

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 467699. tbaeder marked an inline comment as done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135025/new/ https://reviews.llvm.org/D135025 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGen.h clang/lib/AST/In

[PATCH] D135025: [clang][Interp] Support base class constructors

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder marked an inline comment as done. tbaeder added inline comments. Comment at: clang/test/AST/Interp/records.cpp:209 + static_assert(d.getA() == 20); + static_assert(d.getB() == 30); +}; aaron.ballman wrote: > I'd appreciate some more failure test cases,

[PATCH] D135858: [clang][Interp] Support pointer arithmethic in binary operators

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:241 + // Pointer arithmethic special case. This is supported for one of + // LHS and RHS being a pointer type and the other being an integer type. + if (BO->getType()->isPointerType()) { --

[PATCH] D135569: [clang][Interp] Don't run functions immediately after compiling them

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG1928da1ef73c: [clang][Interp] Don't run functions immediately after compiling them (authored by tbaeder). Changed prior to commit: https://reviews.llvm.org/D135569?vs=466462&id=467706#toc Repository:

[PATCH] D134057: [clang][Interp] Start implementing record types

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. tbaeder marked an inline comment as done. Closed by commit rG1942a2538b86: [clang][Interp] Start implementing record types (authored by tbaeder). Changed prior to comm

[PATCH] D134699: [clang][Interp] Implement This pointer passing to methods

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. tbaeder marked an inline comment as done. Closed by commit rG0ddd13acc9e9: [clang][Interp] Implement This pointer passing to methods (authored by tbaeder). Changed pri

[PATCH] D134175: [clang][Interp] Implement record instance functions and returning struct types

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGcb5f205828e6: [clang][Interp] Implement nested struct initialization (authored by tbaeder). Repository: rG LLVM Github Monorepo CHANGES SINCE LAS

[PATCH] D134361: [clang][Interp] Fix copy constructors of structs with array members

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG33b52836de6e: [clang][Interp] Fix using default copy constructors (authored by tbaeder). Changed prior to commit: https://reviews.llvm.org/D134361

[PATCH] D134523: [clang][Interp] Fix copy constructors with record array members

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG6e83209f623e: [clang][Interp] Fix copy constructors with record array members (authored by tbaeder). Changed prior to commit: https://reviews.llvm

[PATCH] D134804: [clang][Interp] Implement bitwise Not operations

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG542123465f9e: [clang][Interp] Implement bitwise not operations (authored by tbaeder). Changed prior to commit: https://reviews.llvm.org/D134804?vs

[PATCH] D134744: [clang][Interp] Implement rem opcode

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGc9ad877844a7: [clang][Interp] Implement rem opcode (authored by tbaeder). Changed prior to commit: https://reviews.llvm.org/D134744?vs=463543&id=4

[PATCH] D134749: [clang][Interp] Implement Div opcode

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGd704ba26b914: [clang][Interp] Implement div opcode (authored by tbaeder). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https:/

[PATCH] D134629: [clang][Interp] Fix Pointer::toAPValue() LValuePath order

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder closed this revision. tbaeder added a comment. Meh, looks like I forgot to fix up the commit message for https://github.com/llvm/llvm-project/commit/4d2d426a51e122231443d89b196b0c6e91a5b147. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134629/new/ https://reviews.llvm.org/D134

[PATCH] D134801: [clang][Interp] Implement ConditionalOperators

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG77aaf469a7ae: [clang][Interp] Implement ConditionalOperators (authored by tbaeder). Changed prior to commit: https://reviews.llvm.org/D134801?vs=4

[PATCH] D135012: [clang][Interp] Implement bitwise and operations

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG62a58050ba0a: [clang][Interp] Implement bitwise and operations (authored by tbaeder). Changed prior to commit: https://reviews.llvm.org/D135012?vs

[PATCH] D135361: [clang][Interp] Implement bitwise Or operations

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGce4d5ae9dcf6: [clang][Interp] Implement bitwise Or operations (authored by tbaeder). Changed prior to commit: https://reviews.llvm.org/D135361?vs=

[PATCH] D135433: [clang][Interp] Implement while and do-while loops

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. tbaeder marked an inline comment as done. Closed by commit rG5a859432f317: [clang][Interp] Implement while and do-while loops (authored by tbaeder). Changed prior to commit: https://reviews.llvm.org/D135433?vs=466259&id=4

[PATCH] D135013: [clang][Interp] Array initialization via ImplicitValueInitExpr

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment. In D135013#3860317 , @shafik wrote: > I found a way to get `ImplictValueInitExpr` for a record: > https://godbolt.org/z/Eqf9Gz1G4 > > I am not sure if we can achieve the same in C++ b/c value init of a class > break down to defa

<    1   2   3   4   5   6   7   8   9   10   >