This is an archive of the discontinued LLVM Phabricator instance.

Deterministic -gen-cdb-fragment-path filenames
Needs ReviewPublic

Authored by totph on Jul 24 2023, 10:18 AM.

Details

Summary

[clang] Deterministic -gen-cdb-fragment-path filenames

The files written into the given target directory follow the pattern
ab.c.X.json.

Instead of X being 4 randomly generated hexadecimal chars, it is now
a deterministic hash of the input and output filenames encoded in
10 base64 chars.

This means the output directory no longer fills up with duplicates,
and concatenating the *.json files continues to generates a useful
compilation database even after the first full project build.

The output file is also hashed so that these compiler calls can be
distinguished:
clang -c ab.c -o ab.o
clang -c ab.c -D_BAR_ -o bar.o

Diff Detail

Event Timeline

totph created this revision.Jul 24 2023, 10:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 24 2023, 10:18 AM
Herald added a subscriber: mgrang. · View Herald Transcript
totph requested review of this revision.Jul 24 2023, 10:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 24 2023, 10:18 AM