Skip to content

Commit 61c2ac0

Browse files
committed
Revert "[clang][bytecode] Handle __builtin_wcslen (#118446)"
This reverts commit 89a0ee8. This breaks builders: https://lab.llvm.org/buildbot/#/builders/13/builds/3885
1 parent b2df007 commit 61c2ac0

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static bool interp__builtin_strlen(InterpState &S, CodePtr OpPC,
243243
unsigned ID = Func->getBuiltinID();
244244
const Pointer &StrPtr = getParam<Pointer>(Frame, 0);
245245

246-
if (ID == Builtin::BIstrlen || ID == Builtin::BIwcslen)
246+
if (ID == Builtin::BIstrlen)
247247
diagnoseNonConstexprBuiltin(S, OpPC, ID);
248248

249249
if (!CheckArray(S, OpPC, StrPtr))
@@ -1859,8 +1859,6 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F,
18591859
break;
18601860
case Builtin::BI__builtin_strlen:
18611861
case Builtin::BIstrlen:
1862-
case Builtin::BI__builtin_wcslen:
1863-
case Builtin::BIwcslen:
18641862
if (!interp__builtin_strlen(S, OpPC, Frame, F, Call))
18651863
return false;
18661864
break;

clang/test/AST/ByteCode/builtin-functions.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
#error "huh?"
1616
#endif
1717

18-
extern "C" {
19-
typedef decltype(sizeof(int)) size_t;
20-
extern size_t wcslen(const wchar_t *p);
21-
}
2218

2319
namespace strcmp {
2420
constexpr char kFoobar[6] = {'f','o','o','b','a','r'};
@@ -97,14 +93,6 @@ constexpr const char *a = "foo\0quux";
9793
constexpr char d[] = { 'f', 'o', 'o' }; // no nul terminator.
9894
constexpr int bad = __builtin_strlen(d); // both-error {{constant expression}} \
9995
// both-note {{one-past-the-end}}
100-
101-
constexpr int wn = __builtin_wcslen(L"hello");
102-
static_assert(wn == 5);
103-
constexpr int wm = wcslen(L"hello"); // both-error {{constant expression}} \
104-
// both-note {{non-constexpr function 'wcslen' cannot be used in a constant expression}}
105-
106-
int arr[3]; // both-note {{here}}
107-
int wk = arr[wcslen(L"hello")]; // both-warning {{array index 5}}
10896
}
10997

11098
namespace nan {

0 commit comments

Comments
 (0)