r290113 - [libclang] Revert part of r290025, "Remove the 'extern "C"' blocks from the implementation files."

NAKAMURA Takumi via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 19 08:50:43 PST 2016


Author: chapuni
Date: Mon Dec 19 10:50:43 2016
New Revision: 290113

URL: http://llvm.org/viewvc/llvm-project?rev=290113&view=rev
Log:
[libclang] Revert part of r290025, "Remove the 'extern "C"' blocks from the implementation files."

mingw32-ld complains missing symbols in exports,

  Cannot export clang_findIncludesInFileWithBlock: symbol not defined
  Cannot export clang_findReferencesInFileWithBlock: symbol not defined
  Cannot export clang_visitChildrenWithBlock: symbol not defined

They are excluded conditionally in header along has_blocks.

We should do either;

  1. Exclude also function bodies conditionally, and introduce "optional" exporter.
  2. Give dummy function bodies for them.
  3. Implement functions w/o blocks.

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

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=290113&r1=290112&r2=290113&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Mon Dec 19 10:50:43 2016
@@ -4120,6 +4120,8 @@ static SourceLocation getLocationFromExp
   return E->getLocStart();
 }
 
+extern "C" {
+
 unsigned clang_visitChildren(CXCursor parent,
                              CXCursorVisitor visitor,
                              CXClientData client_data) {
@@ -5383,6 +5385,8 @@ CXSourceLocation clang_getCursorLocation
   return cxloc::translateSourceLocation(getCursorContext(C), Loc);
 }
 
+} // end extern "C"
+
 CXCursor cxcursor::getCursor(CXTranslationUnit TU, SourceLocation SLoc) {
   assert(TU);
 

Modified: cfe/trunk/tools/libclang/CIndexHigh.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexHigh.cpp?rev=290113&r1=290112&r2=290113&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndexHigh.cpp (original)
+++ cfe/trunk/tools/libclang/CIndexHigh.cpp Mon Dec 19 10:50:43 2016
@@ -407,6 +407,8 @@ static bool findIncludesInFile(CXTransla
 // libclang public APIs.
 //===----------------------------------------------------------------------===//
 
+extern "C" {
+
 CXResult clang_findReferencesInFile(CXCursor cursor, CXFile file,
                                     CXCursorAndRangeVisitor visitor) {
   LogRef Log = Logger::make(__func__);
@@ -532,3 +534,4 @@ CXResult clang_findIncludesInFileWithBlo
   return clang_findIncludesInFile(TU, file, visitor);
 }
 
+} // end: extern "C"




More information about the cfe-commits mailing list