build/build-clang/return-empty-string-non-mangled.patch
author Masayuki Nakano <masayuki@d-toybox.com>
Mon, 18 Apr 2016 23:09:02 +0900
changeset 293961 327c61df0baebf6960ab348335f53b588215eaa7
parent 292931 c24444a009c19e25462c7c191eb3cf4d14f2d264
permissions -rw-r--r--
Bug 1259656 part.1 Rename WidgetEvent::refPoint to WidgetEvent::mRefPoint r=smaug MozReview-Commit-ID: ESWM5ZyBpSR

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
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -3990,6 +3990,10 @@
   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);
   if (MC->shouldMangleDeclName(ND)) {