Build is broken with trunk LLVM/Clang. I think will be good idea to run Include What You Use over Clazy code. In file included from src/checks/detachingbase.cpp:28: In file included from src/QtUtils.h:28: src/MacroUtils.h:66:9: error: unknown type name 'StringRef' StringRef macro = clang::Lexer::getImmediateMacroName(loc, context->getSourceManager(), context->getLangOpts()); ^ In file included from src/checks/detachingbase.cpp:28: In file included from src/QtUtils.h:29: src/FunctionUtils.h:107:5: error: unknown type name 'StringRef' StringRef methodName = method->getName(); ^ In file included from src/checks/manuallevel/container-inside-loop.cpp:23: src/ClazyContext.h:127:9: error: unknown type name 'StringRef' StringRef fileName((*file)->getName()); ^
Git commit 25e8b84b964c2615c28856630ee5a34e355d5acb by Sergio Martins. Committed on 18/10/2018 at 20:51. Pushed by smartins into branch '1.4'. Ran include-what-you-use Fixes build with clang trunk M +21 -5 src/AccessSpecifierManager.cpp M +8 -2 src/AccessSpecifierManager.h M +18 -10 src/Clazy.cpp M +14 -5 src/Clazy.h M +6 -3 src/ClazyContext.cpp M +9 -5 src/ClazyContext.h M +9 -4 src/ClazyStandaloneMain.cpp M +10 -4 src/ContextUtils.cpp M +5 -4 src/ContextUtils.h M +7 -1 src/FixItUtils.cpp M +4 -2 src/FixItUtils.h M +13 -4 src/LoopUtils.cpp M +5 -2 src/LoopUtils.h M +10 -1 src/PreProcessorVisitor.cpp M +6 -3 src/PreProcessorVisitor.h M +4 -5 src/QtUtils.cpp M +21 -7 src/QtUtils.h M +5 -0 src/StringUtils.cpp M +20 -5 src/StringUtils.h M +8 -2 src/SuppressionManager.cpp M +3 -2 src/SuppressionManager.h M +11 -1 src/TemplateUtils.cpp M +3 -2 src/TemplateUtils.h M +11 -5 src/TypeUtils.cpp M +5 -2 src/TypeUtils.h M +24 -11 src/Utils.cpp M +17 -4 src/Utils.h M +23 -9 src/checkbase.cpp M +16 -7 src/checkbase.h M +9 -4 src/checkmanager.cpp M +6 -4 src/checkmanager.h M +9 -4 src/checks/detachingbase.cpp M +4 -2 src/checks/detachingbase.h M +17 -6 src/checks/inefficientqlistbase.cpp M +5 -1 src/checks/inefficientqlistbase.h M +10 -5 src/checks/level0/connect-by-name.cpp M +7 -0 src/checks/level0/connect-by-name.h M +8 -6 src/checks/level0/connect-non-signal.cpp M +7 -0 src/checks/level0/connect-non-signal.h M +12 -5 src/checks/level0/connect-not-normalized.cpp M +5 -0 src/checks/level0/connect-not-normalized.h M +14 -4 src/checks/level0/container-anti-pattern.cpp M +4 -0 src/checks/level0/container-anti-pattern.h M +8 -5 src/checks/level0/empty-qstringliteral.cpp M +8 -0 src/checks/level0/empty-qstringliteral.h M +21 -4 src/checks/level0/fully-qualified-moc-types.cpp M +13 -1 src/checks/level0/fully-qualified-moc-types.h M +11 -3 src/checks/level0/lambda-in-connect.cpp M +4 -0 src/checks/level0/lambda-in-connect.h M +15 -6 src/checks/level0/lambda-unique-connection.cpp M +7 -0 src/checks/level0/lambda-unique-connection.h M +11 -5 src/checks/level0/mutable-container-key.cpp M +7 -0 src/checks/level0/mutable-container-key.h M +11 -0 src/checks/level0/qcolor-from-literal.cpp M +9 -0 src/checks/level0/qcolor-from-literal.h M +14 -4 src/checks/level0/qdatetime-utc.cpp M +4 -0 src/checks/level0/qdatetime-utc.h M +11 -7 src/checks/level0/qenums.cpp M +9 -0 src/checks/level0/qenums.h M +9 -4 src/checks/level0/qfileinfo-exists.cpp M +4 -0 src/checks/level0/qfileinfo-exists.h M +15 -2 src/checks/level0/qgetenv.cpp M +4 -0 src/checks/level0/qgetenv.h M +9 -4 src/checks/level0/qmap-with-pointer-key.cpp M +7 -0 src/checks/level0/qmap-with-pointer-key.h M +17 -3 src/checks/level0/qstring-arg.cpp M +5 -0 src/checks/level0/qstring-arg.h M +14 -3 src/checks/level0/qstring-insensitive-allocation.cpp M +4 -0 src/checks/level0/qstring-insensitive-allocation.h M +23 -6 src/checks/level0/qstring-ref.cpp M +6 -0 src/checks/level0/qstring-ref.h M +5 -6 src/checks/level0/qt-macros.cpp M +7 -0 src/checks/level0/qt-macros.h M +16 -1 src/checks/level0/qvariant-template-instantiation.cpp M +7 -0 src/checks/level0/qvariant-template-instantiation.h M +18 -4 src/checks/level0/strict-iterators.cpp M +5 -0 src/checks/level0/strict-iterators.h M +14 -5 src/checks/level0/temporary-iterator.cpp M +8 -2 src/checks/level0/temporary-iterator.h M +18 -7 src/checks/level0/unused-non-trivial-variable.cpp M +7 -0 src/checks/level0/unused-non-trivial-variable.h M +14 -4 src/checks/level0/writing-to-temporary.cpp M +4 -0 src/checks/level0/writing-to-temporary.h M +18 -4 src/checks/level0/wrong-qevent-cast.cpp M +7 -0 src/checks/level0/wrong-qevent-cast.h M +14 -4 src/checks/level0/wrong-qglobalstatic.cpp M +4 -0 src/checks/level0/wrong-qglobalstatic.h M +17 -5 src/checks/level1/auto-unexpected-qstringbuilder.cpp M +5 -0 src/checks/level1/auto-unexpected-qstringbuilder.h M +16 -5 src/checks/level1/child-event-qobject-cast.cpp M +7 -0 src/checks/level1/child-event-qobject-cast.h M +11 -4 src/checks/level1/connect-3arg-lambda.cpp M +8 -0 src/checks/level1/connect-3arg-lambda.h M +12 -3 src/checks/level1/const-signal-or-slot.cpp M +8 -0 src/checks/level1/const-signal-or-slot.h M +16 -4 src/checks/level1/detaching-temporary.cpp M +11 -0 src/checks/level1/detaching-temporary.h M +20 -2 src/checks/level1/foreach.cpp M +4 -0 src/checks/level1/foreach.h M +18 -7 src/checks/level1/incorrect-emit.cpp M +9 -1 src/checks/level1/incorrect-emit.h M +1 -4 src/checks/level1/inefficient-qlist-soft.cpp M +4 -0 src/checks/level1/inefficient-qlist-soft.h M +12 -3 src/checks/level1/install-event-filter.cpp M +7 -0 src/checks/level1/install-event-filter.h M +15 -5 src/checks/level1/non-pod-global-static.cpp M +7 -0 src/checks/level1/non-pod-global-static.h M +10 -5 src/checks/level1/overridden-signal.cpp M +7 -0 src/checks/level1/overridden-signal.h M +6 -4 src/checks/level1/post-event.cpp M +7 -0 src/checks/level1/post-event.h M +11 -4 src/checks/level1/qdeleteall.cpp M +7 -0 src/checks/level1/qdeleteall.h M +10 -5 src/checks/level1/qhash-namespace.cpp M +7 -0 src/checks/level1/qhash-namespace.h M +9 -4 src/checks/level1/qlatin1string-non-ascii.cpp M +7 -0 src/checks/level1/qlatin1string-non-ascii.h M +13 -5 src/checks/level1/qproperty-without-notify.cpp M +9 -0 src/checks/level1/qproperty-without-notify.h M +9 -6 src/checks/level1/qstring-left.cpp M +7 -0 src/checks/level1/qstring-left.h M +12 -2 src/checks/level1/range-loop.cpp M +4 -0 src/checks/level1/range-loop.h M +11 -4 src/checks/level1/returning-data-from-temporary.cpp M +6 -0 src/checks/level1/returning-data-from-temporary.h M +9 -4 src/checks/level1/rule-of-two-soft.cpp M +4 -0 src/checks/level1/rule-of-two-soft.h M +11 -3 src/checks/level1/skipped-base-method.cpp M +7 -0 src/checks/level1/skipped-base-method.h M +7 -4 src/checks/level1/virtual-signal.cpp M +7 -0 src/checks/level1/virtual-signal.h M +16 -6 src/checks/level2/base-class-event.cpp M +7 -0 src/checks/level2/base-class-event.h M +11 -4 src/checks/level2/copyable-polymorphic.cpp M +5 -0 src/checks/level2/copyable-polymorphic.h M +11 -4 src/checks/level2/ctor-missing-parent-argument.cpp M +7 -0 src/checks/level2/ctor-missing-parent-argument.h M +15 -4 src/checks/level2/function-args-by-ref.cpp M +5 -0 src/checks/level2/function-args-by-ref.h M +25 -3 src/checks/level2/function-args-by-value.cpp M +8 -0 src/checks/level2/function-args-by-value.h M +9 -1 src/checks/level2/global-const-char-pointer.cpp M +7 -1 src/checks/level2/global-const-char-pointer.h M +23 -4 src/checks/level2/implicit-casts.cpp M +4 -0 src/checks/level2/implicit-casts.h M +13 -8 src/checks/level2/missing-qobject-macro.cpp M +7 -1 src/checks/level2/missing-qobject-macro.h M +13 -5 src/checks/level2/missing-typeinfo.cpp M +7 -0 src/checks/level2/missing-typeinfo.h M +26 -8 src/checks/level2/old-style-connect.cpp M +11 -0 src/checks/level2/old-style-connect.h M +25 -10 src/checks/level2/qstring-allocations.cpp M +5 -2 src/checks/level2/qstring-allocations.h M +11 -5 src/checks/level2/returning-void-expression.cpp M +7 -0 src/checks/level2/returning-void-expression.h M +15 -3 src/checks/level2/rule-of-three.cpp M +4 -0 src/checks/level2/rule-of-three.h M +9 -3 src/checks/level2/static-pmf.cpp M +7 -0 src/checks/level2/static-pmf.h M +13 -3 src/checks/level2/virtual-call-ctor.cpp M +5 -1 src/checks/level2/virtual-call-ctor.h M +17 -3 src/checks/level3/assert-with-side-effects.cpp M +7 -0 src/checks/level3/assert-with-side-effects.h M +15 -4 src/checks/level3/detaching-member.cpp M +7 -0 src/checks/level3/detaching-member.h M +16 -10 src/checks/level3/reserve-candidates.cpp M +6 -1 src/checks/level3/reserve-candidates.h M +14 -3 src/checks/level3/thread-with-slots.cpp M +8 -0 src/checks/level3/thread-with-slots.h M +11 -3 src/checks/level3/unneeded-cast.cpp M +9 -0 src/checks/level3/unneeded-cast.h M +14 -4 src/checks/manuallevel/container-inside-loop.cpp M +4 -0 src/checks/manuallevel/container-inside-loop.h M +2 -8 src/checks/manuallevel/inefficient-qlist.cpp M +4 -0 src/checks/manuallevel/inefficient-qlist.h M +12 -3 src/checks/manuallevel/isempty-vs-count.cpp M +4 -0 src/checks/manuallevel/isempty-vs-count.h M +9 -4 src/checks/manuallevel/qhash-with-char-pointer-key.cpp M +7 -0 src/checks/manuallevel/qhash-with-char-pointer-key.h M +12 -5 src/checks/manuallevel/qstring-varargs.cpp M +7 -0 src/checks/manuallevel/qstring-varargs.h M +12 -7 src/checks/manuallevel/qt-keywords.cpp M +9 -0 src/checks/manuallevel/qt-keywords.h M +17 -3 src/checks/manuallevel/qt4-qstring-from-array.cpp M +5 -1 src/checks/manuallevel/qt4-qstring-from-array.h M +8 -5 src/checks/manuallevel/raw-environment-function.cpp M +7 -0 src/checks/manuallevel/raw-environment-function.h M +7 -4 src/checks/manuallevel/tr-non-literal.cpp M +7 -0 src/checks/manuallevel/tr-non-literal.h M +7 -0 src/checks/ruleofbase.cpp M +4 -0 src/checks/ruleofbase.h https://commits.kde.org/clazy/25e8b84b964c2615c28856630ee5a34e355d5acb
Thank you for help!
Didn't do a build against trunk, so let me know if it's fixed.
Please add llvm:: before StringRef in variable declarations in all three files to fix build. ext/alloc_traits.h should be removed from Clazy.cpp, because it's STL internals which may vary between libstdc++/libc++. Clazy/src/Clazy.cpp:25:10: fatal error: 'ext/alloc_traits.h' file not found #include <ext/alloc_traits.h> Also, IWYU added LLVM/Clang include directives "" when Clazy code base uses <>, so order of headers is affected. Sometimes empty line separates headers and mess up their order.
try now Fixed alloc_traits.h and StringRef.
Builds OK now. By the word, I spotted include <stdlib.h> in Clazy.cpp. WIll be good idea to run Clang-tidy modernize-deprecated-headers, and probably other modernize and readability checks.