Skip to content

Commit

Permalink
[Modules] Change result of reading AST block to llvm::Error instead
Browse files Browse the repository at this point in the history
Reading the AST block can never fail with a recoverable error as modules
cannot be removed during this phase. Change the return type of these
functions to return an llvm::Error instead, ie. either success or
failure.

NFC other than the wording of some of the errors.

Differential Revision: https://reviews.llvm.org/D108268
  • Loading branch information
bnbarham authored and vsapsai committed Aug 28, 2021
1 parent 022538f commit a4a5c00
Show file tree
Hide file tree
Showing 2 changed files with 231 additions and 273 deletions.
17 changes: 9 additions & 8 deletions clang/include/clang/Serialization/ASTReader.h
Expand Up @@ -1320,18 +1320,18 @@ class ASTReader
ASTReaderListener *Listener,
bool ValidateDiagnosticOptions);

ASTReadResult ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities);
ASTReadResult ReadExtensionBlock(ModuleFile &F);
llvm::Error ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities);
llvm::Error ReadExtensionBlock(ModuleFile &F);
void ReadModuleOffsetMap(ModuleFile &F) const;
bool ParseLineTable(ModuleFile &F, const RecordData &Record);
bool ReadSourceManagerBlock(ModuleFile &F);
void ParseLineTable(ModuleFile &F, const RecordData &Record);
llvm::Error ReadSourceManagerBlock(ModuleFile &F);
llvm::BitstreamCursor &SLocCursorForID(int ID);
SourceLocation getImportLocation(ModuleFile *F);
ASTReadResult ReadModuleMapFileBlock(RecordData &Record, ModuleFile &F,
const ModuleFile *ImportedBy,
unsigned ClientLoadCapabilities);
ASTReadResult ReadSubmoduleBlock(ModuleFile &F,
unsigned ClientLoadCapabilities);
llvm::Error ReadSubmoduleBlock(ModuleFile &F,
unsigned ClientLoadCapabilities);
static bool ParseLanguageOptions(const RecordData &Record, bool Complain,
ASTReaderListener &Listener,
bool AllowCompatibleDifferences);
Expand Down Expand Up @@ -1904,8 +1904,9 @@ class ASTReader
/// ReadBlockAbbrevs - Enter a subblock of the specified BlockID with the
/// specified cursor. Read the abbreviations that are at the top of the block
/// and then leave the cursor pointing into the block.
static bool ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor, unsigned BlockID,
uint64_t *StartOfBlockOffset = nullptr);
static llvm::Error ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor,
unsigned BlockID,
uint64_t *StartOfBlockOffset = nullptr);

/// Finds all the visible declarations with a given name.
/// The current implementation of this method just loads the entire
Expand Down

0 comments on commit a4a5c00

Please sign in to comment.