Skip to content

Commit 63c4225

Browse files
committed
[Modules] Change result of reading AST block to llvm::Error instead
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
1 parent a417fa0 commit 63c4225

File tree

2 files changed

+231
-273
lines changed

2 files changed

+231
-273
lines changed

clang/include/clang/Serialization/ASTReader.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,18 +1313,18 @@ class ASTReader
13131313
ASTReaderListener *Listener,
13141314
bool ValidateDiagnosticOptions);
13151315

1316-
ASTReadResult ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities);
1317-
ASTReadResult ReadExtensionBlock(ModuleFile &F);
1316+
llvm::Error ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities);
1317+
llvm::Error ReadExtensionBlock(ModuleFile &F);
13181318
void ReadModuleOffsetMap(ModuleFile &F) const;
1319-
bool ParseLineTable(ModuleFile &F, const RecordData &Record);
1320-
bool ReadSourceManagerBlock(ModuleFile &F);
1319+
void ParseLineTable(ModuleFile &F, const RecordData &Record);
1320+
llvm::Error ReadSourceManagerBlock(ModuleFile &F);
13211321
llvm::BitstreamCursor &SLocCursorForID(int ID);
13221322
SourceLocation getImportLocation(ModuleFile *F);
13231323
ASTReadResult ReadModuleMapFileBlock(RecordData &Record, ModuleFile &F,
13241324
const ModuleFile *ImportedBy,
13251325
unsigned ClientLoadCapabilities);
1326-
ASTReadResult ReadSubmoduleBlock(ModuleFile &F,
1327-
unsigned ClientLoadCapabilities);
1326+
llvm::Error ReadSubmoduleBlock(ModuleFile &F,
1327+
unsigned ClientLoadCapabilities);
13281328
static bool ParseLanguageOptions(const RecordData &Record, bool Complain,
13291329
ASTReaderListener &Listener,
13301330
bool AllowCompatibleDifferences);
@@ -1896,8 +1896,9 @@ class ASTReader
18961896
/// ReadBlockAbbrevs - Enter a subblock of the specified BlockID with the
18971897
/// specified cursor. Read the abbreviations that are at the top of the block
18981898
/// and then leave the cursor pointing into the block.
1899-
static bool ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor, unsigned BlockID,
1900-
uint64_t *StartOfBlockOffset = nullptr);
1899+
static llvm::Error ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor,
1900+
unsigned BlockID,
1901+
uint64_t *StartOfBlockOffset = nullptr);
19011902

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

0 commit comments

Comments
 (0)