<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From 091b885411041c711b0d25c43c73deac9cfbb906 Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston Sequoia &lt;jeremyhu@apple.com&gt;
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 &lt;jeremyhu@apple.com&gt;
---
 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 &lt;memory&gt;
 using namespace clang;
 
+#ifdef __APPLE__
+#include &lt;Availability.h&gt;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED &lt; 1070
+static size_t strnlen(const char *s, size_t maxlen) {
+  size_t l = 0;
+  while (l &lt; maxlen &amp;&amp; *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.13.3

</pre></body></html>