[clang] [clang] Constant-evaluate format strings as last resort (PR #135864)

via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 18 00:13:01 PDT 2025


================
@@ -5935,8 +5936,14 @@ static void CheckFormatString(
     llvm::SmallBitVector &CheckedVarArgs, UncoveredArgHandler &UncoveredArg,
     bool IgnoreStringsWithoutSpecifiers);
 
-static const Expr *maybeConstEvalStringLiteral(ASTContext &Context,
-                                               const Expr *E);
+enum StringLiteralConstEvalResult {
+  SLCER_NotEvaluated,
+  SLCER_NotNullTerminated,
+  SLCER_Evaluated,
+};
+
+static StringLiteralConstEvalResult
+constEvalStringAsLiteral(Sema &S, const Expr *E, const StringLiteral *&SL);
----------------
cor3ntin wrote:

We should really reflect we might create a scratch space here.
Also, can we comment this function?

https://github.com/llvm/llvm-project/pull/135864


More information about the cfe-commits mailing list