diff options
author | Sergio Martins <smartins@kde.org> | 2019-10-03 22:13:29 +0100 |
---|---|---|
committer | Sergio Martins <smartins@kde.org> | 2019-10-03 22:15:38 +0100 |
commit | 884faa456e335117656ab2f5865e90cb0f149680 (patch) | |
tree | 1b721959e638558248d3a8b99a63551d0b61c330 | |
parent | 90cd69b289b4d83b111a58a4e853bbe975d33d8b (diff) |
Fix clazy-standalone with llvm-9
This is a temporary fix so it doesn't block distros from using clazy
with llvm-9. And I'm not even sure others can reproduce, as it
might be a local compiler bug here. Debugged it quite a bit and
couldn't reach any conclusion.
Nikolai, it would be great if you could run:
$ cd tests/
$ clazy-standalone auto-unexpected-qstringbuilder/main.cpp
after having uncommented:
// llvm::errs() << optionsParser.getSourcePathList().size() << "\n";
in ClazyStandaloneMain.cpp
should not print 0
CCMAIL: nikolai.kosjar@qt.io
-rw-r--r-- | src/ClazyStandaloneMain.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ClazyStandaloneMain.cpp b/src/ClazyStandaloneMain.cpp index cd471a7b..c678af9b 100644 --- a/src/ClazyStandaloneMain.cpp +++ b/src/ClazyStandaloneMain.cpp @@ -125,7 +125,20 @@ public: int main(int argc, const char **argv) { - CommonOptionsParser optionsParser(argc, argv, s_clazyCategory, cl::ZeroOrMore); +#if LLVM_VERSION_MAJOR >= 9 + /* HACK: cl::ZeroOrMore makes clazy-standalone stop working for some reason (with llvm-9). + * optionsParser.getSourcePathList() returns 0, even with a command as simple as: + * clang-standalone main.cpp + * The exact same command line works in clang-tidy, which has the same CommonOptionsParser code. + * Commented for now to figure if it's a compiler bug on my archlinux. + */ + auto numOccurrencesFlag = cl::OneOrMore; +#else + auto numOccurrencesFlag = cl::ZeroOrMore; +#endif + + CommonOptionsParser optionsParser(argc, argv, s_clazyCategory, numOccurrencesFlag); + llvm::errs() << optionsParser.getSourcePathList().size() << "\n"; if (s_supportedChecks.getValue()) { std::cout << SUPPORTED_CHECKS_JSON_STR; |