D17858: clang: Also detect Clang builtin dirs at runtime on Unix

Milian Wolff noreply at phabricator.kde.org
Wed Jan 9 19:22:32 GMT 2019


mwolff requested changes to this revision.
mwolff added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> clanghelpers.cpp:397
> +        auto hardcodedDir = QDir(QStringLiteral(KDEV_CLANG_BUILTIN_DIR));
> +        if (hardcodedDir.cd(QStringLiteral("../../%1/include").arg(clangVersion()))
> +            && QFile::exists(hardcodedDir.path() + QLatin1Char('/') + entryToCheck)) {

simplify this to

  if (hardcodedDir.cd(...) && hardcodedDir.exists(entryToCheck))

> clanghelpers.h:115
>   */
> -KDEVCLANGPRIVATE_EXPORT QString clangBuiltinIncludePath();
> +KDEVCLANGPRIVATE_EXPORT QString clangBuiltinIncludePath(const QString entryToCheck=QStringLiteral("."));
>  

we should always use the same header, everytime. i.e. hardcode "cpuid" in this function and remove the argument here, and also hardcode it in the error message

> parsesession.cpp:277
> +    const auto builtinDir = ClangHelpers::clangBuiltinIncludePath();
> +    // builtinDir should never be empty, still, let's not add a stray -isystem to the argument list.
> +    if (!builtinDir.isEmpty()) {

it cannot be empty at this point, it would indicate serious brokenness (since the plugin would be loaded even though it shouldn't be). remove this if and revert back to the old code

REPOSITORY
  R32 KDevelop

REVISION DETAIL
  https://phabricator.kde.org/D17858

To: rjvbb, #kdevelop, flherne, mwolff
Cc: arrowd, mwolff, flherne, kdevelop-devel, glebaccon, hase, antismap, iodelay, geetamc, Pilzschaf, akshaydeo, surgenight
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20190109/49d355f6/attachment-0001.html>


More information about the KDevelop-devel mailing list