[cfe-dev] [RFC] cHash: Integration of AST hashing

Boris Kolpackov via cfe-dev cfe-dev at lists.llvm.org
Thu Aug 3 06:01:03 PDT 2017


Christian Dietrich via cfe-dev <cfe-dev at lists.llvm.org> writes:

> In C/C++ projects, we observe that a change to a central header file can
> cause a lot of compiler invocations.  However, not all compiler runs will
> lead to an object file that differs from the last invocation. For example,
> if I add a typedef that is never used in any .c file, none of the object
> files will change.

We are doing something similar in build2[1] though at the token stream
level (after preprocessing). One thing that we found to limit the
applicability of this approach is debug info: if you add a typedef
(presumably as a new line), then function definitions (if any) after
this line and in the same translation unit will have different debug
information (line position in the source code).

In build2, when calculating the hash, we include the position information
for each token. Do you do something similar at the AST level? If so, did
you find anything to mitigate such "line shift" changes?

[1] https://build2.org

Boris



More information about the cfe-dev mailing list