SILGen: Remove 'overrideLocationForMagicIdentifiers' hack
diff --git a/lib/SILGen/SILGen.cpp b/lib/SILGen/SILGen.cpp
index b0c4bff..5a5ea2a 100644
--- a/lib/SILGen/SILGen.cpp
+++ b/lib/SILGen/SILGen.cpp
@@ -943,10 +943,6 @@
preEmitFunction(constant, arg, f, arg);
PrettyStackTraceSILFunction X("silgen emitDefaultArgGenerator ", f);
SILGenFunction SGF(*this, *f);
- // Override location for #file, #line etc. to an invalid one so that we
- // don't put extra strings into the default argument generator function that
- // is not going to be ever used anyway.
- SGF.overrideLocationForMagicIdentifiers = SourceLoc();
SGF.emitGeneratorFunction(constant, arg);
postEmitFunction(constant, f);
});
diff --git a/lib/SILGen/SILGenApply.cpp b/lib/SILGen/SILGenApply.cpp
index a79cf6a..80956bb 100644
--- a/lib/SILGen/SILGenApply.cpp
+++ b/lib/SILGen/SILGenApply.cpp
@@ -4758,14 +4758,7 @@
init = stringLiteral->getInitializer();
} else {
ASTContext &ctx = getASTContext();
- SourceLoc loc;
-
- // If "overrideLocationForMagicIdentifiers" is set, then we use it as the
- // location point for these magic identifiers.
- if (overrideLocationForMagicIdentifiers)
- loc = overrideLocationForMagicIdentifiers.getValue();
- else
- loc = literal->getStartLoc();
+ SourceLoc loc = literal->getStartLoc();
auto magicLiteral = cast<MagicIdentifierLiteralExpr>(literal);
switch (magicLiteral->getKind()) {
diff --git a/lib/SILGen/SILGenExpr.cpp b/lib/SILGen/SILGenExpr.cpp
index e5f0598..e627745 100644
--- a/lib/SILGen/SILGenExpr.cpp
+++ b/lib/SILGen/SILGenExpr.cpp
@@ -2933,14 +2933,7 @@
visitMagicIdentifierLiteralExpr(MagicIdentifierLiteralExpr *E, SGFContext C) {
ASTContext &Ctx = SGF.getASTContext();
SILType Ty = SGF.getLoweredLoadableType(E->getType());
- SourceLoc Loc;
-
- // If "overrideLocationForMagicIdentifiers" is set, then we use it as the
- // location point for these magic identifiers.
- if (SGF.overrideLocationForMagicIdentifiers)
- Loc = SGF.overrideLocationForMagicIdentifiers.getValue();
- else
- Loc = E->getStartLoc();
+ SourceLoc Loc = E->getStartLoc();
switch (E->getKind()) {
case MagicIdentifierLiteralExpr::File:
diff --git a/lib/SILGen/SILGenFunction.h b/lib/SILGen/SILGenFunction.h
index c477eb9..ef39b34 100644
--- a/lib/SILGen/SILGenFunction.h
+++ b/lib/SILGen/SILGenFunction.h
@@ -470,12 +470,6 @@
/// function is valid.
bool allowsVoidReturn() const { return ReturnDest.getBlock()->args_empty(); }
- /// This location, when set, is used as an override location for magic
- /// identifier expansion (e.g. #file). This allows default argument
- /// expansion to report the location of the call, instead of the location
- /// of the original expr.
- Optional<SourceLoc> overrideLocationForMagicIdentifiers;
-
/// Emit code to increment a counter for profiling.
void emitProfilerIncrement(ASTNode N) {
if (SGM.Profiler && SGM.Profiler->hasRegionCounters())