This is an archive of the discontinued LLVM Phabricator instance.

Survive #pragma once from virtual file.
AbandonedPublic

Authored by tapaswenipathak on Jun 21 2022, 8:19 PM.

Details

Summary

Add check before marking file as a once-only file.

Ref: https://github.com/vgvassilev/clang/commit/728e1b3286.

Authored-by: Vassil Vassilev <vvasilev@cern.ch>
Submitted-by: Tapasweni Pathak <tapaswenipathak@gmail.com>

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2022, 8:19 PM
tapaswenipathak requested review of this revision.Jun 21 2022, 8:19 PM

Can we write a test for this?

aaron.ballman added a subscriber: aaron.ballman.

+1, this needs some test coverage for the changes. It should also have a release note to notify users of the fix.

clang/lib/Lex/Pragma.cpp
415–419
if (const auto *FE = getCurrentFileLexer()->getFileEntry())
  HeaderInfo.MarkFileIncludedOnce(FE);

Historically, the patch was developed before the extended support of virtual files in Clang. Given that this is very hard to test and it looks like this is not needed on our end anymore. I'd propose to pause this for now.

Historically, the patch was developed before the extended support of virtual files in Clang. Given that this is very hard to test and it looks like this is not needed on our end anymore. I'd propose to pause this for now.

That'd be fine by me -- I'd recommend explicitly abandoning the revision in Phabricator if you don't intend to work on it (that gets it off everyone's review plate).

tapaswenipathak abandoned this revision.Jun 28 2022, 9:06 AM