From d82effb962fa2a1d2d4263357783fd29880a3d8b 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_master/tools/clang/lib/Lex/HeaderMap.cpp macports_master/tools/clang/lib/Lex/HeaderMap.cpp index 24a14b6cdb..c38986d46c 100644 --- llvm_master/tools/clang/lib/Lex/HeaderMap.cpp +++ macports_master/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.17.1 (Apple Git-112)