Author: Timm Bäder Date: 2024-12-03T13:35:57+01:00 New Revision: 61c2ac03d85f731d75cda23d1918f03d0cb962dc
URL: https://github.com/llvm/llvm-project/commit/61c2ac03d85f731d75cda23d1918f03d0cb962dc DIFF: https://github.com/llvm/llvm-project/commit/61c2ac03d85f731d75cda23d1918f03d0cb962dc.diff LOG: Revert "[clang][bytecode] Handle __builtin_wcslen (#118446)" This reverts commit 89a0ee89973c3d213c4bc11c26b41eab67e06da0. This breaks builders: https://lab.llvm.org/buildbot/#/builders/13/builds/3885 Added: Modified: clang/lib/AST/ByteCode/InterpBuiltin.cpp clang/test/AST/ByteCode/builtin-functions.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp index b788656f9484fc..85cffb0c4332df 100644 --- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp +++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp @@ -243,7 +243,7 @@ static bool interp__builtin_strlen(InterpState &S, CodePtr OpPC, unsigned ID = Func->getBuiltinID(); const Pointer &StrPtr = getParam<Pointer>(Frame, 0); - if (ID == Builtin::BIstrlen || ID == Builtin::BIwcslen) + if (ID == Builtin::BIstrlen) diagnoseNonConstexprBuiltin(S, OpPC, ID); if (!CheckArray(S, OpPC, StrPtr)) @@ -1859,8 +1859,6 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F, break; case Builtin::BI__builtin_strlen: case Builtin::BIstrlen: - case Builtin::BI__builtin_wcslen: - case Builtin::BIwcslen: if (!interp__builtin_strlen(S, OpPC, Frame, F, Call)) return false; break; diff --git a/clang/test/AST/ByteCode/builtin-functions.cpp b/clang/test/AST/ByteCode/builtin-functions.cpp index b951c04dde5980..f70b77fe74636b 100644 --- a/clang/test/AST/ByteCode/builtin-functions.cpp +++ b/clang/test/AST/ByteCode/builtin-functions.cpp @@ -15,10 +15,6 @@ #error "huh?" #endif -extern "C" { - typedef decltype(sizeof(int)) size_t; - extern size_t wcslen(const wchar_t *p); -} namespace strcmp { constexpr char kFoobar[6] = {'f','o','o','b','a','r'}; @@ -97,14 +93,6 @@ constexpr const char *a = "foo\0quux"; constexpr char d[] = { 'f', 'o', 'o' }; // no nul terminator. constexpr int bad = __builtin_strlen(d); // both-error {{constant expression}} \ // both-note {{one-past-the-end}} - - constexpr int wn = __builtin_wcslen(L"hello"); - static_assert(wn == 5); - constexpr int wm = wcslen(L"hello"); // both-error {{constant expression}} \ - // both-note {{non-constexpr function 'wcslen' cannot be used in a constant expression}} - - int arr[3]; // both-note {{here}} - int wk = arr[wcslen(L"hello")]; // both-warning {{array index 5}} } namespace nan { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits