<div dir="ltr">Sorry for the breakage. All issues should be fixed by now.</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jun 28, 2018 at 8:26 AM Mikael Holmén <<a href="mailto:mikael.holmen@ericsson.com">mikael.holmen@ericsson.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I get the same compilation error when  I compile with clang 3.6.0.<br>
<br>
Revert?<br>
<br>
Regards,<br>
Mikael<br>
<br>
On 06/28/2018 03:16 AM, via cfe-commits wrote:<br>
> Hi, this commit also broke our internal bot for a different reason:<br>
> <br>
> FAILED: /usr/lib/ccache/clang++   -DGTEST_HAS_RTTI=0 <br>
> -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_LANG_CXX11=1 -D_DEBUG -D_GNU_SOURCE <br>
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS <br>
> -Itools/clang/unittests/StaticAnalyzer <br>
> -I/home/siadmin/jenkins/w/opensource/opensource_build/llvm/tools/clang/unittests/StaticAnalyzer <br>
> -I/home/siadmin/jenkins/w/opensource/opensource_build/llvm/tools/clang/include <br>
> -Itools/clang/include -Iinclude <br>
> -I/home/siadmin/jenkins/w/opensource/opensource_build/llvm/include <br>
> -I/home/siadmin/jenkins/w/opensource/opensource_build/llvm/utils/unittest/googletest/include <br>
> -I/home/siadmin/jenkins/w/opensource/opensource_build/llvm/utils/unittest/googlemock/include <br>
> -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall <br>
> -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual <br>
> -Wmissing-field-initializers -pedantic -Wno-long-long <br>
> -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor <br>
> -Wstring-conversion -fdiagnostics-color -ffunction-sections <br>
> -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types <br>
> -O3    -UNDEBUG  -Wno-variadic-macros <br>
> -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -fno-rtti -MMD <br>
> -MT <br>
> tools/clang/unittests/StaticAnalyzer/CMakeFiles/StaticAnalysisTests.dir/RegisterCustomCheckersTest.cpp.o <br>
> -MF <br>
> tools/clang/unittests/StaticAnalyzer/CMakeFiles/StaticAnalysisTests.dir/RegisterCustomCheckersTest.cpp.o.d <br>
> -o <br>
> tools/clang/unittests/StaticAnalyzer/CMakeFiles/StaticAnalysisTests.dir/RegisterCustomCheckersTest.cpp.o <br>
> -c <br>
> /home/siadmin/jenkins/w/opensource/opensource_build/llvm/tools/clang/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp<br>
> <br>
> /home/siadmin/jenkins/w/opensource/opensource_build/llvm/tools/clang/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp:64:12: <br>
> error: no viable conversion from <br>
> 'unique_ptr<clang::ento::AnalysisASTConsumer>' to <br>
> 'unique_ptr<clang::ASTConsumer>'<br>
> <br>
>      return AnalysisConsumer;<br>
> <br>
>             ^~~~~~~~~~~~~~~~<br>
> <br>
> /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/unique_ptr.h:157:17: <br>
> note: candidate constructor not viable: no known conversion from <br>
> 'std::unique_ptr<AnalysisASTConsumer>' to 'nullptr_t' for 1st argument<br>
> <br>
>        constexpr unique_ptr(nullptr_t) noexcept : unique_ptr() { }<br>
> <br>
>                  ^<br>
> <br>
> /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/unique_ptr.h:160:7: <br>
> note: candidate constructor not viable: no known conversion from <br>
> 'std::unique_ptr<AnalysisASTConsumer>' to <br>
> 'std::unique_ptr<clang::ASTConsumer, <br>
> std::default_delete<clang::ASTConsumer> > &&' for 1st argument<br>
> <br>
>        unique_ptr(unique_ptr&& __u) noexcept<br>
> <br>
>        ^<br>
> <br>
> /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/unique_ptr.h:169:2: <br>
> note: candidate constructor [with _Up = <br>
> clang::ento::AnalysisASTConsumer, _Ep = <br>
> std::default_delete<clang::ento::AnalysisASTConsumer>, $2 = void] not <br>
> viable: no known conversion from 'std::unique_ptr<AnalysisASTConsumer>' <br>
> to 'unique_ptr<clang::ento::AnalysisASTConsumer, <br>
> std::default_delete<clang::ento::AnalysisASTConsumer> > &&' for 1st argument<br>
> <br>
>          unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept<br>
> <br>
>          ^<br>
> <br>
> /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/unique_ptr.h:273:7: <br>
> note: candidate constructor not viable: no known conversion from <br>
> 'std::unique_ptr<AnalysisASTConsumer>' to 'const <br>
> std::unique_ptr<clang::ASTConsumer, <br>
> std::default_delete<clang::ASTConsumer> > &' for 1st argument<br>
> <br>
>        unique_ptr(const unique_ptr&) = delete;<br>
> <br>
>        ^<br>
> <br>
> /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/unique_ptr.h:176:2: <br>
> note: candidate template ignored: could not match 'auto_ptr' against <br>
> 'unique_ptr'<br>
> <br>
>          unique_ptr(auto_ptr<_Up>&& __u) noexcept;<br>
> <br>
>          ^<br>
> <br>
> 1 error generated.<br>
> <br>
> Douglas Yung<br>
> <br>
> *From:*cfe-commits [mailto:<a href="mailto:cfe-commits-bounces@lists.llvm.org" target="_blank">cfe-commits-bounces@lists.llvm.org</a>] *On <br>
> Behalf Of *Artem Belevich via cfe-commits<br>
> *Sent:* Wednesday, June 27, 2018 14:30<br>
> *To:* Alexander Kornienko<br>
> *Cc:* cfe-commits<br>
> *Subject:* Re: r335740 - [analyzer] Allow registering custom <br>
> statically-linked analyzer checkers<br>
> <br>
> FYI,<br>
> <br>
> This commit breaks clang tests. It appears that StaticAnalysisTests <br>
> misses dependency on clangFrontend.<br>
> <br>
> --Artem<br>
> <br>
> [60/134] Linking CXX executable <br>
> tools/clang/unittests/StaticAnalyzer/StaticAnalysisTests<br>
> <br>
> FAILED: tools/clang/unittests/StaticAnalyzer/StaticAnalysisTests<br>
> <br>
> : && /usr/local/google/home/tra/local/clang/bin/clang++   -fPIC <br>
> -fvisibility-inlines-hidden -Werror=date-time <br>
> -Werror=unguarded-availability-new -std=c++11 -Wall -Wextra <br>
> -Wno-unused-parameter -Wwrite-strings -Wcast-qual <br>
> -Wmissing-field-initializers -pedantic -Wno-long-long <br>
> -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor <br>
> -Wstring-conversion -fdiagnostics-color -fno-common -Woverloaded-virtual <br>
> -Wno-nested-anon-types -g  -fuse-ld=lld -Xlinker --gdb-index <br>
> -fuse-ld=lld -Wl,--color-diagnostics -Wl,-allow-shlib-undefined <br>
> tools/clang/unittests/StaticAnalyzer/CMakeFiles/StaticAnalysisTests.dir/AnalyzerOptionsTest.cpp.o <br>
> tools/clang/unittests/StaticAnalyzer/CMakeFiles/StaticAnalysisTests.dir/RegisterCustomCheckersTest.cpp.o <br>
> -o tools/clang/unittests/StaticAnalyzer/StaticAnalysisTests  <br>
> lib/libLLVMSupport.so.7svn -lpthread lib/libgtest_main.so.7svn <br>
> lib/libgtest.so.7svn -lpthread lib/libclangBasic.so.7svn <br>
> lib/libclangAnalysis.so.7svn lib/libclangStaticAnalyzerCore.so.7svn <br>
> lib/libclangStaticAnalyzerFrontend.so.7svn lib/libclangTooling.so.7svn <br>
> -Wl,-rpath,/usr/local/google/home/tra/work/llvm/build/release+assert/lib <br>
> && :<br>
> <br>
> /usr/local/google/home/tra/local/clang/bin/ld.lld: error: undefined <br>
> symbol: clang::FrontendAction::FrontendAction()<br>
> <br>
>>>> referenced by FrontendAction.h:235 (/usr/local/google/home/tra/work/llvm/repo/clang/include/clang/Frontend/FrontendAction.h:235)<br>
> <br>
>>>>               tools/clang/unittests/StaticAnalyzer/CMakeFiles/StaticAnalysisTests.dir/RegisterCustomCheckersTest.cpp.o:(clang::ASTFrontendAction::ASTFrontendAction())<br>
> <br>
> /usr/local/google/home/tra/local/clang/bin/ld.lld: error: undefined <br>
> symbol: vtable for clang::ASTFrontendAction<br>
> <br>
>>>> referenced by FrontendAction.h:235 (/usr/local/google/home/tra/work/llvm/repo/clang/include/clang/Frontend/FrontendAction.h:235)<br>
> <br>
>>>>               tools/clang/unittests/StaticAnalyzer/CMakeFiles/StaticAnalysisTests.dir/RegisterCustomCheckersTest.cpp.o:(clang::ASTFrontendAction::ASTFrontendAction())<br>
> <br>
> /usr/local/google/home/tra/local/clang/bin/ld.lld: error: undefined <br>
> symbol: clang::FrontendAction::~FrontendAction()<br>
> <br>
>>>> referenced by FrontendAction.h:225 (/usr/local/google/home/tra/work/llvm/repo/clang/include/clang/Frontend/FrontendAction.h:225)<br>
> <br>
>>>>               tools/clang/unittests/StaticAnalyzer/CMakeFiles/StaticAnalysisTests.dir/RegisterCustomCheckersTest.cpp.o:(clang::ASTFrontendAction::~ASTFrontendAction())<br>
> <br>
> /usr/local/google/home/tra/local/clang/bin/ld.lld: error: undefined <br>
> symbol: clang::PCHContainerOperations::PCHContainerOperations()<br>
> <br>
>>>> referenced by new_allocator.h:136 (/usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/ext/new_allocator.h:136)<br>
> <br>
>>>>               tools/clang/unittests/StaticAnalyzer/CMakeFiles/StaticAnalysisTests.dir/RegisterCustomCheckersTest.cpp.o:(void __gnu_cxx::new_allocator<clang::PCHContainerOperations>::construct<clang::PCHContainerOperations>(clang::PCHContainerOperations*))<br>
> <br>
> /usr/local/google/home/tra/local/clang/bin/ld.lld: error: undefined <br>
> symbol: clang::ASTFrontendAction::ExecuteAction()<br>
> <br>
>>>> referenced by RegisterCustomCheckersTest.cpp<br>
> <br>
>>>>               tools/clang/unittests/StaticAnalyzer/CMakeFiles/StaticAnalysisTests.dir/RegisterCustomCheckersTest.cpp.o:(vtable for clang::ento::(anonymous namespace)::TestAction)<br>
> <br>
> /usr/local/google/home/tra/local/clang/bin/ld.lld: error: undefined <br>
> symbol: clang::FrontendAction::shouldEraseOutputFiles()<br>
> <br>
>>>> referenced by RegisterCustomCheckersTest.cpp<br>
> <br>
>>>>               tools/clang/unittests/StaticAnalyzer/CMakeFiles/StaticAnalysisTests.dir/RegisterCustomCheckersTest.cpp.o:(vtable for clang::ento::(anonymous namespace)::TestAction)<br>
> <br>
> clang: error: linker command failed with exit code 1 (use -v to see <br>
> invocation)<br>
> <br>
> On Wed, Jun 27, 2018 at 8:00 AM Alexander Kornienko via cfe-commits <br>
> <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a> <mailto:<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>>> wrote:<br>
> <br>
>     Author: alexfh<br>
>     Date: Wed Jun 27 07:56:12 2018<br>
>     New Revision: 335740<br>
> <br>
>     URL: <a href="http://llvm.org/viewvc/llvm-project?rev=335740&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=335740&view=rev</a><br>
>     Log:<br>
>     [analyzer] Allow registering custom statically-linked analyzer checkers<br>
> <br>
>     Summary:<br>
>     Add an extension point to allow registration of statically-linked<br>
>     Clang Static<br>
>     Analyzer checkers that are not a part of the Clang tree. This<br>
>     extension point<br>
>     employs the mechanism used when checkers are registered from<br>
>     dynamically loaded<br>
>     plugins.<br>
> <br>
>     Reviewers: george.karpenkov, NoQ, xazax.hun, dcoughlin<br>
> <br>
>     Reviewed By: george.karpenkov<br>
> <br>
>     Subscribers: mgorny, mikhail.ramalho, rnkovacs, xazax.hun, szepet,<br>
>     a.sidorin, cfe-commits<br>
> <br>
>     Differential Revision: <a href="https://reviews.llvm.org/D45718" rel="noreferrer" target="_blank">https://reviews.llvm.org/D45718</a><br>
> <br>
>     Added:<br>
>          cfe/trunk/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp<br>
>     Modified:<br>
>          cfe/trunk/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h<br>
>         <br>
>     cfe/trunk/include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h<br>
>          cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp<br>
>          cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp<br>
>          cfe/trunk/unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp<br>
>          cfe/trunk/unittests/StaticAnalyzer/CMakeLists.txt<br>
> <br>
>     Modified:<br>
>     cfe/trunk/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h<br>
>     URL:<br>
>     <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h?rev=335740&r1=335739&r2=335740&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h?rev=335740&r1=335739&r2=335740&view=diff</a><br>
>     ==============================================================================<br>
>     ---<br>
>     cfe/trunk/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h<br>
>     (original)<br>
>     +++<br>
>     cfe/trunk/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h<br>
>     Wed Jun 27 07:56:12 2018<br>
>     @@ -17,6 +17,7 @@<br>
> <br>
>       #include "clang/AST/ASTConsumer.h"<br>
>       #include "clang/Basic/LLVM.h"<br>
>     +#include <functional><br>
>       #include <memory><br>
> <br>
>       namespace clang {<br>
>     @@ -29,10 +30,24 @@ class CompilerInstance;<br>
>       namespace ento {<br>
>       class PathDiagnosticConsumer;<br>
>       class CheckerManager;<br>
>     +class CheckerRegistry;<br>
> <br>
>       class AnalysisASTConsumer : public ASTConsumer {<br>
>       public:<br>
>         virtual void AddDiagnosticConsumer(PathDiagnosticConsumer<br>
>     *Consumer) = 0;<br>
>     +<br>
>     +  /// This method allows registering statically linked custom<br>
>     checkers that are<br>
>     +  /// not a part of the Clang tree. It employs the same mechanism<br>
>     that is used<br>
>     +  /// by plugins.<br>
>     +  ///<br>
>     +  /// Example:<br>
>     +  ///<br>
>     +  ///   Consumer->AddCheckerRegistrationFn([] (CheckerRegistry&<br>
>     Registry) {<br>
>     +  ///   <br>
>       Registry.addChecker<MyCustomChecker>("example.MyCustomChecker",<br>
>     +  ///                                          "Description");<br>
>     +  ///   });<br>
>     +  virtual void<br>
>     +  AddCheckerRegistrationFn(std::function<void(CheckerRegistry &)><br>
>     Fn) = 0;<br>
>       };<br>
> <br>
>       /// CreateAnalysisConsumer - Creates an ASTConsumer to run various<br>
>     code<br>
> <br>
>     Modified:<br>
>     cfe/trunk/include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h<br>
>     URL:<br>
>     <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h?rev=335740&r1=335739&r2=335740&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h?rev=335740&r1=335739&r2=335740&view=diff</a><br>
>     ==============================================================================<br>
>     ---<br>
>     cfe/trunk/include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h (original)<br>
>     +++<br>
>     cfe/trunk/include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h Wed<br>
>     Jun 27 07:56:12 2018<br>
>     @@ -11,6 +11,7 @@<br>
>       #define LLVM_CLANG_STATICANALYZER_FRONTEND_CHECKERREGISTRATION_H<br>
> <br>
>       #include "clang/Basic/LLVM.h"<br>
>     +#include <functional><br>
>       #include <memory><br>
>       #include <string><br>
> <br>
>     @@ -21,10 +22,13 @@ namespace clang {<br>
> <br>
>       namespace ento {<br>
>         class CheckerManager;<br>
>     +  class CheckerRegistry;<br>
> <br>
>     -  std::unique_ptr<CheckerManager><br>
>     -  createCheckerManager(AnalyzerOptions &opts, const LangOptions<br>
>     &langOpts,<br>
>     -                       ArrayRef<std::string> plugins,<br>
>     DiagnosticsEngine &diags);<br>
>     +  std::unique_ptr<CheckerManager> createCheckerManager(<br>
>     +      AnalyzerOptions &opts, const LangOptions &langOpts,<br>
>     +      ArrayRef<std::string> plugins,<br>
>     +      ArrayRef<std::function<void(CheckerRegistry &)>><br>
>     checkerRegistrationFns,<br>
>     +      DiagnosticsEngine &diags);<br>
> <br>
>       } // end ento namespace<br>
> <br>
> <br>
>     Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp<br>
>     URL:<br>
>     <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp?rev=335740&r1=335739&r2=335740&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp?rev=335740&r1=335739&r2=335740&view=diff</a><br>
>     ==============================================================================<br>
>     --- cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp<br>
>     (original)<br>
>     +++ cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Wed<br>
>     Jun 27 07:56:12 2018<br>
>     @@ -164,6 +164,8 @@ class AnalysisConsumer : public Analysis<br>
>         /// Bug Reporter to use while recursively visiting Decls.<br>
>         BugReporter *RecVisitorBR;<br>
> <br>
>     +  std::vector<std::function<void(CheckerRegistry &)>><br>
>     CheckerRegistrationFns;<br>
>     +<br>
>       public:<br>
>         ASTContext *Ctx;<br>
>         const Preprocessor &PP;<br>
>     @@ -293,8 +295,9 @@ public:<br>
> <br>
>         void Initialize(ASTContext &Context) override {<br>
>           Ctx = &Context;<br>
>     -    checkerMgr = createCheckerManager(*Opts, PP.getLangOpts(), Plugins,<br>
>     -                                      PP.getDiagnostics());<br>
>     +    checkerMgr =<br>
>     +        createCheckerManager(*Opts, PP.getLangOpts(), Plugins,<br>
>     +                             CheckerRegistrationFns,<br>
>     PP.getDiagnostics());<br>
> <br>
>           Mgr = llvm::make_unique<AnalysisManager>(<br>
>               *Ctx, PP.getDiagnostics(), PP.getLangOpts(), PathConsumers,<br>
>     @@ -385,6 +388,10 @@ public:<br>
>           PathConsumers.push_back(Consumer);<br>
>         }<br>
> <br>
>     +  void<br>
>     AddCheckerRegistrationFn(std::function<void(CheckerRegistry&)> Fn)<br>
>     override {<br>
>     +    CheckerRegistrationFns.push_back(std::move(Fn));<br>
>     +  }<br>
>     +<br>
>       private:<br>
>         void storeTopLevelDecls(DeclGroupRef DG);<br>
>         std::string getFunctionName(const Decl *D);<br>
> <br>
>     Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp<br>
>     URL:<br>
>     <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp?rev=335740&r1=335739&r2=335740&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp?rev=335740&r1=335739&r2=335740&view=diff</a><br>
>     ==============================================================================<br>
>     --- cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp<br>
>     (original)<br>
>     +++ cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp<br>
>     Wed Jun 27 07:56:12 2018<br>
>     @@ -111,16 +111,21 @@ getCheckerOptList(const AnalyzerOptions<br>
>         return checkerOpts;<br>
>       }<br>
> <br>
>     -std::unique_ptr<CheckerManager><br>
>     -ento::createCheckerManager(AnalyzerOptions &opts, const LangOptions<br>
>     &langOpts,<br>
>     -                           ArrayRef<std::string> plugins,<br>
>     -                           DiagnosticsEngine &diags) {<br>
>     +std::unique_ptr<CheckerManager> ento::createCheckerManager(<br>
>     +    AnalyzerOptions &opts, const LangOptions &langOpts,<br>
>     +    ArrayRef<std::string> plugins,<br>
>     +    ArrayRef<std::function<void(CheckerRegistry &)>><br>
>     checkerRegistrationFns,<br>
>     +    DiagnosticsEngine &diags) {<br>
>         std::unique_ptr<CheckerManager> checkerMgr(<br>
>             new CheckerManager(langOpts, opts));<br>
> <br>
>         SmallVector<CheckerOptInfo, 8> checkerOpts =<br>
>     getCheckerOptList(opts);<br>
> <br>
>         ClangCheckerRegistry allCheckers(plugins, &diags);<br>
>     +<br>
>     +  for (const auto &Fn : checkerRegistrationFns)<br>
>     +    Fn(allCheckers);<br>
>     +<br>
>         allCheckers.initializeManager(*checkerMgr, checkerOpts);<br>
>         allCheckers.validateCheckerOptions(opts, diags);<br>
>         checkerMgr->finishedCheckerRegistration();<br>
> <br>
>     Modified: cfe/trunk/unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp<br>
>     URL:<br>
>     <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp?rev=335740&r1=335739&r2=335740&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp?rev=335740&r1=335739&r2=335740&view=diff</a><br>
>     ==============================================================================<br>
>     --- cfe/trunk/unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp<br>
>     (original)<br>
>     +++ cfe/trunk/unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp Wed<br>
>     Jun 27 07:56:12 2018<br>
>     @@ -1,4 +1,4 @@<br>
>     -//===- unittest/Analysis/AnalyzerOptionsTest.cpp - SA Options test<br>
>     --------===//<br>
>     +//===- unittest/StaticAnalyzer/AnalyzerOptionsTest.cpp - SA Options<br>
>     test --===//<br>
>       //<br>
>       //                     The LLVM Compiler Infrastructure<br>
>       //<br>
> <br>
>     Modified: cfe/trunk/unittests/StaticAnalyzer/CMakeLists.txt<br>
>     URL:<br>
>     <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/StaticAnalyzer/CMakeLists.txt?rev=335740&r1=335739&r2=335740&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/StaticAnalyzer/CMakeLists.txt?rev=335740&r1=335739&r2=335740&view=diff</a><br>
>     ==============================================================================<br>
>     --- cfe/trunk/unittests/StaticAnalyzer/CMakeLists.txt (original)<br>
>     +++ cfe/trunk/unittests/StaticAnalyzer/CMakeLists.txt Wed Jun 27<br>
>     07:56:12 2018<br>
>     @@ -4,11 +4,14 @@ set(LLVM_LINK_COMPONENTS<br>
> <br>
>       add_clang_unittest(StaticAnalysisTests<br>
>         AnalyzerOptionsTest.cpp<br>
>     +  RegisterCustomCheckersTest.cpp<br>
>         )<br>
> <br>
>       target_link_libraries(StaticAnalysisTests<br>
>         PRIVATE<br>
>         clangBasic<br>
>         clangAnalysis<br>
>     -  clangStaticAnalyzerCore<br>
>     +  clangStaticAnalyzerCore<br>
>     +  clangStaticAnalyzerFrontend<br>
>     +  clangTooling<br>
>         )<br>
> <br>
>     Added: cfe/trunk/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp<br>
>     URL:<br>
>     <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp?rev=335740&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp?rev=335740&view=auto</a><br>
>     ==============================================================================<br>
>     ---<br>
>     cfe/trunk/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp<br>
>     (added)<br>
>     +++<br>
>     cfe/trunk/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp<br>
>     Wed Jun 27 07:56:12 2018<br>
>     @@ -0,0 +1,80 @@<br>
>     +//===- unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp<br>
>     ------------===//<br>
>     +//<br>
>     +//                     The LLVM Compiler Infrastructure<br>
>     +//<br>
>     +// This file is distributed under the University of Illinois Open<br>
>     Source<br>
>     +// License. See LICENSE.TXT for details.<br>
>     +//<br>
>     +//===----------------------------------------------------------------------===//<br>
>     +<br>
>     +#include "clang/Frontend/CompilerInstance.h"<br>
>     +#include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"<br>
>     +#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"<br>
>     +#include "clang/StaticAnalyzer/Core/Checker.h"<br>
>     +#include "clang/StaticAnalyzer/Core/CheckerRegistry.h"<br>
>     +#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"<br>
>     +#include "clang/StaticAnalyzer/Frontend/AnalysisConsumer.h"<br>
>     +#include "clang/Tooling/Tooling.h"<br>
>     +#include "gtest/gtest.h"<br>
>     +<br>
>     +namespace clang {<br>
>     +namespace ento {<br>
>     +namespace {<br>
>     +<br>
>     +class CustomChecker : public Checker<check::ASTCodeBody> {<br>
>     +public:<br>
>     +  void checkASTCodeBody(const Decl *D, AnalysisManager &Mgr,<br>
>     +                        BugReporter &BR) const {<br>
>     +    BR.EmitBasicReport(D, this, "Custom diagnostic",<br>
>     categories::LogicError,<br>
>     +                       "Custom diagnostic description",<br>
>     +                       PathDiagnosticLocation(D,<br>
>     Mgr.getSourceManager()), {});<br>
>     +  }<br>
>     +};<br>
>     +<br>
>     +class TestAction : public ASTFrontendAction {<br>
>     +  class DiagConsumer : public PathDiagnosticConsumer {<br>
>     +    llvm::raw_ostream &Output;<br>
>     +<br>
>     +  public:<br>
>     +    DiagConsumer(llvm::raw_ostream &Output) : Output(Output) {}<br>
>     +    void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *><br>
>     &Diags,<br>
>     +                              FilesMade *filesMade) override {<br>
>     +      for (const auto *PD : Diags)<br>
>     +        Output << PD->getCheckName() << ":" <<<br>
>     PD->getShortDescription();<br>
>     +    }<br>
>     +<br>
>     +    StringRef getName() const override { return "Test"; }<br>
>     +  };<br>
>     +<br>
>     +  llvm::raw_ostream &DiagsOutput;<br>
>     +<br>
>     +public:<br>
>     +  TestAction(llvm::raw_ostream &DiagsOutput) :<br>
>     DiagsOutput(DiagsOutput) {}<br>
>     +<br>
>     +  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance<br>
>     &Compiler,<br>
>     +                                                 StringRef File)<br>
>     override {<br>
>     +    std::unique_ptr<AnalysisASTConsumer> AnalysisConsumer =<br>
>     +        CreateAnalysisConsumer(Compiler);<br>
>     +    AnalysisConsumer->AddDiagnosticConsumer(new<br>
>     DiagConsumer(DiagsOutput));<br>
>     +    Compiler.getAnalyzerOpts()->CheckersControlList = {<br>
>     +        {"custom.CustomChecker", true}};<br>
>     +    AnalysisConsumer->AddCheckerRegistrationFn([](CheckerRegistry<br>
>     &Registry) {<br>
>     +      Registry.addChecker<CustomChecker>("custom.CustomChecker",<br>
>     "Description");<br>
>     +    });<br>
>     +    return AnalysisConsumer;<br>
>     +  }<br>
>     +};<br>
>     +<br>
>     +<br>
>     +TEST(RegisterCustomCheckers, RegisterChecker) {<br>
>     +  std::string Diags;<br>
>     +  {<br>
>     +    llvm::raw_string_ostream OS(Diags);<br>
>     +    EXPECT_TRUE(tooling::runToolOnCode(new TestAction(OS), "void<br>
>     f() {;}"));<br>
>     +  }<br>
>     +  EXPECT_EQ(Diags, "custom.CustomChecker:Custom diagnostic<br>
>     description");<br>
>     +}<br>
>     +<br>
>     +}<br>
>     +}<br>
>     +}<br>
> <br>
> <br>
>     _______________________________________________<br>
>     cfe-commits mailing list<br>
>     <a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a> <mailto:<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>><br>
>     <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
> <br>
> <br>
> -- <br>
> <br>
> --Artem Belevich<br>
> <br>
> <br>
> <br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
> <br>
<br>
</blockquote></div>