From fbce72a5f9f5ad4d09e162bafda76ce4a8fd3159 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Sequoia Date: Tue, 20 Dec 2016 15:53:39 -0800 Subject: [PATCH 1007/1008] Fix build issues pre-Lion due to missing a strnlen definition https://trac.macports.org/ticket/51520 https://llvm.org/bugs/show_bug.cgi?id=27714 Signed-off-by: Jeremy Huddleston Sequoia --- lib/Lex/HeaderMap.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git llvm_release_80/tools/clang/lib/Lex/HeaderMap.cpp macports_release_80/tools/clang/lib/Lex/HeaderMap.cpp index 23cb053c2d..f99ae9ede8 100644 --- llvm_release_80/tools/clang/lib/Lex/HeaderMap.cpp +++ macports_release_80/tools/clang/lib/Lex/HeaderMap.cpp @@ -26,6 +26,20 @@ #include using namespace clang; +#ifdef __APPLE__ +#include +#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070 +static size_t strnlen(const char *s, size_t maxlen) { + size_t l = 0; + while (l < maxlen && *s) { + l++; + s++; + } + return l; +} +#endif +#endif + /// HashHMapKey - This is the 'well known' hash function required by the file /// format, used to look up keys in the hash table. The hash table uses simple /// linear probing based on this function. -- 2.20.1 (Apple Git-116)