Skip to content

Commit 2f3e0c1

Browse files
committed
Do not link to libclang
1 parent 23911bf commit 2f3e0c1

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

unittests/CppInterOp/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ add_cppinterop_unittest(CppInterOpTests
1616
target_link_libraries(CppInterOpTests
1717
PRIVATE
1818
clangCppInterOp
19-
libclang
2019
)
2120

2221
if(NOT WIN32)

unittests/CppInterOp/EnumReflectionTest.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "clang/Interpreter/CppInterOp.h"
66
#include "clang/Sema/Sema.h"
77
#include "clang-c/CXCppInterOp.h"
8-
#include "clang-c/CXString.h"
98

109
#include "gtest/gtest.h"
1110

unittests/CppInterOp/Utils.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,12 @@ void TestUtils::GetAllSubDecls(Decl *D, std::vector<Decl*>& SubDecls,
5656
SubDecls.push_back(Di);
5757
}
5858
}
59+
60+
const char* clang_getCString(CXString string) {
61+
return static_cast<const char*>(string.data);
62+
}
63+
64+
void clang_disposeString(CXString string) {
65+
if (string.private_flags == 1 && string.data)
66+
free(const_cast<void*>(string.data));
67+
}

unittests/CppInterOp/Utils.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33

44
#include "../../lib/Interpreter/Compatibility.h"
55

6+
#include "llvm/Support/Valgrind.h"
67
#include <memory>
78
#include <vector>
8-
#include "llvm/Support/Valgrind.h"
9+
#include "clang-c/CXString.h"
910

1011
using namespace clang;
1112
using namespace llvm;
@@ -21,4 +22,8 @@ namespace TestUtils {
2122
bool filter_implicitGenerated = false);
2223
} // end namespace TestUtils
2324

25+
// libclang's string manipulation APIs
26+
const char* clang_getCString(CXString string);
27+
void clang_disposeString(CXString string);
28+
2429
#endif // CPPINTEROP_UNITTESTS_LIBCPPINTEROP_UTILS_H

0 commit comments

Comments
 (0)