[llvm-branch-commits] [clang] [clang][builtin] Implement __builtin_allow_runtime_check (PR #87568)

Aaron Ballman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Apr 10 11:48:05 PDT 2024


================
@@ -3233,6 +3233,17 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
     if (BuiltinCountZeroBitsGeneric(*this, TheCall))
       return ExprError();
     break;
+
+  case Builtin::BI__builtin_allow_runtime_check: {
+    Expr *Arg = TheCall->getArg(0);
+    // Check if the argument is a string literal.
+    if (!isa<StringLiteral>(Arg->IgnoreParenImpCasts())) {
----------------
AaronBallman wrote:

This might be a reasonable restriction, but consider other cases like: `constexpr` variable of string type, `constexpr` function call that returns a `const char *`, `_Generic` that results in a string constant, etc. Would those be reasonable to support?

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


More information about the llvm-branch-commits mailing list