[clang] [z.OS] fix strnlen() usage in Context.cpp available on z/OS (PR #160339)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 23 09:23:06 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Zibi Sarbinowski (zibi2)

<details>
<summary>Changes</summary>

On z/OS `strnlen()` is not available by default so we use the wrapper header `zOSSupport.h` to make it visible. This will fix the following error:

```
clang/lib/AST/ByteCode/Context.cpp:250:16: error: use of undeclared identifier 'strnlen'
  250 |       Result = strnlen(reinterpret_cast<const char *>(Ptr.getRawAddress()), N);
      |                ^~~~~~~
1 error generated.
```

---
Full diff: https://github.com/llvm/llvm-project/pull/160339.diff


1 Files Affected:

- (modified) clang/lib/AST/ByteCode/Context.cpp (+1) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/Context.cpp b/clang/lib/AST/ByteCode/Context.cpp
index 8860bcc54a9c1..71d0bcf61a5ff 100644
--- a/clang/lib/AST/ByteCode/Context.cpp
+++ b/clang/lib/AST/ByteCode/Context.cpp
@@ -18,6 +18,7 @@
 #include "clang/AST/ASTLambda.h"
 #include "clang/AST/Expr.h"
 #include "clang/Basic/TargetInfo.h"
+#include "llvm/Support/SystemZ/zOSSupport.h"
 
 using namespace clang;
 using namespace clang::interp;

``````````

</details>


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


More information about the cfe-commits mailing list