File tree Expand file tree Collapse file tree 2 files changed +24
-19
lines changed Expand file tree Collapse file tree 2 files changed +24
-19
lines changed Original file line number Diff line number Diff line change @@ -1619,18 +1619,17 @@ struct overloaded : Ts...
1619
1619
};
1620
1620
template <class ... Ts>
1621
1621
overloaded (Ts...) -> overloaded<Ts...>;
1622
+ // -----------------------------------------------------------------------------
1622
1623
1623
- bool P0315Visitor::VisitLambdaExpr ( const LambdaExpr* expr)
1624
+ void P0315Visitor_HandleLambdaExpr (OutputFormatHelper& ofm, const LambdaExpr* expr)
1624
1625
{
1625
- mLambdaExpr = expr;
1626
-
1627
- std::visit (overloaded{
1628
- [&](OutputFormatHelper& ofm) { ofm.Append (GetLambdaName (*expr)); },
1629
- [&](CodeGenerator& cg) { cg.InsertArg (expr); },
1630
- },
1631
- mConsumer );
1626
+ ofm.Append (GetLambdaName (*expr));
1627
+ }
1628
+ // -----------------------------------------------------------------------------
1632
1629
1633
- return false ;
1630
+ void P0315Visitor_HandleLambdaExpr (CodeGenerator& cg, const LambdaExpr* expr)
1631
+ {
1632
+ cg.InsertArg (expr);
1634
1633
}
1635
1634
// -----------------------------------------------------------------------------
1636
1635
Original file line number Diff line number Diff line change 17
17
#include < functional>
18
18
#include < optional>
19
19
#include < string>
20
- #include < variant>
21
20
22
21
#include " InsightsStrongTypes.h"
23
22
#include " StackList.h"
@@ -355,25 +354,32 @@ is(T) -> is<T>;
355
354
const DeclRefExpr* FindDeclRef (const Stmt* stmt);
356
355
// -----------------------------------------------------------------------------
357
356
357
+ void P0315Visitor_HandleLambdaExpr (class OutputFormatHelper &, const LambdaExpr*);
358
+ void P0315Visitor_HandleLambdaExpr (class CodeGenerator &, const LambdaExpr*);
359
+ // -----------------------------------------------------------------------------
360
+
358
361
// /! Find a LambdaExpr inside a Decltype
359
- class P0315Visitor : public RecursiveASTVisitor <P0315Visitor>
362
+ template <typename T>
363
+ requires (std::derived_from<T, CodeGenerator> or std::same_as<T, OutputFormatHelper>)
364
+ class P0315Visitor : public RecursiveASTVisitor <P0315Visitor<T>>
360
365
{
361
- std::variant<std::reference_wrapper<class OutputFormatHelper >, std::reference_wrapper<class CodeGenerator >>
362
- mConsumer ;
366
+ T& mConsumer ;
363
367
const LambdaExpr* mLambdaExpr {};
364
368
365
369
public:
366
- P0315Visitor (class OutputFormatHelper & ofm )
367
- : mConsumer {ofm }
370
+ constexpr P0315Visitor (T& consumer )
371
+ : mConsumer{consumer }
368
372
{
369
373
}
370
374
371
- P0315Visitor (class CodeGenerator & cg)
372
- : mConsumer {cg}
375
+ bool VisitLambdaExpr (const LambdaExpr* expr)
373
376
{
374
- }
377
+ mLambdaExpr = expr;
378
+
379
+ P0315Visitor_HandleLambdaExpr (mConsumer , expr);
375
380
376
- bool VisitLambdaExpr (const LambdaExpr* expr);
381
+ return false ;
382
+ }
377
383
378
384
const LambdaExpr* Get () const { return mLambdaExpr ; }
379
385
};
You can’t perform that action at this time.
0 commit comments