\brief Evaluates a potential NTTP as a constant expression. Used for C++20's struct/class as NTTP.
| 1765 | /// |
| 1766 | /// Used for C++20's struct/class as NTTP. |
| 1767 | static std::optional<std::pair<QualType, APValue>> EvaluateNTTPAsConstantExpr(const Expr* expr) |
| 1768 | { |
| 1769 | expr = expr->IgnoreParenImpCasts(); |
| 1770 | |
| 1771 | // The marker when it is a C++20 class as NTTP seems to be CXXFunctionalCastExpr |
| 1772 | if(Expr::EvalResult evalResult{}; |
| 1773 | isa<CXXFunctionalCastExpr>(expr) and |
| 1774 | expr->EvaluateAsConstantExpr(evalResult, GetGlobalAST(), ConstantExprKind::Normal)) { |
| 1775 | return std::pair<QualType, APValue>{expr->getType(), evalResult.Val}; |
| 1776 | } |
| 1777 | |
| 1778 | return {}; |
| 1779 | } |
| 1780 | //----------------------------------------------------------------------------- |
| 1781 | |
| 1782 | void CodeGenerator::InsertTemplateParameters(const TemplateParameterList& list, |
no outgoing calls
no test coverage detected