Changeset View
Changeset View
Standalone View
Standalone View
plugins/clang/clangsupport.cpp
Show First 20 Lines • Show All 175 Lines • ▼ Show 20 Line(s) | 173 | ClangSupport::ClangSupport(QObject* parent, const QVariantList& ) | |||
---|---|---|---|---|---|
176 | , m_highlighting(nullptr) | 176 | , m_highlighting(nullptr) | ||
177 | , m_refactoring(nullptr) | 177 | , m_refactoring(nullptr) | ||
178 | , m_index(nullptr) | 178 | , m_index(nullptr) | ||
179 | { | 179 | { | ||
180 | clangDebug() << "Detected Clang version:" << ClangHelpers::clangVersion(); | 180 | clangDebug() << "Detected Clang version:" << ClangHelpers::clangVersion(); | ||
181 | 181 | | |||
182 | { | 182 | { | ||
183 | const auto builtinDir = ClangHelpers::clangBuiltinIncludePath(); | 183 | const auto builtinDir = ClangHelpers::clangBuiltinIncludePath(); | ||
184 | const auto headerToCheck = QLatin1String("cpuid.h"); | 184 | if (!ClangHelpers::isValidClangBuiltingIncludePath(builtinDir)) { | ||
185 | if (!QFile::exists(builtinDir + QLatin1Char('/') + headerToCheck)) { | 185 | setErrorDescription(i18n("The clang builtin include path \"%1\" is invalid (missing cpuid.h header).\n" | ||
186 | setErrorDescription(i18n("The clang builtin include path \"%1\" is invalid (missing %2 header).\n" | | |||
187 | "Try setting the KDEV_CLANG_BUILTIN_DIR environment variable manually to fix this.\n" | 186 | "Try setting the KDEV_CLANG_BUILTIN_DIR environment variable manually to fix this.\n" | ||
188 | "See also: https://bugs.kde.org/show_bug.cgi?id=393779", builtinDir, headerToCheck)); | 187 | "See also: https://bugs.kde.org/show_bug.cgi?id=393779", builtinDir)); | ||
189 | return; | 188 | return; | ||
mwolff: the path is empty, so nothing will be printed here
please revert to the old behavior and check… | |||||
Doh, yes. With my previous implementation the path was never empty when clangBuiltinIncludePath() was called with its default argument. Evidently I had to forget that this was no longer true in the current implementation. Reverting means we'll be checking the file presence twice in most cases, right? It bothers me a bit to hardcode the filename in 2 locations. rjvbb: Doh, yes. With my previous implementation the path was never empty when clangBuiltinIncludePath… | |||||
ah I see. just make the check code (currently in the lambda) available through isValidClangBuiltingIncludePath - no need to hardcode it twice. mwolff: ah I see. just make the check code (currently in the lambda) available through… | |||||
190 | } | 189 | } | ||
191 | } | 190 | } | ||
192 | 191 | | |||
193 | setXMLFile( QStringLiteral("kdevclangsupport.rc") ); | 192 | setXMLFile( QStringLiteral("kdevclangsupport.rc") ); | ||
194 | 193 | | |||
195 | ClangIntegration::DUChainUtils::registerDUChainItems(); | 194 | ClangIntegration::DUChainUtils::registerDUChainItems(); | ||
196 | 195 | | |||
197 | m_highlighting = new ClangHighlighting(this); | 196 | m_highlighting = new ClangHighlighting(this); | ||
▲ Show 20 Lines • Show All 248 Lines • Show Last 20 Lines |
the path is empty, so nothing will be printed here
please revert to the old behavior and check the validity of the returned path in the conditional, then print builtinDir here