r260104 - Move static functions returning UDTs outside of the extern "C" block. Silences an MSVC warning, and reduces the number of exported symbols.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 8 07:52:14 PST 2016


Author: aaronballman
Date: Mon Feb  8 09:52:13 2016
New Revision: 260104

URL: http://llvm.org/viewvc/llvm-project?rev=260104&view=rev
Log:
Move static functions returning UDTs outside of the extern "C" block. Silences an MSVC warning, and reduces the number of exported symbols.

Modified:
    cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=260104&r1=260103&r2=260104&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Mon Feb  8 09:52:13 2016
@@ -3996,6 +3996,39 @@ static std::string getMangledStructor(st
   return BOS.str();
 }
 
+static std::string getMangledName(std::unique_ptr<MangleContext> &M,
+                                  std::unique_ptr<llvm::DataLayout> &DL,
+                                  const NamedDecl *ND) {
+  std::string FrontendBuf;
+  llvm::raw_string_ostream FOS(FrontendBuf);
+
+  M->mangleName(ND, FOS);
+
+  std::string BackendBuf;
+  llvm::raw_string_ostream BOS(BackendBuf);
+
+  llvm::Mangler::getNameWithPrefix(BOS, llvm::Twine(FOS.str()), *DL);
+
+  return BOS.str();
+}
+
+static std::string getMangledThunk(std::unique_ptr<MangleContext> &M,
+                                   std::unique_ptr<llvm::DataLayout> &DL,
+                                   const CXXMethodDecl *MD,
+                                   const ThunkInfo &T) {
+  std::string FrontendBuf;
+  llvm::raw_string_ostream FOS(FrontendBuf);
+
+  M->mangleThunk(MD, T, FOS);
+
+  std::string BackendBuf;
+  llvm::raw_string_ostream BOS(BackendBuf);
+
+  llvm::Mangler::getNameWithPrefix(BOS, llvm::Twine(FOS.str()), *DL);
+
+  return BOS.str();
+}
+
 extern "C" {
 
 unsigned clang_visitChildren(CXCursor parent,
@@ -4369,38 +4402,6 @@ CXString clang_Cursor_getMangling(CXCurs
   return cxstring::createDup(FinalBufOS.str());
 }
 
-static std::string getMangledName(std::unique_ptr<MangleContext> &M,
-                                  std::unique_ptr<llvm::DataLayout> &DL,
-                                  const NamedDecl *ND) {
-  std::string FrontendBuf;
-  llvm::raw_string_ostream FOS(FrontendBuf);
-
-  M->mangleName(ND, FOS);
-
-  std::string BackendBuf;
-  llvm::raw_string_ostream BOS(BackendBuf);
-
-  llvm::Mangler::getNameWithPrefix(BOS, llvm::Twine(FOS.str()), *DL);
-
-  return BOS.str();
-}
-
-static std::string getMangledThunk(std::unique_ptr<MangleContext> &M,
-                                   std::unique_ptr<llvm::DataLayout> &DL,
-                                   const CXXMethodDecl *MD, const ThunkInfo &T) {
-  std::string FrontendBuf;
-  llvm::raw_string_ostream FOS(FrontendBuf);
-
-  M->mangleThunk(MD, T, FOS);
-
-  std::string BackendBuf;
-  llvm::raw_string_ostream BOS(BackendBuf);
-
-  llvm::Mangler::getNameWithPrefix(BOS, llvm::Twine(FOS.str()), *DL);
-
-  return BOS.str();
-}
-
 CXStringSet *clang_Cursor_getCXXManglings(CXCursor C) {
   if (clang_isInvalid(C.kind) || !clang_isDeclaration(C.kind))
     return nullptr;




More information about the cfe-commits mailing list