This is an archive of the discontinued LLVM Phabricator instance.

[ASTReader] Only mark module out of date if not already compiled
ClosedPublic

Authored by bnbarham on Apr 15 2021, 9:36 PM.

Details

Summary

If a module contains errors (ie. it was built with
-fallow-pcm-with-compiler-errors and had errors) and was from the module
cache, it is marked as out of date - see
a2c1054c303f20be006e9ef20739dbb88bd9ae02.

When a module is imported multiple times in the one compile, this caused
it to be recompiled each time - removing the existing buffer from the
module cache and replacing it. This results in various errors further
down the line.

Instead, only mark the module as out of date if it isn't already
finalized in the module cache.

Diff Detail

Event Timeline

bnbarham requested review of this revision.Apr 15 2021, 9:36 PM
bnbarham created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptApr 15 2021, 9:36 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
akyrtzi added inline comments.Apr 16 2021, 10:03 AM
clang/test/Modules/Inputs/error/error.h
1

Is this pragma relevant for the test?

bnbarham added inline comments.Apr 16 2021, 3:23 PM
clang/test/Modules/Inputs/error/error.h
1

I'll double check but I believe assertions are hit regardless, but with assertions off the test doesn't crash. Adding the #pragma causes it to crash.

akyrtzi accepted this revision.Apr 16 2021, 5:33 PM
This revision is now accepted and ready to land.Apr 16 2021, 5:33 PM
This revision was automatically updated to reflect the committed changes.