[PATCH] D10949: A step towards getting libclang tests working on Windows

Yaron Keren yaron.keren at gmail.com
Mon Jul 6 11:24:22 PDT 2015



Changed type, name of input argument of clang_free and its description.


Repository:
  rL LLVM

http://reviews.llvm.org/D10949

Files:
  tools/clang/include/clang-c/BuildSystem.h
  tools/clang/tools/libclang/BuildSystem.cpp
  tools/clang/tools/libclang/libclang.exports
  tools/clang/unittests/libclang/LibclangTest.cpp

Index: tools/clang/tools/libclang/libclang.exports
===================================================================
--- tools/clang/tools/libclang/libclang.exports
+++ tools/clang/tools/libclang/libclang.exports
@@ -132,6 +132,7 @@
 clang_findReferencesInFile
 clang_findReferencesInFileWithBlock
 clang_formatDiagnostic
+clang_free
 clang_getArgType
 clang_getArrayElementType
 clang_getArraySize
Index: tools/clang/unittests/libclang/LibclangTest.cpp
===================================================================
--- tools/clang/unittests/libclang/LibclangTest.cpp
+++ tools/clang/unittests/libclang/LibclangTest.cpp
@@ -63,7 +63,7 @@
       clang_VirtualFileOverlay_writeToBuffer(VFO, 0, &BufPtr, &BufSize);
       std::string BufStr(BufPtr, BufSize);
       EXPECT_STREQ(Contents, BufStr.c_str());
-      free(BufPtr);
+      clang_free(BufPtr);
     }
     clang_VirtualFileOverlay_dispose(VFO);
   }
@@ -345,7 +345,7 @@
   clang_ModuleMapDescriptor_writeToBuffer(MMD, 0, &BufPtr, &BufSize);
   std::string BufStr(BufPtr, BufSize);
   EXPECT_STREQ(Contents, BufStr.c_str());
-  free(BufPtr);
+  clang_free(BufPtr);
   clang_ModuleMapDescriptor_dispose(MMD);
 }
 
Index: tools/clang/tools/libclang/BuildSystem.cpp
===================================================================
--- tools/clang/tools/libclang/BuildSystem.cpp
+++ tools/clang/tools/libclang/BuildSystem.cpp
@@ -84,6 +84,10 @@
   return CXError_Success;
 }
 
+void clang_free(void *buffer) {
+  free(buffer);
+}
+
 void clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay VFO) {
   delete unwrap(VFO);
 }
Index: tools/clang/include/clang-c/BuildSystem.h
===================================================================
--- tools/clang/include/clang-c/BuildSystem.h
+++ tools/clang/include/clang-c/BuildSystem.h
@@ -73,7 +73,7 @@
  *
  * \param options is reserved, always pass 0.
  * \param out_buffer_ptr pointer to receive the buffer pointer, which should be
- * disposed using \c free().
+ * disposed using \c clang_free().
  * \param out_buffer_size pointer to receive the buffer size.
  * \returns 0 for success, non-zero to indicate an error.
  */
@@ -83,6 +83,14 @@
                                        unsigned *out_buffer_size);
 
 /**
+ * \brief free memory allocated by libclang, such as the buffer returned by
+ * \c CXVirtualFileOverlay() or \c clang_ModuleMapDescriptor_writeToBuffer().
+ *
+ * \param buffer memory pointer to free.
+ */
+CINDEX_LINKAGE void clang_free(void *buffer);
+
+/**
  * \brief Dispose a \c CXVirtualFileOverlay object.
  */
 CINDEX_LINKAGE void clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay);
@@ -122,7 +130,7 @@
  *
  * \param options is reserved, always pass 0.
  * \param out_buffer_ptr pointer to receive the buffer pointer, which should be
- * disposed using \c free().
+ * disposed using \c clang_free().
  * \param out_buffer_size pointer to receive the buffer size.
  * \returns 0 for success, non-zero to indicate an error.
  */


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10949.29110.patch
Type: text/x-patch
Size: 3038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150706/555e5449/attachment.bin>


More information about the cfe-commits mailing list