Skip to content

Conversation

dean0x7d
Copy link
Contributor

This feature is equivalent to CCACHE_BASEDIR and enables cache reuse across directories. This is needed because some absolute paths can end up in the preprocessed output via __FILE__ macros or other debugging mechanisms. This causes cache misses even though the code is otherwise identical.

When CLANG_TIDY_CACHE_BASEDIR/base_dir is set, we replace absolute paths that match that base prefix with relative paths in the preprocessed output.

Additionally, we need to pass the -P flag to the preprocessor to avoid linemarker comments that indicate which bit of the output came from which header path.

This feature is equivalent to `CCACHE_BASEDIR` and enables cache reuse
across directories. This is needed because some absolute paths can end
up in the preprocessed output via `__FILE__` macros or other debugging
mechanisms. This causes cache misses even though the code is otherwise
identical.

When `CLANG_TIDY_CACHE_BASEDIR`/`base_dir` is set, we replace absolute
paths that match that base prefix with relative paths in the preprocessed
output.

Additionally, we need to pass the `-P` flag to the preprocessor to avoid
linemarker comments that indicate which bit of the output came from which
header path.
if err != nil {
return nil, err
}
defer f.Close()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes a bug that is fixed in #17. The file is not closed before calling os.Remove at line 110, which results in an error.

mathstuf pushed a commit to mathstuf/clang-tidy-cache that referenced this pull request Jan 18, 2023
…exports

runClangTidyCommand: cache the stdout if no export-file is given
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants