Skip to content

Commit 1e9d3b7

Browse files
committed
Make #file only include the filename
This change may have significant code size benefits.
1 parent 13b0fa9 commit 1e9d3b7

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5134,7 +5134,9 @@ RValue SILGenFunction::emitLiteral(LiteralExpr *literal, SGFContext C) {
51345134
std::string value;
51355135
if (loc.isValid())
51365136
value = ctx.SourceMgr.getDisplayNameForLoc(loc);
5137-
builtinLiteralArgs = emitStringLiteral(*this, literal, value, C,
5137+
builtinLiteralArgs = emitStringLiteral(*this, literal,
5138+
llvm::sys::path::filename(value),
5139+
C,
51385140
magicLiteral->getStringEncoding());
51395141
builtinInit = magicLiteral->getBuiltinInitializer();
51405142
init = magicLiteral->getInitializer();

test/PlaygroundTransform/implicit_return_never.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
func f() -> Int {
1515
fatalError()
16-
// CRASH-CHECK: {{[fF]}}atal error: file {{.*}}/main.swift, line [[@LINE-1]]
16+
// CRASH-CHECK: {{[fF]}}atal error: file main.swift, line [[@LINE-1]]
1717
}
1818

1919
f()

test/PlaygroundTransform/placeholder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
func f(crash crash: Bool) -> Int {
1616
if crash {
1717
return <#T#>
18-
// CRASH-CHECK: {{[fF]}}atal error: attempt to evaluate editor placeholder: file {{.*}}/main.swift, line [[@LINE-1]]
18+
// CRASH-CHECK: {{[fF]}}atal error: attempt to evaluate editor placeholder: file main.swift, line [[@LINE-1]]
1919
} else {
2020
return 42
2121
}

0 commit comments

Comments
 (0)