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

René J.V. Bertin noreply at phabricator.kde.org
Wed Jan 9 15:03:08 GMT 2019

rjvbb marked an inline comment as done.
rjvbb added a comment.

  In D17858#388948 <https://phabricator.kde.org/D17858#388948>, @flherne wrote:
  > Perhaps the check found in `plugins/clang/clangsupport.cpp:185` should be moved into this function
  You mean something like
    dir = ...
    if (QFileInfo(dir).isDir() && QFile::exists(dir + QLatin1Char('/') + headerToCheck)) {
        return dir;
  Or more succinctly (QFile::exists() returns false or `/path/to/aFile/foo`, on Unix at least ;)),
    dir = ...
    if (QFile::exists(dir + QLatin1Char('/') + headerToCheck)) {
        return dir;
  I've followed that idea (except on Win32 where I cannot test) but I'm not sure if the result is to be preferred over the current implementation. More code...
  Come to think of it, what's with the lambda in `ClangHelpers::clangBuiltinIncludePath()`?


> mwolff wrote in clanghelpers.cpp:397
> does the following simplified code work as well?
>   auto dir = QDir(QStringLiteral(KDEV_CLANG_BUILTIN_DIR);
>   if (dir.cd(QStringLiteral("../../%1/include").arg(clangVersion()) {
>       clangDebug() << "Using builtin dir:" << dir.currentPath();
>       return dir.currentPath();
>   }

It does - after counting the braces, and when I use dir.path() (currentPath() is the app's cwd ;) )

  R32 KDevelop


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/39813e33/attachment-0001.html>

More information about the KDevelop-devel mailing list