Rename getEmptyLocation to getCompilerGeneratedLocation
(cherry picked from commit d60ff05265339d9afba4a5c48fa8615d309889b1)
diff --git a/include/swift/SIL/SILLocation.h b/include/swift/SIL/SILLocation.h
index 9964ba1..c8d5093 100644
--- a/include/swift/SIL/SILLocation.h
+++ b/include/swift/SIL/SILLocation.h
@@ -502,9 +502,11 @@
}
};
-/// Empty locations may be applied to instructions without any clear
-/// correspondence to an AST node.
-static inline RegularLocation getEmptyLocation() { return {SourceLoc()}; }
+/// Compiler-generated locations may be applied to instructions without any
+/// clear correspondence to an AST node.
+static inline RegularLocation getCompilerGeneratedLocation() {
+ return {SourceLoc()};
+}
/// Used to represent a return instruction in user code.
///
@@ -709,7 +711,8 @@
SILLocation Location;
public:
- SILDebugLocation() : Scope(nullptr), Location(getEmptyLocation()) {}
+ SILDebugLocation()
+ : Scope(nullptr), Location(getCompilerGeneratedLocation()) {}
SILDebugLocation(SILLocation Loc, const SILDebugScope *DS)
: Scope(DS), Location(Loc) {}
SILLocation getLocation() const { return Location; }
diff --git a/lib/SILGen/SILGenProlog.cpp b/lib/SILGen/SILGenProlog.cpp
index 531b774..57d787f 100644
--- a/lib/SILGen/SILGenProlog.cpp
+++ b/lib/SILGen/SILGenProlog.cpp
@@ -522,7 +522,7 @@
// Record the ArgNo of the artificial $error inout argument.
unsigned ArgNo = emitter.getNumArgs();
if (throws) {
- RegularLocation Loc = getEmptyLocation();
+ RegularLocation Loc = getCompilerGeneratedLocation();
if (auto *AFD = dyn_cast<AbstractFunctionDecl>(DC))
Loc = AFD->getThrowsLoc();
else if (auto *ACE = dyn_cast<AbstractClosureExpr>(DC))
diff --git a/lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp b/lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp
index 12e16cd..48cdeac 100644
--- a/lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp
+++ b/lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp
@@ -2177,7 +2177,7 @@
// Use an empty location for the alloc_stack. If Loc is variable declaration
// the alloc_stack would look like the storage of that variable.
auto *ControlVariableBox =
- B.createAllocStack(getEmptyLocation(), IVType);
+ B.createAllocStack(getCompilerGeneratedLocation(), IVType);
// Find all the return blocks in the function, inserting a dealloc_stack
// before the return.
diff --git a/lib/SILOptimizer/Transforms/FunctionSignatureOpts.cpp b/lib/SILOptimizer/Transforms/FunctionSignatureOpts.cpp
index edea7c1..f179ad7 100644
--- a/lib/SILOptimizer/Transforms/FunctionSignatureOpts.cpp
+++ b/lib/SILOptimizer/Transforms/FunctionSignatureOpts.cpp
@@ -979,10 +979,12 @@
if (Arg->getType().isAddress()) {
assert(AD.PInfo->getConvention() == ParameterConvention::Indirect_In
&& F.getConventions().useLoweredAddresses());
- Builder.createDestroyAddr(getEmptyLocation(), F.getArguments()[AD.Index]);
+ Builder.createDestroyAddr(getCompilerGeneratedLocation(),
+ F.getArguments()[AD.Index]);
return;
}
- Builder.createReleaseValue(getEmptyLocation(), F.getArguments()[AD.Index],
+ Builder.createReleaseValue(getCompilerGeneratedLocation(),
+ F.getArguments()[AD.Index],
Builder.getDefaultAtomicity());
}
@@ -1026,12 +1028,13 @@
SILInstruction *Call = findOnlyApply(F);
if (auto AI = dyn_cast<ApplyInst>(Call)) {
Builder.setInsertionPoint(&*std::next(SILBasicBlock::iterator(AI)));
- Builder.createRetainValue(getEmptyLocation(), AI,
+ Builder.createRetainValue(getCompilerGeneratedLocation(), AI,
Builder.getDefaultAtomicity());
} else {
SILBasicBlock *NormalBB = cast<TryApplyInst>(Call)->getNormalBB();
Builder.setInsertionPoint(&*NormalBB->begin());
- Builder.createRetainValue(getEmptyLocation(), NormalBB->getArgument(0),
+ Builder.createRetainValue(getCompilerGeneratedLocation(),
+ NormalBB->getArgument(0),
Builder.getDefaultAtomicity());
}
}
diff --git a/lib/SILOptimizer/Utils/Local.cpp b/lib/SILOptimizer/Utils/Local.cpp
index 6f66457..5c5ef11 100644
--- a/lib/SILOptimizer/Utils/Local.cpp
+++ b/lib/SILOptimizer/Utils/Local.cpp
@@ -50,7 +50,7 @@
// Set up the builder we use to insert at our insertion point.
SILBuilder B(InsertPt);
- auto Loc = getEmptyLocation();
+ auto Loc = getCompilerGeneratedLocation();
// If Ptr is refcounted itself, create the strong_retain and
// return.
@@ -75,7 +75,7 @@
// Setup the builder we will use to insert at our insertion point.
SILBuilder B(InsertPt);
- auto Loc = getEmptyLocation();
+ auto Loc = getCompilerGeneratedLocation();
// If Ptr has reference semantics itself, create a strong_release.
if (Ptr->getType().isReferenceCounted(B.getModule())) {
diff --git a/lib/SILOptimizer/Utils/LoopUtils.cpp b/lib/SILOptimizer/Utils/LoopUtils.cpp
index bef98dd..6eee5a4 100644
--- a/lib/SILOptimizer/Utils/LoopUtils.cpp
+++ b/lib/SILOptimizer/Utils/LoopUtils.cpp
@@ -35,7 +35,7 @@
}
// Create the branch to the header.
- SILBuilder(Preheader).createBranch(getEmptyLocation(), Header,
+ SILBuilder(Preheader).createBranch(getCompilerGeneratedLocation(), Header,
Args);
return Preheader;
diff --git a/lib/Serialization/DeserializeSIL.cpp b/lib/Serialization/DeserializeSIL.cpp
index 360bd28..8b66a52 100644
--- a/lib/Serialization/DeserializeSIL.cpp
+++ b/lib/Serialization/DeserializeSIL.cpp
@@ -452,7 +452,7 @@
auto fn = existingFn;
// TODO: use the correct SILLocation from module.
- SILLocation loc = getEmptyLocation();
+ SILLocation loc = getCompilerGeneratedLocation();
// If we have an existing function, verify that the types match up.
if (fn) {