Skip to content

Commit 031be42

Browse files
committed
Ensure that we don't get a very-likely-wrong buffer ID
-1 was once used as a sentinel value for "no buffer"; make sure it doesn't persist anywhere.
1 parent 49aa0e9 commit 031be42

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/AST/Module.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3434,6 +3434,7 @@ SourceFile::SourceFile(ModuleDecl &M, SourceFileKind K,
34343434
ParsingOptions parsingOpts, bool isPrimary)
34353435
: FileUnit(FileUnitKind::Source, M), BufferID(bufferID),
34363436
ParsingOpts(parsingOpts), IsPrimary(isPrimary), Kind(K) {
3437+
assert(BufferID != ~0);
34373438
M.getASTContext().addDestructorCleanup(*this);
34383439

34393440
assert(!IsPrimary || M.isMainModule() &&

0 commit comments

Comments
 (0)