A preprocessed file doesn't properly reflect the original source,
so a checksum of it is pointless.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
+ @rnk who did the initial checksum stuff for CodeView.
I am unclear how the notion of checksums should interact with preprocessed files.
Nit: while many tests have dates in the filenames, we no longer use that convention.
After thinking about this a bit... The # directive will cause the filename to be identified as the source for the subsequent lines. That means it will show up as the original source file in the line table.
However, the compiler doesn't have the actual source file of the header (or the original source file, for that matter) and so cannot compute a correct checksum for it. That means, it should omit the checksum, for any file identified with a # directive.
I haven't looked at how CodeView handles this situation; for DWARF v5 I made inconsistent use of a checksum into an assertion offense.
Should we reconsider that? Or have the # directive cause Clang to omit checksums for *all* files, even the one it is actually reading?
@aprantl, @rnk, thoughts?
Once we encounter a # directive we are (most likely) looking at some form of preprocessed source and that means that the checksum will inevitably be different than what we would have gotten were we reading the file directly, because of the preprocessing. At this point the value of the hash approaches zero. I think dropping all checksums is reasonable in that situation.
I see that the per-file info does track the presence of # [line] N but it's not immediately obvious how to query "has any file seen one" which is really what I'd want to know. The file information has various levels of indirection...
Minor comment inline.
clang/lib/CodeGen/CGDebugInfo.cpp | ||
---|---|---|
378 ↗ | (On Diff #148663) | Can you add a comment explaining why we are doing this here? |
clang/lib/CodeGen/CGDebugInfo.cpp | ||
---|---|---|
378 ↗ | (On Diff #148663) | Of course. |