summaryrefslogtreecommitdiffstats
path: root/build/build-clang/return-empty-string-non-mangled.patch
blob: 33a39170399d19b436c5a6d13bd2d4d355d27bb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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)) {