<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>I do need debug information because tracing code is a great way
      for me to get familiarized with clang and the static analyzer.</p>
    <p>I've managed to run "make -j8 clang" at the top of the build
      directory. However, the final linking process takes too long now.
      Is there a way to build a thin version that only runs the static
      analyzer? I think that I can at least cut the code gen part out of
      the build process but have no idea how. The only command I run is
      "clang -cc1 -analyze -analyzer-checker=xxx" It'd be great if I
      could reduce the final object file to few hundred megabytes.<br>
    </p>
    <p><tt>[ 96%] Built target clangStaticAnalyzerCore</tt><tt><br>
      </tt><tt>Scanning dependencies of target
        clangStaticAnalyzerCheckers</tt><tt><br>
      </tt><tt>[ 96%] Building CXX object
tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/clangStaticAnalyzerCheckers.dir/IntegerOverflowChecker.cpp.o</tt><tt><br>
      </tt><tt>[ 96%] Linking CXX static library
        ../../../../../lib/libclangStaticAnalyzerCheckers.a</tt><tt><br>
      </tt><tt>[100%] Built target clangStaticAnalyzerCheckers</tt><tt><br>
      </tt><tt>[100%] Linking CXX executable ../../../../bin/clang 
        <-- this take most time now</tt><tt><br>
      </tt><tt>[100%] Built target clang</tt><tt><br>
      </tt><tt><br>
      </tt><tt>real    2m22.707s</tt><tt><br>
      </tt><tt>user    2m10.812s</tt><tt><br>
      </tt><tt>sys     0m14.936s</tt><tt><br>
      </tt><br>
    </p>
    <pre class="moz-signature" cols="72">Thanks,
Lou
</pre>
    <div class="moz-cite-prefix">On 09/18/2018 06:25 PM, Reid Kleckner
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CACs=tyKE1K9LSmw58mt8wGVCZjkVHo2a1Mf6Dv7M_XeWqHqutA@mail.gmail.com">
      <div dir="ltr">If the clang binary is 2GB, I would recommend
        building in Release mode with assertions enabled. Linking
        binaries without debug information is dramatically faster. This
        means passing -DCMAKE_BUILD_TYPE=Release
        -DLLVM_ENABLE_ASSERTIONS=ON to cmake.
        <div><br>
          If you use debug information, I recommend explicitly building
          one target, the target you are testing (usually clang), until
          you feel the need to run the complete clang test suite.</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr">On Tue, Sep 18, 2018 at 5:42 PM Lou Wynn via
          cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org"
            moz-do-not-send="true">cfe-dev@lists.llvm.org</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'm writing my first clang static analyzer checker. I wrote
          the scaffold<br>
          code to add the checker into clang. But every time when I
          change the<br>
          checker implementation code, the build process after
          generating the<br>
          checker object file is very slow. It's over 4 minutes in my
          laptop,<br>
          which has the i7-6820HQ four core CPU and 32G memory. The
          generated<br>
          clang binary is over 2G. The affected artifacts are as
          follows:<br>
          <br>
          ---------------------<br>
          <br>
          Scanning dependencies of target clangStaticAnalyzerCheckers<br>
          [ 95%] Building CXX object<br>
tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/clangStaticAnalyzerCheckers.dir/IntegerOverflowChecker.cpp.o<br>
          [ 95%] Linking CXX static library<br>
          ../../../../../lib/libclangStaticAnalyzerCheckers.a<br>
          [ 98%] Built target clangStaticAnalyzerCheckers<br>
          [ 98%] Linking CXX executable ../../../../bin/arcmt-test<br>
          [ 98%] Linking CXX executable ../../../../bin/clang-check<br>
          [ 98%] Linking CXX executable ../../../../bin/clang<br>
          [ 98%] Linking CXX shared library ../../../../lib/libclang.so<br>
          [ 98%] Built target arcmt-test   <--- this seems to take
          the most time<br>
          [ 98%] Built target libclang<br>
          [ 98%] Linking CXX executable ../../../../bin/c-arcmt-test<br>
          [ 98%] Linking CXX executable ../../../../bin/c-index-test<br>
          [ 98%] Built target c-arcmt-test<br>
          [ 98%] Built target clang-check<br>
          [ 98%] Built target clang<br>
          [100%] Built target c-index-test<br>
          <br>
          real    4m23.014s<br>
          user    8m4.032s<br>
          sys     0m51.992s<br>
          <br>
          ---------------------<br>
          <br>
          How can I speed up the build process so that I don't have to
          wait for<br>
          almost 4.5 minute for a single change in the implementation
          code? I only<br>
          work on the checker of the static analyzer.<br>
          <br>
          -- <br>
          Thanks,<br>
          Lou<br>
          <br>
          _______________________________________________<br>
          cfe-dev mailing list<br>
          <a href="mailto:cfe-dev@lists.llvm.org" target="_blank"
            moz-do-not-send="true">cfe-dev@lists.llvm.org</a><br>
          <a
            href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev"
            rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>