[clang] [Clang][WIP] Constant Expressions inside of gcc'asm strings (PR #131003)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 13 09:17:39 PDT 2025
================
@@ -17928,43 +17928,70 @@ std::optional<std::string> Expr::tryEvaluateString(ASTContext &Ctx) const {
return {};
}
-bool Expr::EvaluateCharRangeAsString(std::string &Result,
- const Expr *SizeExpression,
- const Expr *PtrExpression, ASTContext &Ctx,
- EvalResult &Status) const {
- LValue String;
- EvalInfo Info(Ctx, Status, EvalInfo::EM_ConstantExpression);
- Info.InConstantContext = true;
+template <typename T>
+static bool EvaluateCharRangeAsStringImpl(const Expr*, T& Result,
+ const Expr *SizeExpression,
+ const Expr *PtrExpression, ASTContext &Ctx,
+ Expr::EvalResult &Status) {
+ LValue String;
+ EvalInfo Info(Ctx, Status, EvalInfo::EM_ConstantExpression);
+ Info.InConstantContext = true;
- FullExpressionRAII Scope(Info);
- APSInt SizeValue;
- if (!::EvaluateInteger(SizeExpression, SizeValue, Info))
- return false;
+ FullExpressionRAII Scope(Info);
----------------
cor3ntin wrote:
fixed
https://github.com/llvm/llvm-project/pull/131003
More information about the cfe-commits
mailing list