Skip to content

Commit 08e0d11

Browse files
author
David Ungar
committed
Add filename non-empty assertions.
1 parent 129b376 commit 08e0d11

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

include/swift/Frontend/FrontendOptions.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,16 @@ class InputFile {
4747
/// string.
4848
InputFile(StringRef name, bool isPrimary,
4949
llvm::MemoryBuffer *buffer = nullptr)
50-
: Filename(name), IsPrimary(isPrimary), Buffer(buffer) {}
50+
: Filename(name), IsPrimary(isPrimary), Buffer(buffer) {
51+
assert(!name.empty());
52+
}
5153

5254
bool isPrimary() const { return IsPrimary; }
5355
llvm::MemoryBuffer *buffer() const { return Buffer; }
54-
StringRef file() const { return Filename; }
56+
StringRef file() const {
57+
assert(!Filename.empty());
58+
return Filename;
59+
}
5560

5661
void setBuffer(llvm::MemoryBuffer *buffer) { Buffer = buffer; }
5762

0 commit comments

Comments
 (0)