yrnkrn / zapcc

zapcc is a caching C++ compiler based on clang, designed to perform faster compilations
Other
1.25k stars 61 forks source link

Zapccs finish his work if code contains errors #25

Closed permotion88 closed 5 years ago

permotion88 commented 5 years ago

Does zapccs process should always end if the compiled code contains errors?

I tested it on a simple Hello World program, and when it contains some error, zapccs finishes ...

When programming very often the code is wrong, it means that everything will be compiled from the beginning? This may not be good for larger projects ...

Or do I use something the wrong way?

yrnkrn commented 5 years ago

You are using it correctly. It would be desirable but zapcc can't recover the compiler from an error state.

permotion88 commented 5 years ago

@yrnkrn Is there any workaround that building after error can be faster and not everything will be built from the beginning?

yrnkrn commented 5 years ago

The build system (make/ninja/msbuild) decides when to call the compiler. Build systems do not re-compile a source file unless there is a reason, the source file or one of the includes changed. zapcc clears the compilation cache after an error, but this will not trigger re-compilation of any files that had not changed. It just means zapcc behaves like ordinary compiler for the first file.

permotion88 commented 5 years ago

It's clear. But I have quite a specific problem, i.e. one main.cpp file that includes many clang header files:

Only the main.cpp file is edited and when errors occur there the next time everything is built from the beginning (It lasts even longer than built with clang)

`

include <clang/Driver/Options.h>

include <clang/AST/AST.h>

include <clang/AST/ASTConsumer.h>

include <clang/AST/ASTContext.h>

include <clang/AST/RecursiveASTVisitor.h>

include <clang/Frontend/ASTConsumers.h>

include <clang/Frontend/CompilerInstance.h>

include <clang/Frontend/FrontendActions.h>

include <clang/Tooling/CommonOptionsParser.h>

include <clang/Tooling/Tooling.h>

include <clang/Rewrite/Core/Rewriter.h>

include <clang/ASTMatchers/ASTMatchers.h>

include <clang/ASTMatchers/ASTMatchFinder.h>

include <llvm/Support/CommandLine.h>

`

Do you think that the use of zapcc in this case is a bad solution, or maybe you have an idea how I could improve the speed of recompilation after an error.

yrnkrn commented 5 years ago

With one file it's a tradeoff: without errors re-compilation will be very fast but with errors it will be somewhat slower than clang. Try not to make errors... or try to use precompiled headers, maybe they will work good for this case.

permotion88 commented 5 years ago

I understand, thanks for the advice and quick answers!