include paths for clang-tidy

31 views
Skip to first unread message

pseyfert...@gmail.com

unread,
Oct 2, 2019, 4:27:25 AM10/2/19
to Compiler Explorer Development
Dear compiler explorers,

after some digging why I couldn't get clang-tidy working on my local instance of compiler explorer, I found a reproducer on godbolt.org:


The source is just #include <llvm/ADT/SmallVector.h> and I enable LLVM as a library.

While the compilation succeeds (clang finds the header file, and presumably all transitive includes), clang-tidy errors with

<source>:1:10: error: 'llvm/ADT/SmallVector.h' file not found [clang-diagnostic-error]

#include <llvm/ADT/SmallVector.h>

^

2 errors generated.

Error while processing <source>.

Found compiler error(s).


And I thought if clang can digest code than so should clang-tidy - especially clang-diagnostic-error should not happen in clang-tidy anymore after clang passes.


So the -Ipath/to/llvm/includes does not end up in the compile_flags.txt here

https://github.com/mattgodbolt/compiler-explorer/blob/master/lib/tooling/clang-tidy-tool.js#L57

and isn't passed to clang-tidy as -extra-arg=-Ipath/to/llvm/includes, either.


For me locally I got this ironed out with this commit

https://github.com/pseyfert/compiler-explorer/commit/409ad31604a65694a86e8f861bb66a001a40054f,

i.e. copy and pasting the code from base-compiler.js that is responsible for getting the -I flags from the selected libraries into clang-tidy-tool.js.


I'm still early in testing if that's exactly what I want and haven't sent it into production yet, but I suspect you'll have a better way to pass include paths to clang-tidy than code duplication between base-compiler.js and clang-tidy-tool.js.


What do you think? (about the bodge or the underlying issue)


Greetings,

Paul

Matt Godbolt

unread,
Oct 14, 2019, 9:11:01 AM10/14/19
to compiler-explo...@googlegroups.com
Hi! I'm sorry for not spotting this email until just now (!!!)

I think I saw some traffic in the bug tracker about this: I think it has now been fixed, right? Via a pull request from your good self? :) Thank you!

Just wanted to apologise for this being list in the morass of emails: will do better!

--matt

--
You received this message because you are subscribed to the Google Groups "Compiler Explorer Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to compiler-explorer-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/compiler-explorer-development/428f5426-ed94-4db6-aba3-32f66f314c55%40googlegroups.com.


--
Matt

pseyfert...@gmail.com

unread,
Oct 14, 2019, 9:58:35 AM10/14/19
to Compiler Explorer Development
Hi,

yes, I kept poking at the issue. For the benefit of the group's archive the pull request (more complete than the initial draft) is:

https://github.com/mattgodbolt/compiler-explorer/pull/1617

Cheers,
Paul
Matt
Reply all
Reply to author
Forward
0 new messages