build/build-clang/return-empty-string-non-mangled.patch
author Mike Hommey <mh+mozilla@glandium.org>
Thu, 07 Apr 2016 14:30:44 +0900
changeset 349600 b1f6d9b41d1210751d94e43ae0255fdbb2b3aa5d
parent 329698 13d0b431096a0f17a02ca3647a891425db37a136
child 349707 c238f26a56f29c4ab1e355441fa9c965e7fcb04a
permissions -rw-r--r--
Bug 1262735 - Change the clang paths in patches added in bug 1210154. r?ehsan

commit 009de5ea7a1913f0b4619cf514787bd52af38c28
Author: Michael Wu <mwu@mozilla.com>
Date:   Thu Sep 24 11:36:08 2015 -0400

    Return an empty string when a symbol isn't mangled

diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 9fa18d3..1253832 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -3891,6 +3891,10 @@ CXString clang_Cursor_getMangling(CXCursor C) {
   ASTContext &Ctx = ND->getASTContext();
   std::unique_ptr<MangleContext> MC(Ctx.createMangleContext());
 
+  // Don't mangle if we don't need to.
+  if (!MC->shouldMangleCXXName(ND))
+    return cxstring::createEmpty();
+
   std::string FrontendBuf;
   llvm::raw_string_ostream FrontendBufOS(FrontendBuf);
   MC->mangleName(ND, FrontendBufOS);