forked from qt-creator/qt-creator
clang: Fix include/resource dir confusion
The getClangResourceDirAndVersion() function in ClangTools could return the actual resource dir or the include dir, depending on the input. This mistake happened because of misleading names spread all around the code. Now the function returns what it says, and the other names are accurate as well. Change-Id: I0a8600857ee7b9fafb16256e0d1ad203ac3273d2 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -7,12 +7,12 @@ Module {
|
||||
|
||||
cpp.defines: libclang.present ? [
|
||||
'CLANG_VERSION="' + libclang.llvmVersion + '"',
|
||||
'CLANG_RESOURCE_DIR="' + FileInfo.joinPaths(libclang.llvmLibDir, "clang",
|
||||
'CLANG_INCLUDE_DIR="' + FileInfo.joinPaths(libclang.llvmLibDir, "clang",
|
||||
libclang.llvmVersion, "include") + '"',
|
||||
'CLANG_BINDIR="' + libclang.llvmBinDir + '"',
|
||||
] : [
|
||||
'CLANG_VERSION=""',
|
||||
'CLANG_RESOURCE_DIR=""',
|
||||
'CLANG_INCLUDE_DIR=""',
|
||||
'CLANG_BINDIR=""',
|
||||
]
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ add_qtc_library(ClangSupport
|
||||
PUBLIC_DEPENDS Utils Sqlite Qt5::Core Qt5::Network
|
||||
PUBLIC_DEFINES
|
||||
CLANG_VERSION="${CLANG_VERSION}"
|
||||
CLANG_RESOURCE_DIR="${IDE_LIBEXEC_PATH}/clang/lib/clang/${CLANG_VERSION}/include"
|
||||
CLANG_INCLUDE_DIR="${IDE_LIBEXEC_PATH}/clang/lib/clang/${CLANG_VERSION}/include"
|
||||
CLANG_BINDIR="${IDE_LIBEXEC_PATH}/clang/bin"
|
||||
DEFINES CLANGSUPPORT_BUILD_LIB
|
||||
PUBLIC_INCLUDES
|
||||
|
@@ -75,7 +75,7 @@ public:
|
||||
UseLanguageDefines::No,
|
||||
useBuildSystemWarnings,
|
||||
QString(CLANG_VERSION),
|
||||
QString(CLANG_RESOURCE_DIR))
|
||||
QString(CLANG_INCLUDE_DIR))
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -332,7 +332,7 @@ ProjectUpdater::SystemAndProjectIncludeSearchPaths ProjectUpdater::createInclude
|
||||
CppTools::HeaderPathFilter filter(projectPart,
|
||||
CppTools::UseTweakedHeaderPaths::Yes,
|
||||
CLANG_VERSION,
|
||||
CLANG_RESOURCE_DIR,
|
||||
CLANG_INCLUDE_DIR,
|
||||
projectDirectory(projectPart.project),
|
||||
buildDirectory(projectPart.project));
|
||||
filter.process();
|
||||
|
@@ -154,7 +154,7 @@ private:
|
||||
bool m_success = false;
|
||||
};
|
||||
|
||||
static AnalyzeUnits toAnalyzeUnits(const FileInfos &fileInfos, const FilePath &clangResourceDir,
|
||||
static AnalyzeUnits toAnalyzeUnits(const FileInfos &fileInfos, const FilePath &clangIncludeDir,
|
||||
const QString &clangVersion)
|
||||
{
|
||||
AnalyzeUnits unitsToAnalyze;
|
||||
@@ -166,7 +166,7 @@ static AnalyzeUnits toAnalyzeUnits(const FileInfos &fileInfos, const FilePath &c
|
||||
UseLanguageDefines::No,
|
||||
UseBuildSystemWarnings::No,
|
||||
clangVersion,
|
||||
clangResourceDir.toString());
|
||||
clangIncludeDir.toString());
|
||||
QStringList arguments = extraClangToolsPrependOptions();
|
||||
arguments.append(optionsBuilder.build(fileInfo.kind, usePrecompiledHeaders));
|
||||
arguments.append(extraClangToolsAppendOptions());
|
||||
@@ -176,12 +176,12 @@ static AnalyzeUnits toAnalyzeUnits(const FileInfos &fileInfos, const FilePath &c
|
||||
return unitsToAnalyze;
|
||||
}
|
||||
|
||||
AnalyzeUnits ClangToolRunWorker::unitsToAnalyze(const FilePath &clangResourceDir,
|
||||
AnalyzeUnits ClangToolRunWorker::unitsToAnalyze(const FilePath &clangIncludeDir,
|
||||
const QString &clangVersion)
|
||||
{
|
||||
QTC_ASSERT(m_projectInfo.isValid(), return AnalyzeUnits());
|
||||
|
||||
return toAnalyzeUnits(m_fileInfos, clangResourceDir, clangVersion);
|
||||
return toAnalyzeUnits(m_fileInfos, clangIncludeDir, clangVersion);
|
||||
}
|
||||
|
||||
static QDebug operator<<(QDebug debug, const Utils::Environment &environment)
|
||||
@@ -288,10 +288,10 @@ void ClangToolRunWorker::start()
|
||||
Utils::NormalMessageFormat);
|
||||
|
||||
// Collect files
|
||||
const auto clangResourceDirAndVersion =
|
||||
getClangResourceDirAndVersion(runControl()->runnable().executable);
|
||||
const AnalyzeUnits unitsToProcess = unitsToAnalyze(clangResourceDirAndVersion.first,
|
||||
clangResourceDirAndVersion.second);
|
||||
const auto clangIncludeDirAndVersion =
|
||||
getClangIncludeDirAndVersion(runControl()->runnable().executable);
|
||||
const AnalyzeUnits unitsToProcess = unitsToAnalyze(clangIncludeDirAndVersion.first,
|
||||
clangIncludeDirAndVersion.second);
|
||||
qCDebug(LOG) << "Files to process:" << unitsToProcess;
|
||||
|
||||
m_queue.clear();
|
||||
|
@@ -93,7 +93,7 @@ private:
|
||||
QList<RunnerCreator> runnerCreators();
|
||||
template <class T> ClangToolRunner *createRunner();
|
||||
|
||||
AnalyzeUnits unitsToAnalyze(const Utils::FilePath &clangResourceDir,
|
||||
AnalyzeUnits unitsToAnalyze(const Utils::FilePath &clangIncludeDir,
|
||||
const QString &clangVersion);
|
||||
void analyzeNextFile();
|
||||
|
||||
|
@@ -203,13 +203,13 @@ static QString queryVersion(const FilePath &clangToolPath)
|
||||
return {};
|
||||
}
|
||||
|
||||
QPair<FilePath, QString> getClangResourceDirAndVersion(const FilePath &clangToolPath)
|
||||
QPair<FilePath, QString> getClangIncludeDirAndVersion(const FilePath &clangToolPath)
|
||||
{
|
||||
const FilePath dynamicResourceDir = queryResourceDir(clangToolPath);
|
||||
const QString dynamicVersion = queryVersion(clangToolPath);
|
||||
if (dynamicResourceDir.isEmpty() || dynamicVersion.isEmpty())
|
||||
return qMakePair(FilePath::fromString(CLANG_RESOURCE_DIR), QString(CLANG_VERSION));
|
||||
return qMakePair(dynamicResourceDir, dynamicVersion);
|
||||
return qMakePair(FilePath::fromString(CLANG_INCLUDE_DIR), QString(CLANG_VERSION));
|
||||
return qMakePair(dynamicResourceDir + "/include", dynamicVersion);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -34,7 +34,7 @@
|
||||
namespace ClangTools {
|
||||
namespace Internal {
|
||||
|
||||
QPair<Utils::FilePath, QString> getClangResourceDirAndVersion(const Utils::FilePath &clangToolPath);
|
||||
QPair<Utils::FilePath, QString> getClangIncludeDirAndVersion(const Utils::FilePath &clangToolPath);
|
||||
|
||||
class ClangTidyInfo
|
||||
{
|
||||
|
@@ -491,11 +491,11 @@ static QString clangIncludePath(const QString &clangVersion)
|
||||
\internal
|
||||
*/
|
||||
QString ICore::clangIncludeDirectory(const QString &clangVersion,
|
||||
const QString &clangResourceDirectory)
|
||||
const QString &clangFallbackIncludeDir)
|
||||
{
|
||||
QDir dir(libexecPath() + "/clang" + clangIncludePath(clangVersion));
|
||||
if (!dir.exists() || !QFileInfo(dir, "stdint.h").exists())
|
||||
dir = QDir(clangResourceDirectory);
|
||||
dir = QDir(clangFallbackIncludeDir);
|
||||
return QDir::toNativeSeparators(dir.canonicalPath());
|
||||
}
|
||||
|
||||
|
@@ -161,7 +161,7 @@ public:
|
||||
static QString clangTidyExecutable(const QString &clangBinDirectory);
|
||||
static QString clazyStandaloneExecutable(const QString &clangBinDirectory);
|
||||
static QString clangIncludeDirectory(const QString &clangVersion,
|
||||
const QString &clangResourceDirectory);
|
||||
const QString &clangFallbackIncludeDir);
|
||||
static QString buildCompatibilityString();
|
||||
static QStatusBar *statusBar();
|
||||
|
||||
|
@@ -105,14 +105,14 @@ CompilerOptionsBuilder::CompilerOptionsBuilder(const ProjectPart &projectPart,
|
||||
UseLanguageDefines useLanguageDefines,
|
||||
UseBuildSystemWarnings useBuildSystemWarnings,
|
||||
const QString &clangVersion,
|
||||
const QString &clangResourceDirectory)
|
||||
const QString &clangIncludeDirectory)
|
||||
: m_projectPart(projectPart)
|
||||
, m_useSystemHeader(useSystemHeader)
|
||||
, m_useTweakedHeaderPaths(useTweakedHeaderPaths)
|
||||
, m_useLanguageDefines(useLanguageDefines)
|
||||
, m_useBuildSystemWarnings(useBuildSystemWarnings)
|
||||
, m_clangVersion(clangVersion)
|
||||
, m_clangResourceDirectory(clangResourceDirectory)
|
||||
, m_clangIncludeDirectory(clangIncludeDirectory)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ void CompilerOptionsBuilder::addHeaderPathOptions()
|
||||
HeaderPathFilter filter{m_projectPart,
|
||||
m_useTweakedHeaderPaths,
|
||||
m_clangVersion,
|
||||
m_clangResourceDirectory};
|
||||
m_clangIncludeDirectory};
|
||||
|
||||
filter.process();
|
||||
|
||||
|
@@ -45,14 +45,13 @@ CPPTOOLS_EXPORT QStringList createLanguageOptionGcc(ProjectFile::Kind fileKind,
|
||||
class CPPTOOLS_EXPORT CompilerOptionsBuilder
|
||||
{
|
||||
public:
|
||||
CompilerOptionsBuilder(
|
||||
const ProjectPart &projectPart,
|
||||
CompilerOptionsBuilder(const ProjectPart &projectPart,
|
||||
UseSystemHeader useSystemHeader = UseSystemHeader::No,
|
||||
UseTweakedHeaderPaths useTweakedHeaderPaths = UseTweakedHeaderPaths::No,
|
||||
UseLanguageDefines useLanguageDefines = UseLanguageDefines::No,
|
||||
UseBuildSystemWarnings useBuildSystemWarnings = UseBuildSystemWarnings::No,
|
||||
const QString &clangVersion = QString(),
|
||||
const QString &clangResourceDirectory = QString());
|
||||
const QString &clangIncludeDirectory = QString());
|
||||
|
||||
QStringList build(ProjectFile::Kind fileKind, UsePrecompiledHeaders usePrecompiledHeaders);
|
||||
QStringList options() const { return m_options; }
|
||||
@@ -112,7 +111,7 @@ private:
|
||||
const UseBuildSystemWarnings m_useBuildSystemWarnings;
|
||||
|
||||
const QString m_clangVersion;
|
||||
const QString m_clangResourceDirectory;
|
||||
const QString m_clangIncludeDirectory;
|
||||
|
||||
struct {
|
||||
QStringList flags;
|
||||
|
@@ -104,14 +104,14 @@ void HeaderPathFilter::filterHeaderPath(const ProjectExplorer::HeaderPath &heade
|
||||
|
||||
namespace {
|
||||
|
||||
QString clangIncludeDirectory(const QString &clangVersion, const QString &clangResourceDirectory)
|
||||
QString clangIncludeDirectory(const QString &clangVersion, const QString &clangFallbackIncludeDir)
|
||||
{
|
||||
#ifndef UNIT_TESTS
|
||||
return Core::ICore::clangIncludeDirectory(clangVersion, clangResourceDirectory);
|
||||
return Core::ICore::clangIncludeDirectory(clangVersion, clangFallbackIncludeDir);
|
||||
#else
|
||||
Q_UNUSED(clangVersion)
|
||||
Q_UNUSED(clangResourceDirectory)
|
||||
return {CLANG_RESOURCE_DIR};
|
||||
Q_UNUSED(clangFallbackIncludeDir)
|
||||
return {CLANG_INCLUDE_DIR};
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -158,7 +158,8 @@ void HeaderPathFilter::tweakHeaderPaths()
|
||||
auto split = resourceIterator(builtInHeaderPaths);
|
||||
|
||||
if (!clangVersion.isEmpty()) {
|
||||
const QString clangIncludePath = clangIncludeDirectory(clangVersion, clangResourceDirectory);
|
||||
const QString clangIncludePath
|
||||
= clangIncludeDirectory(clangVersion, clangFallbackIncludeDirectory);
|
||||
builtInHeaderPaths.insert(split, HeaderPath{clangIncludePath, HeaderPathType::BuiltIn});
|
||||
}
|
||||
}
|
||||
|
@@ -35,12 +35,12 @@ public:
|
||||
HeaderPathFilter(const ProjectPart &projectPart,
|
||||
UseTweakedHeaderPaths useTweakedHeaderPaths = UseTweakedHeaderPaths::Yes,
|
||||
const QString &clangVersion = {},
|
||||
const QString &clangResourceDirectory = {},
|
||||
const QString &clangIncludeDirectory = {},
|
||||
const QString &projectDirectory = {},
|
||||
const QString &buildDirectory = {})
|
||||
: projectPart{projectPart}
|
||||
, clangVersion{clangVersion}
|
||||
, clangResourceDirectory{clangResourceDirectory}
|
||||
, clangFallbackIncludeDirectory{clangIncludeDirectory}
|
||||
, projectDirectory(ensurePathWithSlashEnding(projectDirectory))
|
||||
, buildDirectory(ensurePathWithSlashEnding(buildDirectory))
|
||||
, useTweakedHeaderPaths{useTweakedHeaderPaths}
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
ProjectExplorer::HeaderPaths userHeaderPaths;
|
||||
const ProjectPart &projectPart;
|
||||
const QString clangVersion;
|
||||
const QString clangResourceDirectory;
|
||||
const QString clangFallbackIncludeDirectory;
|
||||
const QString projectDirectory;
|
||||
const QString buildDirectory;
|
||||
const UseTweakedHeaderPaths useTweakedHeaderPaths;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
DEFINES += CLANG_VERSION=\\\"$${LLVM_VERSION}\\\"
|
||||
CLANG_RESOURCE_DIR=$$clean_path($${LLVM_LIBDIR}/clang/$${LLVM_VERSION}/include)
|
||||
DEFINES += "\"CLANG_RESOURCE_DIR=\\\"$${CLANG_RESOURCE_DIR}\\\"\""
|
||||
CLANG_INCLUDE_DIR=$$clean_path($${LLVM_LIBDIR}/clang/$${LLVM_VERSION}/include)
|
||||
DEFINES += "\"CLANG_INCLUDE_DIR=\\\"$${CLANG_INCLUDE_DIR}\\\"\""
|
||||
CLANG_BINDIR=$$clean_path($${LLVM_BINDIR})
|
||||
DEFINES += "\"CLANG_BINDIR=\\\"$${CLANG_BINDIR}\\\"\""
|
||||
|
@@ -208,7 +208,7 @@ TEST_F(CompilerOptionsBuilder, HeaderPathOptionsOrder)
|
||||
"-nostdinc++",
|
||||
"-I", toNative("/tmp/path"),
|
||||
"-I", toNative("/tmp/system_path"),
|
||||
"-isystem", toNative(CLANG_RESOURCE_DIR ""),
|
||||
"-isystem", toNative(CLANG_INCLUDE_DIR ""),
|
||||
"-isystem", toNative("/tmp/builtin_path")));
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ TEST_F(CompilerOptionsBuilder, HeaderPathOptionsOrderCl)
|
||||
"-I", toNative("/tmp/path"),
|
||||
"-I", toNative("/tmp/system_path"),
|
||||
"/clang:-isystem",
|
||||
"/clang:" + toNative(CLANG_RESOURCE_DIR ""),
|
||||
"/clang:" + toNative(CLANG_INCLUDE_DIR ""),
|
||||
"/clang:-isystem",
|
||||
"/clang:" + toNative("/tmp/builtin_path")));
|
||||
}
|
||||
@@ -254,7 +254,7 @@ TEST_F(CompilerOptionsBuilder, UseSystemHeader)
|
||||
"-nostdinc++",
|
||||
"-I", toNative("/tmp/path"),
|
||||
"-isystem", toNative("/tmp/system_path"),
|
||||
"-isystem", toNative(CLANG_RESOURCE_DIR ""),
|
||||
"-isystem", toNative(CLANG_INCLUDE_DIR ""),
|
||||
"-isystem", toNative("/tmp/builtin_path")));
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderMacOs)
|
||||
"-isystem", toNative("/usr/include/c++/4.2.1"),
|
||||
"-isystem", toNative("/usr/include/c++/4.2.1/backward"),
|
||||
"-isystem", toNative("/usr/local/include"),
|
||||
"-isystem", toNative(CLANG_RESOURCE_DIR ""),
|
||||
"-isystem", toNative(CLANG_INCLUDE_DIR ""),
|
||||
"-isystem", toNative("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include"),
|
||||
"-isystem", toNative("/usr/include"),
|
||||
"-isystem", toNative("/tmp/builtin_path")));
|
||||
@@ -334,7 +334,7 @@ TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderLinux)
|
||||
"-isystem", toNative("/usr/include/c++/4.8/backward"),
|
||||
"-isystem", toNative("/usr/include/x86_64-linux-gnu/c++/4.8"),
|
||||
"-isystem", toNative("/usr/local/include"),
|
||||
"-isystem", toNative(CLANG_RESOURCE_DIR ""),
|
||||
"-isystem", toNative(CLANG_INCLUDE_DIR ""),
|
||||
"-isystem", toNative("/usr/lib/gcc/x86_64-linux-gnu/4.8/include"),
|
||||
"-isystem", toNative("/usr/include/x86_64-linux-gnu"),
|
||||
"-isystem", toNative("/usr/include")));
|
||||
@@ -366,7 +366,7 @@ TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderNoVersion)
|
||||
"-isystem", toNative("C:/mingw530/i686-w64-mingw32/include/c++"),
|
||||
"-isystem", toNative("C:/mingw530/i686-w64-mingw32/include/c++/i686-w64-mingw32"),
|
||||
"-isystem", toNative("C:/mingw530/i686-w64-mingw32/include/c++/backward"),
|
||||
"-isystem", toNative(CLANG_RESOURCE_DIR ""),
|
||||
"-isystem", toNative(CLANG_INCLUDE_DIR ""),
|
||||
"-isystem", toNative("C:/mingw530/i686-w64-mingw32/include")));
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderAndroidClang)
|
||||
"-nostdinc++",
|
||||
"-isystem", toNative("C:/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include"),
|
||||
"-isystem", toNative("C:/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++abi/include"),
|
||||
"-isystem", toNative(CLANG_RESOURCE_DIR ""),
|
||||
"-isystem", toNative(CLANG_INCLUDE_DIR ""),
|
||||
"-isystem", toNative("C:/Android/sdk/ndk-bundle/sysroot/usr/include/i686-linux-android"),
|
||||
"-isystem", toNative("C:/Android/sdk/ndk-bundle/sources/android/support/include"),
|
||||
"-isystem", toNative("C:/Android/sdk/ndk-bundle/sysroot/usr/include")));
|
||||
@@ -657,7 +657,7 @@ TEST_F(CompilerOptionsBuilder, BuildAllOptions)
|
||||
"-I", IsPartOfHeader(toNative("wrappedQtHeaders/QtCore").toStdString()),
|
||||
"-I", toNative("/tmp/path"),
|
||||
"-I", toNative("/tmp/system_path"),
|
||||
"-isystem", toNative(CLANG_RESOURCE_DIR ""),
|
||||
"-isystem", toNative(CLANG_INCLUDE_DIR ""),
|
||||
"-isystem", toNative("/tmp/builtin_path")));
|
||||
}
|
||||
|
||||
@@ -695,7 +695,7 @@ TEST_F(CompilerOptionsBuilder, BuildAllOptionsCl)
|
||||
"-I", toNative("/tmp/path"),
|
||||
"-I", toNative("/tmp/system_path"),
|
||||
"/clang:-isystem",
|
||||
"/clang:" + toNative(CLANG_RESOURCE_DIR ""),
|
||||
"/clang:" + toNative(CLANG_INCLUDE_DIR ""),
|
||||
"/clang:-isystem",
|
||||
"/clang:" + toNative("/tmp/builtin_path")));
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ include($$PWD/../../../src/plugins/clangcodemodel/clangcodemodelunittestfiles.pr
|
||||
!isEmpty(CLANGFORMAT_LIBS): include($$PWD/../../../src/plugins/clangformat/clangformat-source.pri)
|
||||
} else {
|
||||
DEFINES += CLANG_VERSION=\\\"6.0.0\\\"
|
||||
DEFINES += "\"CLANG_RESOURCE_DIR=\\\"/usr/include\\\"\""
|
||||
DEFINES += "\"CLANG_INCLUDE_DIR=\\\"/usr/include\\\"\""
|
||||
}
|
||||
|
||||
INCLUDEPATH += \
|
||||
|
@@ -162,12 +162,12 @@ TEST_F(HeaderPathFilter, ClangHeadersPath)
|
||||
CppTools::HeaderPathFilter filter{projectPart,
|
||||
CppTools::UseTweakedHeaderPaths::Yes,
|
||||
"6.0",
|
||||
CLANG_RESOURCE_DIR};
|
||||
CLANG_INCLUDE_DIR};
|
||||
|
||||
filter.process();
|
||||
|
||||
ASSERT_THAT(filter.builtInHeaderPaths,
|
||||
ElementsAre(HasBuiltIn(CLANG_RESOURCE_DIR), HasBuiltIn("/builtin_path")));
|
||||
ElementsAre(HasBuiltIn(CLANG_INCLUDE_DIR), HasBuiltIn("/builtin_path")));
|
||||
}
|
||||
|
||||
TEST_F(HeaderPathFilter, ClangHeadersPathWitoutClangVersion)
|
||||
@@ -198,7 +198,7 @@ TEST_F(HeaderPathFilter, ClangHeadersAndCppIncludesPathsOrderMacOs)
|
||||
CppTools::HeaderPathFilter filter{projectPart,
|
||||
CppTools::UseTweakedHeaderPaths::Yes,
|
||||
"6.0",
|
||||
CLANG_RESOURCE_DIR};
|
||||
CLANG_INCLUDE_DIR};
|
||||
|
||||
filter.process();
|
||||
|
||||
@@ -206,7 +206,7 @@ TEST_F(HeaderPathFilter, ClangHeadersAndCppIncludesPathsOrderMacOs)
|
||||
ElementsAre(HasBuiltIn("/usr/include/c++/4.2.1"),
|
||||
HasBuiltIn("/usr/include/c++/4.2.1/backward"),
|
||||
HasBuiltIn("/usr/local/include"),
|
||||
HasBuiltIn(CLANG_RESOURCE_DIR),
|
||||
HasBuiltIn(CLANG_INCLUDE_DIR),
|
||||
HasBuiltIn("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include"),
|
||||
HasBuiltIn("/usr/include"),
|
||||
HasBuiltIn("/builtin_path")));
|
||||
@@ -229,7 +229,7 @@ TEST_F(HeaderPathFilter, ClangHeadersAndCppIncludesPathsOrderLinux)
|
||||
CppTools::HeaderPathFilter filter{projectPart,
|
||||
CppTools::UseTweakedHeaderPaths::Yes,
|
||||
"6.0",
|
||||
CLANG_RESOURCE_DIR};
|
||||
CLANG_INCLUDE_DIR};
|
||||
|
||||
filter.process();
|
||||
|
||||
@@ -238,7 +238,7 @@ TEST_F(HeaderPathFilter, ClangHeadersAndCppIncludesPathsOrderLinux)
|
||||
HasBuiltIn("/usr/include/c++/4.8/backward"),
|
||||
HasBuiltIn("/usr/include/x86_64-linux-gnu/c++/4.8"),
|
||||
HasBuiltIn("/usr/local/include"),
|
||||
HasBuiltIn(CLANG_RESOURCE_DIR),
|
||||
HasBuiltIn(CLANG_INCLUDE_DIR),
|
||||
HasBuiltIn("/usr/lib/gcc/x86_64-linux-gnu/4.8/include"),
|
||||
HasBuiltIn("/usr/include/x86_64-linux-gnu"),
|
||||
HasBuiltIn("/usr/include"),
|
||||
@@ -258,11 +258,11 @@ TEST_F(HeaderPathFilter, RemoveGccInternalPaths)
|
||||
CppTools::HeaderPathFilter filter{projectPart,
|
||||
CppTools::UseTweakedHeaderPaths::Yes,
|
||||
"6.0",
|
||||
CLANG_RESOURCE_DIR};
|
||||
CLANG_INCLUDE_DIR};
|
||||
|
||||
filter.process();
|
||||
|
||||
ASSERT_THAT(filter.builtInHeaderPaths, ElementsAre(HasBuiltIn(CLANG_RESOURCE_DIR)));
|
||||
ASSERT_THAT(filter.builtInHeaderPaths, ElementsAre(HasBuiltIn(CLANG_INCLUDE_DIR)));
|
||||
}
|
||||
|
||||
// Some distributions ship the standard library headers in "<installdir>/include/c++" (MinGW)
|
||||
@@ -280,12 +280,12 @@ TEST_F(HeaderPathFilter, RemoveGccInternalPathsExceptForStandardPaths)
|
||||
};
|
||||
|
||||
auto expected = projectPart.headerPaths;
|
||||
expected << builtIn(CLANG_RESOURCE_DIR);
|
||||
expected << builtIn(CLANG_INCLUDE_DIR);
|
||||
|
||||
CppTools::HeaderPathFilter filter{projectPart,
|
||||
CppTools::UseTweakedHeaderPaths::Yes,
|
||||
"6.0",
|
||||
CLANG_RESOURCE_DIR};
|
||||
CLANG_INCLUDE_DIR};
|
||||
|
||||
filter.process();
|
||||
|
||||
@@ -304,7 +304,7 @@ TEST_F(HeaderPathFilter, ClangHeadersAndCppIncludesPathsOrderNoVersion)
|
||||
CppTools::HeaderPathFilter filter{projectPart,
|
||||
CppTools::UseTweakedHeaderPaths::Yes,
|
||||
"6.0",
|
||||
CLANG_RESOURCE_DIR};
|
||||
CLANG_INCLUDE_DIR};
|
||||
|
||||
filter.process();
|
||||
|
||||
@@ -313,7 +313,7 @@ TEST_F(HeaderPathFilter, ClangHeadersAndCppIncludesPathsOrderNoVersion)
|
||||
ElementsAre(HasBuiltIn("C:/mingw/i686-w64-mingw32/include/c++"),
|
||||
HasBuiltIn("C:/mingw/i686-w64-mingw32/include/c++/i686-w64-mingw32"),
|
||||
HasBuiltIn("C:/mingw/i686-w64-mingw32/include/c++/backward"),
|
||||
HasBuiltIn(CLANG_RESOURCE_DIR),
|
||||
HasBuiltIn(CLANG_INCLUDE_DIR),
|
||||
HasBuiltIn("C:/mingw/i686-w64-mingw32/include")));
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ TEST_F(HeaderPathFilter, ClangHeadersAndCppIncludesPathsOrderAndroidClang)
|
||||
CppTools::HeaderPathFilter filter{projectPart,
|
||||
CppTools::UseTweakedHeaderPaths::Yes,
|
||||
"6.0",
|
||||
CLANG_RESOURCE_DIR};
|
||||
CLANG_INCLUDE_DIR};
|
||||
|
||||
filter.process();
|
||||
|
||||
@@ -338,7 +338,7 @@ TEST_F(HeaderPathFilter, ClangHeadersAndCppIncludesPathsOrderAndroidClang)
|
||||
filter.builtInHeaderPaths,
|
||||
ElementsAre(HasBuiltIn("C:/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include"),
|
||||
HasBuiltIn("C:/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++abi/include"),
|
||||
HasBuiltIn(CLANG_RESOURCE_DIR),
|
||||
HasBuiltIn(CLANG_INCLUDE_DIR),
|
||||
HasBuiltIn("C:/Android/sdk/ndk-bundle/sysroot/usr/include/i686-linux-android"),
|
||||
HasBuiltIn("C:/Android/sdk/ndk-bundle/sources/android/support/include"),
|
||||
HasBuiltIn("C:/Android/sdk/ndk-bundle/sysroot/usr/include")));
|
||||
|
@@ -125,7 +125,7 @@ protected:
|
||||
arguments.clone(),
|
||||
Utils::clone(compilerMacros),
|
||||
{{"project/.pre_includes", 1, ClangBackEnd::IncludeSearchPathType::System},
|
||||
{CLANG_RESOURCE_DIR, 2, ClangBackEnd::IncludeSearchPathType::BuiltIn}},
|
||||
{CLANG_INCLUDE_DIR, 2, ClangBackEnd::IncludeSearchPathType::BuiltIn}},
|
||||
{},
|
||||
{filePathId(headerPaths[1])},
|
||||
{filePathIds(sourcePaths)},
|
||||
@@ -136,7 +136,7 @@ protected:
|
||||
arguments2.clone(),
|
||||
Utils::clone(compilerMacros),
|
||||
{{"project/.pre_includes", 1, ClangBackEnd::IncludeSearchPathType::System},
|
||||
{CLANG_RESOURCE_DIR, 2, ClangBackEnd::IncludeSearchPathType::BuiltIn}},
|
||||
{CLANG_INCLUDE_DIR, 2, ClangBackEnd::IncludeSearchPathType::BuiltIn}},
|
||||
{},
|
||||
{filePathId(headerPaths[1])},
|
||||
{filePathIds(sourcePaths)},
|
||||
@@ -386,7 +386,7 @@ TEST_F(ProjectUpdater, CreateSortedIncludeSearchPaths)
|
||||
Eq(IncludeSearchPath{builtInPath.path, 5, IncludeSearchPathType::BuiltIn}),
|
||||
Eq(IncludeSearchPath{frameworkPath.path, 3, IncludeSearchPathType::Framework}),
|
||||
Eq(IncludeSearchPath{"project/.pre_includes", 1, IncludeSearchPathType::System}),
|
||||
Eq(IncludeSearchPath{CLANG_RESOURCE_DIR,
|
||||
Eq(IncludeSearchPath{CLANG_INCLUDE_DIR,
|
||||
4,
|
||||
ClangBackEnd::IncludeSearchPathType::BuiltIn})));
|
||||
ASSERT_THAT(paths.project,
|
||||
|
Reference in New Issue
Block a user