Skip to content

Commit d6ffc84

Browse files
authored
Remove unneeded MakeResourceDir (#700)
* Remove unneeded MakeResourceDir * Fix clang format issue
1 parent e5a3480 commit d6ffc84

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

lib/CppInterOp/Compatibility.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,6 @@ class SynthesizingCodeRAII {
393393

394394
namespace compat {
395395

396-
inline std::string MakeResourceDir(llvm::StringRef Dir) {
397-
llvm::SmallString<128> P(Dir);
398-
llvm::sys::path::append(P, CLANG_INSTALL_LIBDIR_BASENAME, "clang",
399-
CLANG_VERSION_MAJOR_STRING);
400-
return std::string(P.str());
401-
}
402-
403396
// Clang >= 16 (=16 with Value patch) change castAs to convertTo
404397
#ifdef CPPINTEROP_USE_CLING
405398
template <typename T> inline T convertTo(cling::Value V) {

lib/CppInterOp/CppInterOp.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#endif
4444
#include "clang/Sema/TemplateDeduction.h"
4545

46+
#include "llvm/ADT/SmallString.h"
4647
#include "llvm/ADT/SmallVector.h"
4748
#include "llvm/ADT/StringRef.h"
4849
#include "llvm/Demangle/Demangle.h"
@@ -51,6 +52,7 @@
5152
#include "llvm/Support/CommandLine.h"
5253
#include "llvm/Support/Debug.h"
5354
#include "llvm/Support/ManagedStatic.h"
55+
#include "llvm/Support/Path.h"
5456
#include "llvm/Support/raw_os_ostream.h"
5557

5658
#include <algorithm>
@@ -3168,7 +3170,10 @@ static std::string MakeResourcesPath() {
31683170
Dir = sys::path::parent_path(Dir);
31693171
// Dir = sys::path::parent_path(Dir);
31703172
#endif // LLVM_BINARY_DIR
3171-
return compat::MakeResourceDir(Dir);
3173+
llvm::SmallString<128> P(Dir);
3174+
llvm::sys::path::append(P, CLANG_INSTALL_LIBDIR_BASENAME, "clang",
3175+
CLANG_VERSION_MAJOR_STRING);
3176+
return std::string(P.str());
31723177
}
31733178
} // namespace
31743179

unittests/CppInterOp/InterpreterTest.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,10 @@ if (llvm::sys::RunningOnValgrind())
334334

335335
#ifdef CPPINTEROP_USE_CLING
336336
std::string MainExecutableName = sys::fs::getMainExecutable(nullptr, nullptr);
337-
std::string ResourceDir = compat::MakeResourceDir(LLVM_BINARY_DIR);
337+
llvm::SmallString<128> P(LLVM_BINARY_DIR);
338+
llvm::sys::path::append(P, CLANG_INSTALL_LIBDIR_BASENAME, "clang",
339+
CLANG_VERSION_MAJOR_STRING);
340+
std::string ResourceDir = std::string(P.str());
338341
std::vector<const char *> ClingArgv = {"-resource-dir", ResourceDir.c_str(),
339342
"-std=c++14"};
340343
ClingArgv.insert(ClingArgv.begin(), MainExecutableName.c_str());

0 commit comments

Comments
 (0)