1Workaround segfault in clang's mangling code that is tickled when
2attempting to mangle the declaration:
3 std:__ndk1::__find_detail::__find_exactly_one_checked::__matches
4in the <tuple> header in the Android NDK.
5This codepath is exercised by MozsearchIndexer.cpp (the searchfox
6indexer) when indexing on Android. See also
7https://bugs.llvm.org/show_bug.cgi?id=40747
8
9diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
10index 4420f6a2c1c3..39792e6b7350 100644
11--- a/clang/lib/AST/ItaniumMangle.cpp
12+++ b/clang/lib/AST/ItaniumMangle.cpp
13@@ -3954,6 +3954,11 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity,
14   // produces no output, where ImplicitlyConvertedToType and AsTemplateArg need
15   // to be preserved.
16 recurse:
17+  if (!E) {
18+    Out << "MOZ_WE_HACKED_AROUND_BUG_1500941";
19+    return;
20+  }
21+
22   switch (E->getStmtClass()) {
23   case Expr::NoStmtClass:
24 #define ABSTRACT_STMT(Type)
25