Changeset View
Changeset View
Standalone View
Standalone View
lldb/unittests/Expression/ClangParserTest.cpp
//===-- ClangParserTest.cpp -----------------------------------------------===// | //===-- ClangParserTest.cpp -----------------------------------------------===// | ||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#include "clang/Basic/Version.h" | #include "clang/Basic/Version.h" | ||||
#include "clang/Config/config.h" | |||||
#include "Plugins/ExpressionParser/Clang/ClangHost.h" | #include "Plugins/ExpressionParser/Clang/ClangHost.h" | ||||
#include "TestingSupport/SubsystemRAII.h" | #include "TestingSupport/SubsystemRAII.h" | ||||
#include "TestingSupport/TestUtilities.h" | #include "TestingSupport/TestUtilities.h" | ||||
#include "lldb/Host/Config.h" | #include "lldb/Host/Config.h" | ||||
#include "lldb/Host/FileSystem.h" | #include "lldb/Host/FileSystem.h" | ||||
#include "lldb/Host/HostInfo.h" | #include "lldb/Host/HostInfo.h" | ||||
#include "lldb/Utility/FileSpec.h" | #include "lldb/Utility/FileSpec.h" | ||||
Show All 14 Lines | static std::string ComputeClangResourceDir(std::string lldb_shlib_path, | ||||
FileSpec lldb_shlib_spec(lldb_shlib_path); | FileSpec lldb_shlib_spec(lldb_shlib_path); | ||||
ComputeClangResourceDirectory(lldb_shlib_spec, clang_dir, verify); | ComputeClangResourceDirectory(lldb_shlib_spec, clang_dir, verify); | ||||
return clang_dir.GetPath(); | return clang_dir.GetPath(); | ||||
} | } | ||||
TEST_F(ClangHostTest, ComputeClangResourceDirectory) { | TEST_F(ClangHostTest, ComputeClangResourceDirectory) { | ||||
#if !defined(_WIN32) | #if !defined(_WIN32) | ||||
std::string path_to_liblldb = "/foo/bar/lib/"; | std::string path_to_liblldb = "/foo/bar/lib/"; | ||||
std::string path_to_clang_dir = | std::string path_to_clang_dir = CLANG_RESOURCE_DIR[0] | ||||
"/foo/bar/" LLDB_INSTALL_LIBDIR_BASENAME "/clang/" CLANG_VERSION_MAJOR_STRING; | ? "/foo/bar/bin/" CLANG_RESOURCE_DIR | ||||
: "/foo/bar/" LLDB_INSTALL_LIBDIR_BASENAME | |||||
"/clang/" CLANG_VERSION_MAJOR_STRING; | |||||
#else | #else | ||||
std::string path_to_liblldb = "C:\\foo\\bar\\lib"; | std::string path_to_liblldb = "C:\\foo\\bar\\lib"; | ||||
std::string path_to_clang_dir = | std::string path_to_clang_dir = | ||||
"C:\\foo\\bar\\lib\\clang\\" CLANG_VERSION_MAJOR_STRING; | CLANG_RESOURCE_DIR[0] | ||||
? "C:\\foo\\bar\\bin\\" CLANG_RESOURCE_DIR | |||||
: "C:\\foo\\bar\\lib\\clang\\" CLANG_VERSION_MAJOR_STRING; | |||||
#endif | #endif | ||||
EXPECT_EQ(ComputeClangResourceDir(path_to_liblldb), path_to_clang_dir); | EXPECT_EQ(ComputeClangResourceDir(path_to_liblldb), path_to_clang_dir); | ||||
// The path doesn't really exist, so setting verify to true should make | // The path doesn't really exist, so setting verify to true should make | ||||
// ComputeClangResourceDir not give you path_to_clang_dir. | // ComputeClangResourceDir not give you path_to_clang_dir. | ||||
EXPECT_NE(ComputeClangResourceDir(path_to_liblldb, true), path_to_clang_dir); | EXPECT_NE(ComputeClangResourceDir(path_to_liblldb, true), path_to_clang_dir); | ||||
} | } | ||||
Show All 40 Lines |