[clang] Add support for builtin_verbose_trap (PR #79230)

Dan Liew via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 1 14:10:18 PST 2024


================
@@ -775,6 +775,11 @@ class Expr : public ValueStmt {
                                  const Expr *PtrExpression, ASTContext &Ctx,
                                  EvalResult &Status) const;
 
+  /// If the current Expr can be evaluated to a pointer to a null-terminated
+  /// constant string, return the constant string (without the terminating null)
+  /// in Result. Return true if it succeeds.
+  bool tryEvaluateString(std::string &Result, ASTContext &Ctx) const;
----------------
delcypher wrote:

Nit:  Returning `std::optional<std::string>` might be a cleaner API to provide.

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


More information about the cfe-commits mailing list