-
Notifications
You must be signed in to change notification settings - Fork 17.7k
[clang][modules] Remove Module::ASTFile
#185994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4652,10 +4652,10 @@ ASTReader::ReadModuleMapFileBlock(RecordData &Record, ModuleFile &F, | |
| << F.ModuleName << F.BaseDirectory << M->Directory->getName(); | ||
|
|
||
| if (!canRecoverFromOutOfDate(F.FileName, ClientLoadCapabilities)) { | ||
| if (auto ASTFE = M ? M->getASTFile() : std::nullopt) { | ||
| if (auto ASTFileName = M ? M->getASTFileName() : nullptr) { | ||
| // This module was defined by an imported (explicit) module. | ||
| Diag(diag::err_module_file_conflict) << F.ModuleName << F.FileName | ||
| << ASTFE->getName(); | ||
| Diag(diag::err_module_file_conflict) | ||
| << F.ModuleName << F.FileName << *ASTFileName; | ||
| // TODO: Add a note with the module map paths if they differ. | ||
| } else { | ||
| // This module was built with a different module map. | ||
|
|
@@ -6339,15 +6339,16 @@ llvm::Error ASTReader::ReadSubmoduleBlock(ModuleFile &F, | |
| "too many submodules"); | ||
|
|
||
| if (!ParentModule) { | ||
| if (OptionalFileEntryRef CurFile = CurrentModule->getASTFile()) { | ||
| if (const ModuleFileKey *CurFileKey = CurrentModule->getASTFileKey()) { | ||
| // Don't emit module relocation error if we have -fno-validate-pch | ||
| if (!bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation & | ||
| DisableValidationForModuleKind::Module)) { | ||
| assert(CurFile != F.File && "ModuleManager did not de-duplicate"); | ||
| assert(*CurFileKey != F.FileKey && | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| "ModuleManager did not de-duplicate"); | ||
|
|
||
| Diag(diag::err_module_file_conflict) | ||
| << CurrentModule->getTopLevelModuleName() << CurFile->getName() | ||
| << F.File.getName(); | ||
| << CurrentModule->getTopLevelModuleName() | ||
| << *CurrentModule->getASTFileName() << F.FileName; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Static analysis flagged this as a potential nullptr deref. Is it safe to assume here
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The key and name can only be set together. The fact |
||
|
|
||
| auto CurModMapFile = | ||
| ModMap.getContainingModuleMapFile(CurrentModule); | ||
|
|
@@ -6361,7 +6362,7 @@ llvm::Error ASTReader::ReadSubmoduleBlock(ModuleFile &F, | |
| } | ||
|
|
||
| F.DidReadTopLevelSubmodule = true; | ||
| CurrentModule->setASTFile(F.File); | ||
| CurrentModule->setASTFileNameAndKey(F.FileName, F.FileKey); | ||
| CurrentModule->PresumedModuleMapFile = F.ModuleMapPath; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.