Separate underlying storage and location kind in SILLocation and

remove the mixed concept that was SILFileLocation.
Also add support for a third type of underlying storage that will be used
for deserialized debug lcoations from textual SIL.

NFC

<rdar://problem/22706994>
This commit is contained in:
Adrian Prantl
2016-02-19 11:16:38 -08:00
parent f560f3caac
commit 40c7a1abee
14 changed files with 218 additions and 205 deletions

View File

@@ -65,7 +65,7 @@ private:
typedef llvm::PointerUnion4<Stmt*, Expr*, Decl*, Pattern*> ASTNodeTy; typedef llvm::PointerUnion4<Stmt*, Expr*, Decl*, Pattern*> ASTNodeTy;
public: public:
enum LocationKind { enum LocationKind : unsigned {
// FIXME: NoneKind is to be removed. // FIXME: NoneKind is to be removed.
NoneKind = 0, NoneKind = 0,
RegularKind = 1, RegularKind = 1,
@@ -74,29 +74,53 @@ public:
InlinedKind = 4, InlinedKind = 4,
MandatoryInlinedKind = 5, MandatoryInlinedKind = 5,
CleanupKind = 6, CleanupKind = 6,
ArtificialUnreachableKind = 7, ArtificialUnreachableKind = 7
SILFileKind = 8
}; };
protected: enum StorageKind : unsigned {
/// Primary AST location, always used for diagnostics. UnknownKind = 0,
ASTNodeTy ASTNode; ASTNodeKind = 1 << 3,
SILFileKind = 1 << 4,
DebugInfoKind = 1 << 3 | 1 << 4
};
union SpecificLoc { typedef struct {
SpecificLoc() : DebugLoc() {} unsigned Line = 0, Col = 0;
/// If coming from a .sil file, this is the location in the .sil file. const char *Filename = nullptr;
SourceLoc SILFileSourceLoc; } DebugLoc;
/// Sometimes the location for diagnostics needs to be
/// different than the one used to emit the line table. If protected:
/// HasDebugLoc is set, this is used for the debug info. union UnderlyingLocation {
ASTNodeTy DebugLoc; UnderlyingLocation() : DebugInfoLoc({}) {}
} SpecificLoc; UnderlyingLocation(ASTNodeTy N) : ASTNode(N) {}
UnderlyingLocation(SourceLoc L) : SILFileLoc(L) {}
struct ASTNodeLoc {
ASTNodeLoc(ASTNodeTy N) : Primary(N) {}
/// Primary AST location, always used for diagnostics.
ASTNodeTy Primary;
/// Sometimes the location for diagnostics needs to be
/// different than the one used to emit the line table. If
/// HasDebugLoc is set, this is used for the debug info.
ASTNodeTy ForDebugger;
} ASTNode;
/// A location inside a textual .sil file.
SourceLoc SILFileLoc;
/// A deserialized source location.
DebugLoc DebugInfoLoc;
} Loc;
/// The kind of this SIL location. /// The kind of this SIL location.
unsigned KindData; unsigned KindData;
enum { enum {
BaseBits = 4, BaseMask = 0xF, LocationKindBits = 3,
LocationKindMask = 7,
StorageKindBits = 2,
StorageKindMask = (1 << 3) | (1 << 4),
SpecialFlagsMask = ~ (LocationKindMask | StorageKindMask),
/// Used to mark this instruction as part of auto-generated /// Used to mark this instruction as part of auto-generated
/// code block. /// code block.
@@ -106,7 +130,8 @@ protected:
/// represent this SILLocation. For example, when the host instruction /// represent this SILLocation. For example, when the host instruction
/// is known to correspond to the beginning or the end of the source /// is known to correspond to the beginning or the end of the source
/// range of the ASTNode. /// range of the ASTNode.
PointsToStartBit = 6, PointsToEndBit = 7, PointsToStartBit = 6,
PointsToEndBit = 7,
/// Used to notify that this instruction belongs to the top- /// Used to notify that this instruction belongs to the top-
/// level (module) scope. /// level (module) scope.
@@ -115,14 +140,7 @@ protected:
IsInTopLevel = 8, IsInTopLevel = 8,
/// Marks this instruction as belonging to the function prologue. /// Marks this instruction as belonging to the function prologue.
IsInPrologue = 9, IsInPrologue = 9
/// Indicates that SILFileSourceLoc is present.
HasSILFileSourceLoc = 10,
/// Indicates that DebugLoc should be used for emitting debug info.
HasDebugLoc = 11
}; };
template <typename T> template <typename T>
@@ -133,7 +151,8 @@ protected:
template <typename T> template <typename T>
bool isNode(ASTNodeTy Node) const { bool isNode(ASTNodeTy Node) const {
if (ASTNode.is<typename base_type<T>::type*>()) assert(isASTNode());
if (Loc.ASTNode.Primary.is<typename base_type<T>::type*>())
return isa<T>(Node.get<typename base_type<T>::type*>()); return isa<T>(Node.get<typename base_type<T>::type*>());
return false; return false;
} }
@@ -147,22 +166,40 @@ protected:
/// @{ /// @{
/// This constructor is used to support getAs operation. /// This constructor is used to support getAs operation.
SILLocation() {} SILLocation() { assert(Loc.DebugInfoLoc.Line == 0); }
SILLocation(LocationKind K, unsigned Flags = 0) : KindData(K | Flags) {
SILLocation(LocationKind K, unsigned Flags = 0) assert(Loc.DebugInfoLoc.Line == 0);
: KindData(unsigned(K) | Flags) {} }
SILLocation(Stmt *S, LocationKind K, unsigned Flags = 0) SILLocation(Stmt *S, LocationKind K, unsigned Flags = 0)
: ASTNode(S), KindData(unsigned(K) | Flags) {} : Loc(S), KindData(K | Flags) {
setStorageKind(ASTNodeKind);
assert(isASTNode());
}
SILLocation(Expr *E, LocationKind K, unsigned Flags = 0) SILLocation(Expr *E, LocationKind K, unsigned Flags = 0)
: ASTNode(E), KindData(unsigned(K) | Flags) {} : Loc(E), KindData(K | Flags) {
setStorageKind(ASTNodeKind);
assert(isASTNode());
}
SILLocation(Decl *D, LocationKind K, unsigned Flags = 0) SILLocation(Decl *D, LocationKind K, unsigned Flags = 0)
: ASTNode(D), KindData(unsigned(K) | Flags) {} : Loc(D), KindData(K | Flags) {
setStorageKind(ASTNodeKind);
assert(isASTNode());
}
SILLocation(Pattern *P, LocationKind K, unsigned Flags = 0) SILLocation(Pattern *P, LocationKind K, unsigned Flags = 0)
: ASTNode(P), KindData(unsigned(K) | Flags) {} : Loc(P), KindData(K | Flags) {
setStorageKind(ASTNodeKind);
assert(isASTNode());
}
SILLocation(SourceLoc L, LocationKind K, unsigned Flags = 0)
: Loc(L), KindData(K | Flags) {
setStorageKind(SILFileKind);
assert(isSILFile());
}
/// @} /// @}
private: private:
@@ -171,9 +208,12 @@ private:
friend class InlinedLocation; friend class InlinedLocation;
friend class CleanupLocation; friend class CleanupLocation;
void setKind(LocationKind K) { KindData |= (K & BaseMask); } void setLocationKind(LocationKind K) { KindData |= (K & LocationKindMask); }
unsigned getSpecialFlags() const { return unsigned(KindData) & ~BaseMask; } void setStorageKind(StorageKind K) { KindData |= (K & StorageKindMask); }
void setSpecialFlags(unsigned Flags) { KindData |= (Flags & ~BaseMask); } unsigned getSpecialFlags() const { return KindData & SpecialFlagsMask; }
void setSpecialFlags(unsigned Flags) {
KindData |= (Flags & SpecialFlagsMask);
}
SourceLoc getSourceLoc(ASTNodeTy N) const; SourceLoc getSourceLoc(ASTNodeTy N) const;
SourceLoc getStartSourceLoc(ASTNodeTy N) const; SourceLoc getStartSourceLoc(ASTNodeTy N) const;
@@ -184,22 +224,43 @@ public:
/// When an ASTNode gets implicitly converted into a SILLocation we /// When an ASTNode gets implicitly converted into a SILLocation we
/// construct a RegularLocation. Since RegularLocations represent the majority /// construct a RegularLocation. Since RegularLocations represent the majority
/// of locations, this greatly simplifies the user code. /// of locations, this greatly simplifies the user code.
SILLocation(Stmt *S) : ASTNode(S), KindData(RegularKind) {} SILLocation(Stmt *S) : Loc(S), KindData(RegularKind) {
SILLocation(Expr *E) : ASTNode(E), KindData(RegularKind) {} setStorageKind(ASTNodeKind);
SILLocation(Decl *D) : ASTNode(D), KindData(RegularKind) {} assert(isASTNode());
SILLocation(Pattern *P) : ASTNode(P), KindData(RegularKind) {} }
SILLocation(Expr *E) : Loc(E), KindData(RegularKind) {
setStorageKind(ASTNodeKind);
assert(isASTNode());
}
SILLocation(Decl *D) : Loc(D), KindData(RegularKind) {
setStorageKind(ASTNodeKind);
assert(isASTNode());
}
SILLocation(Pattern *P) : Loc(P), KindData(RegularKind) {
setStorageKind(ASTNodeKind);
assert(isASTNode());
}
/// Check if the location wraps an AST node or a valid SIL file /// Check if the location wraps an AST node or a valid SIL file
/// location. /// location.
/// ///
/// Artificial locations and the top-level module locations will be null. /// Artificial locations and the top-level module locations will be null.
bool isNull() const { bool isNull() const {
if (hasSILFileSourceLoc()) switch (getStorageKind()) {
return SpecificLoc.SILFileSourceLoc.isInvalid(); case ASTNodeKind: return Loc.ASTNode.Primary.isNull();
return ASTNode.isNull(); case DebugInfoKind: return Loc.DebugInfoLoc.Filename;
case SILFileKind: return Loc.SILFileLoc.isInvalid();
default: return true;
}
} }
explicit operator bool() const { return !isNull(); } explicit operator bool() const { return !isNull(); }
/// Return whether this location is backed by an AST node.
bool isASTNode() const { return getStorageKind() == ASTNodeKind; }
/// Return whether this location came from a SIL file.
bool isSILFile() const { return getStorageKind() == SILFileKind; }
/// Marks the location as coming from auto-generated body. /// Marks the location as coming from auto-generated body.
void markAutoGenerated() { KindData |= (1 << AutoGeneratedBit); } void markAutoGenerated() { KindData |= (1 << AutoGeneratedBit); }
@@ -235,37 +296,19 @@ public:
/// Check is this location is part of a function's implicit prologue. /// Check is this location is part of a function's implicit prologue.
bool isInPrologue() const { return KindData & (1 << IsInPrologue); } bool isInPrologue() const { return KindData & (1 << IsInPrologue); }
void setHasSILFileSourceLoc() {
assert(!hasDebugLoc() &&
"SILFileSourceLoc and DebugLoc are mutually exclusive");
KindData |= (1 << HasSILFileSourceLoc);
}
bool hasSILFileSourceLoc() const {
return KindData & (1 << HasSILFileSourceLoc);
}
SourceLoc getSILFileSourceLoc() const {
assert(hasSILFileSourceLoc() && "no SILFileSourceLoc");
return SpecificLoc.SILFileSourceLoc;
}
/// Add an ASTNode to use as the location for debugging /// Add an ASTNode to use as the location for debugging
/// purposes if this location is different from the location used /// purposes if this location is different from the location used
/// for diagnostics. /// for diagnostics.
template <typename T> template <typename T>
void setDebugLoc(T *ASTNodeForDebugging) { void setDebugLoc(T *ASTNodeForDebugging) {
assert(!hasDebugLoc() && "DebugLoc already present"); assert(!hasDebugLoc() && "DebugLoc already present");
assert(!hasSILFileSourceLoc() && assert(isASTNode() && "not an AST location");
"SILFileSourceLoc and DebugLoc are mutually exclusive"); Loc.ASTNode.ForDebugger = ASTNodeForDebugging;
KindData |= (1 << HasDebugLoc);
SpecificLoc.DebugLoc = ASTNodeForDebugging;
} }
bool hasDebugLoc() const { bool hasDebugLoc() const {
return KindData & (1 << HasDebugLoc); return isASTNode() && !Loc.ASTNode.ForDebugger.isNull();
} }
bool hasASTLocation() const { return !ASTNode.isNull(); }
/// Check if the corresponding source code location definitely points /// Check if the corresponding source code location definitely points
/// to the start of the AST node. /// to the start of the AST node.
bool alwaysPointsToStart() const { return KindData & (1 << PointsToStartBit);} bool alwaysPointsToStart() const { return KindData & (1 << PointsToStartBit);}
@@ -274,7 +317,12 @@ public:
/// to the end of the AST node. /// to the end of the AST node.
bool alwaysPointsToEnd() const { return KindData & (1 << PointsToEndBit); } bool alwaysPointsToEnd() const { return KindData & (1 << PointsToEndBit); }
LocationKind getKind() const { return (LocationKind)(KindData & BaseMask); } LocationKind getKind() const {
return LocationKind(KindData & LocationKindMask);
}
StorageKind getStorageKind() const {
return StorageKind(KindData & StorageKindMask);
}
template <typename T> template <typename T>
bool is() const { bool is() const {
@@ -302,25 +350,28 @@ public:
/// If the current value is of the specified AST unit type T, /// If the current value is of the specified AST unit type T,
/// return it, otherwise return null. /// return it, otherwise return null.
template <typename T> template <typename T> T *getAsASTNode() const {
T *getAsASTNode() const { return getNodeAs<T>(ASTNode); } return isASTNode() ? getNodeAs<T>(Loc.ASTNode.Primary) : nullptr;
}
/// Returns true if the Location currently points to the AST node /// Returns true if the Location currently points to the AST node
/// matching type T. /// matching type T.
template <typename T> template <typename T> bool isASTNode() const {
bool isASTNode() const { return isNode<T>(ASTNode); } return isASTNode() && isNode<T>(Loc.ASTNode.Primary);
}
/// Returns the primary value as the specified AST node type. If the /// Returns the primary value as the specified AST node type. If the
/// specified type is incorrect, asserts. /// specified type is incorrect, asserts.
template <typename T> template <typename T> T *castToASTNode() const {
T *castToASTNode() const { return castNodeTo<T>(ASTNode); } assert(isASTNode());
return castNodeTo<T>(Loc.ASTNode.Primary);
}
/// If the DebugLoc is of the specified AST unit type T, /// If the DebugLoc is of the specified AST unit type T,
/// return it, otherwise return null. /// return it, otherwise return null.
template <typename T> template <typename T> T *getDebugLocAsASTNode() const {
T *getDebugLocAsASTNode() const {
assert(hasDebugLoc() && "no debug location"); assert(hasDebugLoc() && "no debug location");
return getNodeAs<T>(SpecificLoc.DebugLoc); return getNodeAs<T>(Loc.ASTNode.ForDebugger);
} }
SourceLoc getDebugSourceLoc() const; SourceLoc getDebugSourceLoc() const;
@@ -332,10 +383,11 @@ public:
return { getStartSourceLoc(), getEndSourceLoc() }; return { getStartSourceLoc(), getEndSourceLoc() };
} }
typedef struct { /// Fingerprint a DebugLoc for use in a DenseMap.
unsigned Line = 0, Col = 0; typedef std::pair<std::pair<unsigned, unsigned>, const void *> DebugLocKey;
const char *Filename = nullptr; struct DebugLocHash : public DebugLocKey {
} DebugLoc; DebugLocHash(DebugLoc L) : DebugLocKey({{L.Line, L.Col}, L.Filename}) {}
};
/// Extract the line, column, and filename. /// Extract the line, column, and filename.
static DebugLoc decode(SourceLoc Loc, const SourceManager &SM); static DebugLoc decode(SourceLoc Loc, const SourceManager &SM);
@@ -352,17 +404,21 @@ public:
/// Returns an opaque pointer value for the debug location that may /// Returns an opaque pointer value for the debug location that may
/// be used to unique debug locations. /// be used to unique debug locations.
const void *getOpaquePointerValue() const { const void *getOpaquePointerValue() const {
if (hasSILFileSourceLoc()) if (isSILFile())
return getSILFileSourceLoc().getOpaquePointerValue(); return Loc.SILFileLoc.getOpaquePointerValue();
return ASTNode.getOpaqueValue(); if (isASTNode())
return Loc.ASTNode.Primary.getOpaqueValue();
else
return 0;
} }
unsigned getOpaqueKind() const { return KindData; } unsigned getOpaqueKind() const { return KindData; }
inline bool operator==(const SILLocation& R) const { inline bool operator==(const SILLocation& R) const {
return KindData == R.KindData && return KindData == R.KindData &&
ASTNode.getOpaqueValue() == R.ASTNode.getOpaqueValue() && Loc.ASTNode.Primary.getOpaqueValue() ==
SpecificLoc.DebugLoc.getOpaqueValue() == R.Loc.ASTNode.Primary.getOpaqueValue() &&
R.SpecificLoc.DebugLoc.getOpaqueValue(); Loc.ASTNode.ForDebugger.getOpaqueValue() ==
R.Loc.ASTNode.ForDebugger.getOpaqueValue();
} }
}; };
@@ -373,6 +429,7 @@ public:
RegularLocation(Expr *E) : SILLocation(E, RegularKind) {} RegularLocation(Expr *E) : SILLocation(E, RegularKind) {}
RegularLocation(Decl *D) : SILLocation(D, RegularKind) {} RegularLocation(Decl *D) : SILLocation(D, RegularKind) {}
RegularLocation(Pattern *P) : SILLocation(P, RegularKind) {} RegularLocation(Pattern *P) : SILLocation(P, RegularKind) {}
RegularLocation(SourceLoc L) : SILLocation(L, RegularKind) {}
/// Returns a location representing the module. /// Returns a location representing the module.
static RegularLocation getModuleLocation() { static RegularLocation getModuleLocation() {
@@ -383,18 +440,15 @@ public:
/// If the current value is of the specified AST unit type T, /// If the current value is of the specified AST unit type T,
/// return it, otherwise return null. /// return it, otherwise return null.
template <typename T> template <typename T> T *getAs() const { return getNodeAs<T>(Loc.ASTNode); }
T *getAs() const { return getNodeAs<T>(ASTNode); }
/// Returns true if the Location currently points to the AST node /// Returns true if the Location currently points to the AST node
/// matching type T. /// matching type T.
template <typename T> template <typename T> bool is() const { return isNode<T>(Loc.ASTNode); }
bool is() const { return isNode<T>(ASTNode); }
/// Returns the primary value as the specified AST node type. If the /// Returns the primary value as the specified AST node type. If the
/// specified type is incorrect, asserts. /// specified type is incorrect, asserts.
template <typename T> template <typename T> T *castTo() const { return castNodeTo<T>(Loc.ASTNode); }
T *castTo() const { return castNodeTo<T>(ASTNode); }
static RegularLocation getAutoGeneratedLocation() { static RegularLocation getAutoGeneratedLocation() {
RegularLocation AL; RegularLocation AL;
@@ -425,13 +479,11 @@ public:
ReturnStmt *get() { ReturnStmt *get() {
return castToASTNode<ReturnStmt>(); return castToASTNode<ReturnStmt>();
} }
private: private:
friend class SILLocation; friend class SILLocation;
static bool isKind(const SILLocation& L) { static bool isKind(const SILLocation& L) {
return L.getKind() == ReturnKind; return L.getKind() == ReturnKind;
} }
ReturnLocation() : SILLocation(ReturnKind) {}
}; };
/// Used on the instruction that was generated to represent an implicit /// Used on the instruction that was generated to represent an implicit
@@ -459,7 +511,7 @@ public:
L.isASTNode<ValueDecl>() || L.isASTNode<ValueDecl>() ||
L.isASTNode<PatternBindingDecl>() || L.isASTNode<PatternBindingDecl>() ||
(L.isNull() && L.isInTopLevel())); (L.isNull() && L.isInTopLevel()));
L.setKind(ImplicitReturnKind); L.setLocationKind(ImplicitReturnKind);
return L; return L;
} }
@@ -492,8 +544,8 @@ public:
/// Constructs an inlined location when the call site is represented by a /// Constructs an inlined location when the call site is represented by a
/// SILFile location. /// SILFile location.
InlinedLocation(SourceLoc L) : SILLocation(InlinedKind) { InlinedLocation(SourceLoc L) : SILLocation(InlinedKind) {
setHasSILFileSourceLoc(); setStorageKind(SILFileKind);
SpecificLoc.SILFileSourceLoc = L; Loc.SILFileLoc = L;
} }
static InlinedLocation getInlinedLocation(SILLocation L); static InlinedLocation getInlinedLocation(SILLocation L);
@@ -509,10 +561,7 @@ private:
InlinedLocation(Stmt *S, unsigned F) : SILLocation(S, InlinedKind, F) {} InlinedLocation(Stmt *S, unsigned F) : SILLocation(S, InlinedKind, F) {}
InlinedLocation(Pattern *P, unsigned F) : SILLocation(P, InlinedKind, F) {} InlinedLocation(Pattern *P, unsigned F) : SILLocation(P, InlinedKind, F) {}
InlinedLocation(Decl *D, unsigned F) : SILLocation(D, InlinedKind, F) {} InlinedLocation(Decl *D, unsigned F) : SILLocation(D, InlinedKind, F) {}
InlinedLocation(SourceLoc L, unsigned F) : SILLocation(InlinedKind, F) { InlinedLocation(SourceLoc L, unsigned F) : SILLocation(L, InlinedKind, F) {}
setHasSILFileSourceLoc();
SpecificLoc.SILFileSourceLoc = L;
}
static InlinedLocation getModuleLocation(unsigned Flags) { static InlinedLocation getModuleLocation(unsigned Flags) {
auto L = InlinedLocation(); auto L = InlinedLocation();
@@ -539,10 +588,8 @@ public:
/// Constructs an inlined location when the call site is represented by a /// Constructs an inlined location when the call site is represented by a
/// SILFile location. /// SILFile location.
MandatoryInlinedLocation(SourceLoc L) : SILLocation(MandatoryInlinedKind) { MandatoryInlinedLocation(SourceLoc L)
setHasSILFileSourceLoc(); : SILLocation(L, MandatoryInlinedKind) {}
SpecificLoc.SILFileSourceLoc = L;
}
static MandatoryInlinedLocation getMandatoryInlinedLocation(SILLocation L); static MandatoryInlinedLocation getMandatoryInlinedLocation(SILLocation L);
@@ -558,23 +605,16 @@ private:
return L.getKind() == MandatoryInlinedKind; return L.getKind() == MandatoryInlinedKind;
} }
MandatoryInlinedLocation() : SILLocation(MandatoryInlinedKind) {} MandatoryInlinedLocation() : SILLocation(MandatoryInlinedKind) {}
MandatoryInlinedLocation(Expr *E, MandatoryInlinedLocation(Expr *E, unsigned F)
unsigned F) : SILLocation(E, MandatoryInlinedKind, : SILLocation(E, MandatoryInlinedKind, F) {}
F) {} MandatoryInlinedLocation(Stmt *S, unsigned F)
MandatoryInlinedLocation(Stmt *S, : SILLocation(S, MandatoryInlinedKind, F) {}
unsigned F) : SILLocation(S, MandatoryInlinedKind, MandatoryInlinedLocation(Pattern *P, unsigned F)
F) {} : SILLocation(P, MandatoryInlinedKind, F) {}
MandatoryInlinedLocation(Pattern *P, MandatoryInlinedLocation(Decl *D, unsigned F)
unsigned F) : SILLocation(P, MandatoryInlinedKind, : SILLocation(D, MandatoryInlinedKind, F) {}
F) {} MandatoryInlinedLocation(SourceLoc L, unsigned F)
MandatoryInlinedLocation(Decl *D, : SILLocation(L, MandatoryInlinedKind, F) {}
unsigned F) : SILLocation(D, MandatoryInlinedKind,
F) {}
MandatoryInlinedLocation(SourceLoc L,
unsigned F) : SILLocation(MandatoryInlinedKind, F) {
setHasSILFileSourceLoc();
SpecificLoc.SILFileSourceLoc = L;
}
}; };
/// Used on the instruction performing auto-generated cleanup such as /// Used on the instruction performing auto-generated cleanup such as
@@ -627,7 +667,6 @@ private:
class ArtificialUnreachableLocation : public SILLocation { class ArtificialUnreachableLocation : public SILLocation {
public: public:
ArtificialUnreachableLocation() : SILLocation(ArtificialUnreachableKind) {} ArtificialUnreachableLocation() : SILLocation(ArtificialUnreachableKind) {}
private: private:
friend class SILLocation; friend class SILLocation;
static bool isKind(const SILLocation& L) { static bool isKind(const SILLocation& L) {
@@ -635,27 +674,6 @@ private:
} }
}; };
/// Used to represent locations coming from a parsed SIL file.
///
/// Allowed on any SILInstruction.
class SILFileLocation : public SILLocation {
public:
SILFileLocation(SourceLoc L) : SILLocation(SILFileKind) {
setHasSILFileSourceLoc();
SpecificLoc.SILFileSourceLoc = L;
}
private:
friend class SILLocation;
static bool isKind(const SILLocation& L) {
return L.getKind() == SILFileKind;
}
SILFileLocation() : SILLocation(SILFileKind) {
setHasSILFileSourceLoc();
SpecificLoc.SILFileSourceLoc = SourceLoc();
}
};
} // end swift namespace } // end swift namespace

View File

@@ -348,7 +348,7 @@ void IRGenDebugInfo::setCurrentLoc(IRBuilder &Builder, const SILDebugScope *DS,
// //
// The actual closure has a closure expression as scope. // The actual closure has a closure expression as scope.
if (Loc && isAbstractClosure(*Loc) && DS && !isAbstractClosure(DS->Loc) if (Loc && isAbstractClosure(*Loc) && DS && !isAbstractClosure(DS->Loc)
&& Loc->getKind() != SILLocation::ImplicitReturnKind) && !Loc->is<ImplicitReturnLocation>())
return; return;
if (L.Line == 0 && DS == LastScope) { if (L.Line == 0 && DS == LastScope) {
@@ -660,7 +660,7 @@ llvm::DISubprogram *IRGenDebugInfo::emitFunction(
StringRef Name; StringRef Name;
if (DS) { if (DS) {
if (DS->Loc.getKind() == SILLocation::SILFileKind) if (DS->Loc.isSILFile())
Name = SILFn->getName(); Name = SILFn->getName();
else else
Name = getName(DS->Loc); Name = getName(DS->Loc);

View File

@@ -1547,7 +1547,7 @@ void IRGenSILFunction::visitSILBasicBlock(SILBasicBlock *BB) {
SILLocation ILoc = I.getLoc(); SILLocation ILoc = I.getLoc();
auto DS = I.getDebugScope(); auto DS = I.getDebugScope();
// Handle cleanup locations. // Handle cleanup locations.
if (ILoc.getKind() == SILLocation::CleanupKind) { if (ILoc.is<CleanupLocation>()) {
// Cleanup locations point to the decl of the value that is // Cleanup locations point to the decl of the value that is
// being destroyed (for diagnostic generation). As far as // being destroyed (for diagnostic generation). As far as
// the linetable is concerned, cleanups at the end of a // the linetable is concerned, cleanups at the end of a
@@ -1559,7 +1559,7 @@ void IRGenSILFunction::visitSILBasicBlock(SILBasicBlock *BB) {
// this basic block. // this basic block.
auto It = InsnIter; auto It = InsnIter;
do ++It; while (It != BB->end() && do ++It; while (It != BB->end() &&
It->getLoc().getKind() == SILLocation::CleanupKind); It->getLoc().is<CleanupLocation>());
// We are still in the middle of a basic block? // We are still in the middle of a basic block?
if (It != BB->end() && !isa<TermInst>(It)) if (It != BB->end() && !isa<TermInst>(It))
KeepCurrentLocation = true; KeepCurrentLocation = true;

View File

@@ -366,7 +366,7 @@ SILFunction *SILParser::getGlobalNameForDefinition(Identifier Name,
P.diagnose(Loc, diag::sil_value_use_type_mismatch, Name.str(), P.diagnose(Loc, diag::sil_value_use_type_mismatch, Name.str(),
Fn->getLoweredFunctionType(), Ty); Fn->getLoweredFunctionType(), Ty);
P.diagnose(It->second.second, diag::sil_prior_reference); P.diagnose(It->second.second, diag::sil_prior_reference);
auto loc = SILFileLocation(Loc); auto loc = RegularLocation(Loc);
Fn = Fn =
SILMod.getOrCreateFunction(SILLinkage::Private, "", Ty, nullptr, loc, SILMod.getOrCreateFunction(SILLinkage::Private, "", Ty, nullptr, loc,
IsNotBare, IsNotTransparent, IsNotFragile); IsNotBare, IsNotTransparent, IsNotFragile);
@@ -383,7 +383,7 @@ SILFunction *SILParser::getGlobalNameForDefinition(Identifier Name,
return Fn; return Fn;
} }
auto loc = SILFileLocation(Loc); auto loc = RegularLocation(Loc);
// If we don't have a forward reference, make sure the function hasn't been // If we don't have a forward reference, make sure the function hasn't been
// defined already. // defined already.
if (SILMod.lookUpFunction(Name.str()) != nullptr) { if (SILMod.lookUpFunction(Name.str()) != nullptr) {
@@ -410,7 +410,7 @@ SILFunction *SILParser::getGlobalNameForDefinition(Identifier Name,
SILFunction *SILParser::getGlobalNameForReference(Identifier Name, SILFunction *SILParser::getGlobalNameForReference(Identifier Name,
CanSILFunctionType Ty, CanSILFunctionType Ty,
SourceLoc Loc) { SourceLoc Loc) {
auto loc = SILFileLocation(Loc); auto loc = RegularLocation(Loc);
// Check to see if we have a function by this name already. // Check to see if we have a function by this name already.
if (SILFunction *FnRef = SILMod.lookUpFunction(Name.str())) { if (SILFunction *FnRef = SILMod.lookUpFunction(Name.str())) {
@@ -1042,7 +1042,7 @@ bool SILParser::parseTypedValueRef(SILValue &Result, SourceLoc &Loc,
parseSILType(Ty)) parseSILType(Ty))
return true; return true;
Result = getLocalValue(Name, Ty, SILFileLocation(Loc), B); Result = getLocalValue(Name, Ty, RegularLocation(Loc), B);
return false; return false;
} }
@@ -1443,7 +1443,7 @@ bool SILParser::parseSILInstruction(SILBasicBlock *BB) {
SmallVector<SILValue, 4> OpList; SmallVector<SILValue, 4> OpList;
SILValue Val; SILValue Val;
SILLocation InstLoc = SILFileLocation(OpcodeLoc); SILLocation InstLoc = RegularLocation(OpcodeLoc);
auto parseCastConsumptionKind = [&](Identifier name, SourceLoc loc, auto parseCastConsumptionKind = [&](Identifier name, SourceLoc loc,
CastConsumptionKind &out) -> bool { CastConsumptionKind &out) -> bool {
@@ -2337,7 +2337,7 @@ bool SILParser::parseSILInstruction(SILBasicBlock *BB) {
Type EltTy = TT->getElement(TypeElts.size()).getType(); Type EltTy = TT->getElement(TypeElts.size()).getType();
if (parseValueRef(Val, if (parseValueRef(Val,
SILType::getPrimitiveObjectType(EltTy->getCanonicalType()), SILType::getPrimitiveObjectType(EltTy->getCanonicalType()),
SILFileLocation(P.Tok.getLoc()), B)) RegularLocation(P.Tok.getLoc()), B))
return true; return true;
OpList.push_back(Val); OpList.push_back(Val);
TypeElts.push_back(Val->getType().getSwiftRValueType()); TypeElts.push_back(Val->getType().getSwiftRValueType());
@@ -2930,7 +2930,7 @@ bool SILParser::parseSILInstruction(SILBasicBlock *BB) {
// Parse 'case' value-ref ':' sil-identifier. // Parse 'case' value-ref ':' sil-identifier.
if (P.consumeIf(tok::kw_case)) { if (P.consumeIf(tok::kw_case)) {
if (parseValueRef(CaseVal, Val->getType(), if (parseValueRef(CaseVal, Val->getType(),
SILFileLocation(P.Tok.getLoc()), B)) { RegularLocation(P.Tok.getLoc()), B)) {
// TODO: Issue a proper error message here // TODO: Issue a proper error message here
P.diagnose(P.Tok, diag::expected_tok_in_sil_instr, "reference to a value"); P.diagnose(P.Tok, diag::expected_tok_in_sil_instr, "reference to a value");
return true; return true;
@@ -3618,7 +3618,7 @@ bool Parser::parseSILGlobal() {
auto *GV = SILGlobalVariable::create(*SIL->M, GlobalLinkage.getValue(), auto *GV = SILGlobalVariable::create(*SIL->M, GlobalLinkage.getValue(),
(IsFragile_t)isFragile, (IsFragile_t)isFragile,
GlobalName.str(),GlobalType, GlobalName.str(),GlobalType,
SILFileLocation(NameLoc)); RegularLocation(NameLoc));
GV->setLet(isLet); GV->setLet(isLet);
// Parse static initializer if exists. // Parse static initializer if exists.

View File

@@ -27,7 +27,7 @@ void swift::printSILLocationDescription(llvm::raw_ostream &out,
ASTContext &Context) { ASTContext &Context) {
if (loc.isNull()) { if (loc.isNull()) {
out << "<<invalid location>>"; out << "<<invalid location>>";
} else if (!loc.hasASTLocation()) { } else if (loc.isSILFile()) {
printSourceLocDescription(out, loc.getSourceLoc(), Context); printSourceLocDescription(out, loc.getSourceLoc(), Context);
} else if (auto decl = loc.getAsASTNode<Decl>()) { } else if (auto decl = loc.getAsASTNode<Decl>()) {
printDeclDescription(out, decl, Context); printDeclDescription(out, decl, Context);
@@ -35,8 +35,7 @@ void swift::printSILLocationDescription(llvm::raw_ostream &out,
printExprDescription(out, expr, Context); printExprDescription(out, expr, Context);
} else if (auto stmt = loc.getAsASTNode<Stmt>()) { } else if (auto stmt = loc.getAsASTNode<Stmt>()) {
printStmtDescription(out, stmt, Context); printStmtDescription(out, stmt, Context);
} else { } else if (auto pattern = loc.castToASTNode<Pattern>()) {
auto pattern = loc.castToASTNode<Pattern>();
printPatternDescription(out, pattern, Context); printPatternDescription(out, pattern, Context);
} }
} }

View File

@@ -22,10 +22,10 @@ using namespace swift;
SourceLoc SILLocation::getSourceLoc() const { SourceLoc SILLocation::getSourceLoc() const {
if (hasSILFileSourceLoc()) if (isSILFile())
return getSILFileSourceLoc(); return Loc.SILFileLoc;
return getSourceLoc(ASTNode); return getSourceLoc(Loc.ASTNode.Primary);
} }
SourceLoc SILLocation::getSourceLoc(ASTNodeTy N) const { SourceLoc SILLocation::getSourceLoc(ASTNodeTy N) const {
@@ -34,12 +34,12 @@ SourceLoc SILLocation::getSourceLoc(ASTNodeTy N) const {
if (alwaysPointsToStart() || if (alwaysPointsToStart() ||
alwaysPointsToEnd() || alwaysPointsToEnd() ||
getKind() == CleanupKind || is<CleanupLocation>() ||
getKind() == ImplicitReturnKind) is<ImplicitReturnLocation>())
return getEndSourceLoc(N); return getEndSourceLoc(N);
// Use the start location for the ReturnKind. // Use the start location for the ReturnKind.
if (getKind() == ReturnKind) if (is<ReturnLocation>())
return getStartSourceLoc(N); return getStartSourceLoc(N);
if (auto *decl = N.dyn_cast<Decl*>()) if (auto *decl = N.dyn_cast<Decl*>())
@@ -54,13 +54,13 @@ SourceLoc SILLocation::getSourceLoc(ASTNodeTy N) const {
} }
SourceLoc SILLocation::getDebugSourceLoc() const { SourceLoc SILLocation::getDebugSourceLoc() const {
if (hasSILFileSourceLoc()) if (isSILFile())
return getSILFileSourceLoc(); return Loc.SILFileLoc;
if (isAutoGenerated()) if (isAutoGenerated())
return SourceLoc(); return SourceLoc();
if (auto *expr = ASTNode.dyn_cast<Expr*>()) { if (auto *expr = Loc.ASTNode.Primary.dyn_cast<Expr*>()) {
if (isa<CallExpr>(expr)) if (isa<CallExpr>(expr))
return expr->getEndLoc(); return expr->getEndLoc();
// Code that has an autoclosure as location should not show up in // Code that has an autoclosure as location should not show up in
@@ -73,19 +73,18 @@ SourceLoc SILLocation::getDebugSourceLoc() const {
return SourceLoc(); return SourceLoc();
} }
if (!hasDebugLoc()) if (Loc.ASTNode.ForDebugger)
return getSourceLoc(ASTNode); return getSourceLoc(Loc.ASTNode.ForDebugger);
assert(!SpecificLoc.DebugLoc.isNull() && "empty debug location"); return getSourceLoc(Loc.ASTNode.Primary);
return getSourceLoc(SpecificLoc.DebugLoc);
} }
SourceLoc SILLocation::getStartSourceLoc() const { SourceLoc SILLocation::getStartSourceLoc() const {
if (isAutoGenerated()) if (isAutoGenerated())
return SourceLoc(); return SourceLoc();
if (ASTNode.isNull()) if (isSILFile())
return getSILFileSourceLoc(); return Loc.SILFileLoc;
return getStartSourceLoc(ASTNode); return getStartSourceLoc(Loc.ASTNode.Primary);
} }
SourceLoc SILLocation::getStartSourceLoc(ASTNodeTy N) const { SourceLoc SILLocation::getStartSourceLoc(ASTNodeTy N) const {
@@ -103,9 +102,9 @@ SourceLoc SILLocation::getStartSourceLoc(ASTNodeTy N) const {
SourceLoc SILLocation::getEndSourceLoc() const { SourceLoc SILLocation::getEndSourceLoc() const {
if (isAutoGenerated()) if (isAutoGenerated())
return SourceLoc(); return SourceLoc();
if (ASTNode.isNull()) if (isSILFile())
return getSILFileSourceLoc(); return Loc.SILFileLoc;
return getEndSourceLoc(ASTNode); return getEndSourceLoc(Loc.ASTNode.Primary);
} }
SourceLoc SILLocation::getEndSourceLoc(ASTNodeTy N) const { SourceLoc SILLocation::getEndSourceLoc(ASTNodeTy N) const {
@@ -131,13 +130,13 @@ SILLocation::DebugLoc SILLocation::decode(SourceLoc Loc,
} }
void SILLocation::dump(const SourceManager &SM) const { void SILLocation::dump(const SourceManager &SM) const {
if (auto D = ASTNode.dyn_cast<Decl *>()) if (auto D = getAsASTNode<Decl>())
llvm::errs() << Decl::getKindName(D->getKind()) << "Decl @ "; llvm::errs() << Decl::getKindName(D->getKind()) << "Decl @ ";
if (auto E = ASTNode.dyn_cast<Expr *>()) if (auto E = getAsASTNode<Expr>())
llvm::errs() << Expr::getKindName(E->getKind()) << "Expr @ "; llvm::errs() << Expr::getKindName(E->getKind()) << "Expr @ ";
if (auto S = ASTNode.dyn_cast<Stmt *>()) if (auto S = getAsASTNode<Stmt>())
llvm::errs() << Stmt::getKindName(S->getKind()) << "Stmt @ "; llvm::errs() << Stmt::getKindName(S->getKind()) << "Stmt @ ";
if (auto P = ASTNode.dyn_cast<Pattern *>()) if (auto P = getAsASTNode<Pattern>())
llvm::errs() << Pattern::getKindName(P->getKind()) << "Pattern @ "; llvm::errs() << Pattern::getKindName(P->getKind()) << "Pattern @ ";
print(llvm::errs(), SM); print(llvm::errs(), SM);
@@ -147,7 +146,7 @@ void SILLocation::dump(const SourceManager &SM) const {
if (alwaysPointsToEnd()) llvm::errs() << ":end"; if (alwaysPointsToEnd()) llvm::errs() << ":end";
if (isInTopLevel()) llvm::errs() << ":toplevel"; if (isInTopLevel()) llvm::errs() << ":toplevel";
if (isInPrologue()) llvm::errs() << ":prologue"; if (isInPrologue()) llvm::errs() << ":prologue";
if (hasSILFileSourceLoc()) llvm::errs() << ":sil"; if (isSILFile()) llvm::errs() << ":sil";
if (hasDebugLoc()) { if (hasDebugLoc()) {
llvm::errs() << ":debug["; llvm::errs() << ":debug[";
getDebugSourceLoc().print(llvm::errs(), SM); getDebugSourceLoc().print(llvm::errs(), SM);
@@ -171,8 +170,8 @@ InlinedLocation InlinedLocation::getInlinedLocation(SILLocation L) {
if (Decl *D = L.getAsASTNode<Decl>()) if (Decl *D = L.getAsASTNode<Decl>())
return InlinedLocation(D, L.getSpecialFlags()); return InlinedLocation(D, L.getSpecialFlags());
if (L.hasSILFileSourceLoc()) if (L.isSILFile())
return InlinedLocation(L.getSILFileSourceLoc(), L.getSpecialFlags()); return InlinedLocation(L.Loc.SILFileLoc, L.getSpecialFlags());
if (L.isInTopLevel()) if (L.isInTopLevel())
return InlinedLocation::getModuleLocation(L.getSpecialFlags()); return InlinedLocation::getModuleLocation(L.getSpecialFlags());
@@ -196,9 +195,8 @@ MandatoryInlinedLocation::getMandatoryInlinedLocation(SILLocation L) {
if (Decl *D = L.getAsASTNode<Decl>()) if (Decl *D = L.getAsASTNode<Decl>())
return MandatoryInlinedLocation(D, L.getSpecialFlags()); return MandatoryInlinedLocation(D, L.getSpecialFlags());
if (L.hasSILFileSourceLoc()) if (L.isSILFile())
return MandatoryInlinedLocation(L.getSILFileSourceLoc(), return MandatoryInlinedLocation(L.Loc.SILFileLoc, L.getSpecialFlags());
L.getSpecialFlags());
if (L.isInTopLevel()) if (L.isInTopLevel())
return MandatoryInlinedLocation::getModuleLocation(L.getSpecialFlags()); return MandatoryInlinedLocation::getModuleLocation(L.getSpecialFlags());
@@ -217,7 +215,7 @@ CleanupLocation CleanupLocation::get(SILLocation L) {
return CleanupLocation(D, L.getSpecialFlags()); return CleanupLocation(D, L.getSpecialFlags());
if (L.isNull()) if (L.isNull())
return CleanupLocation(); return CleanupLocation();
if (L.getAs<SILFileLocation>()) if (L.isSILFile())
return CleanupLocation(); return CleanupLocation();
llvm_unreachable("Cannot construct Cleanup loc from the " llvm_unreachable("Cannot construct Cleanup loc from the "
"given location."); "given location.");

View File

@@ -597,10 +597,9 @@ public:
case SILLocation::ArtificialUnreachableKind: case SILLocation::ArtificialUnreachableKind:
*this << ":art_unreach"; *this << ":art_unreach";
break; break;
case SILLocation::SILFileKind:
*this << ":sil";
break;
} }
if (L.isSILFile())
*this << ":sil";
if (L.isAutoGenerated()) if (L.isAutoGenerated())
*this << ":auto_gen"; *this << ":auto_gen";
if (L.isInPrologue()) if (L.isInPrologue())

View File

@@ -531,9 +531,8 @@ public:
SILLocation::LocationKind LocKind = L.getKind(); SILLocation::LocationKind LocKind = L.getKind();
ValueKind InstKind = I->getKind(); ValueKind InstKind = I->getKind();
// Regular locations and SIL file locations are allowed on all instructions. // Regular locations are allowed on all instructions.
if (LocKind == SILLocation::RegularKind || if (LocKind == SILLocation::RegularKind)
LocKind == SILLocation::SILFileKind)
return; return;
#if 0 #if 0

View File

@@ -51,7 +51,7 @@ llvm::cl::opt<bool> EnableLoopARC("enable-loop-arc", llvm::cl::init(true));
static SILInstruction *createIncrement(SILValue Ptr, SILInstruction *InsertPt) { static SILInstruction *createIncrement(SILValue Ptr, SILInstruction *InsertPt) {
// Set up the builder we use to insert at our insertion point. // Set up the builder we use to insert at our insertion point.
SILBuilder B(InsertPt); SILBuilder B(InsertPt);
auto Loc = SILFileLocation(SourceLoc()); auto Loc = RegularLocation(SourceLoc());
// If Ptr is refcounted itself, create the strong_retain and // If Ptr is refcounted itself, create the strong_retain and
// return. // return.
@@ -68,7 +68,7 @@ static SILInstruction *createIncrement(SILValue Ptr, SILInstruction *InsertPt) {
static SILInstruction *createDecrement(SILValue Ptr, SILInstruction *InsertPt) { static SILInstruction *createDecrement(SILValue Ptr, SILInstruction *InsertPt) {
// Setup the builder we will use to insert at our insertion point. // Setup the builder we will use to insert at our insertion point.
SILBuilder B(InsertPt); SILBuilder B(InsertPt);
auto Loc = SILFileLocation(SourceLoc()); auto Loc = RegularLocation(SourceLoc());
// If Ptr has reference semantics itself, create a strong_release. // If Ptr has reference semantics itself, create a strong_release.
if (Ptr->getType().isReferenceCounted(B.getModule())) if (Ptr->getType().isReferenceCounted(B.getModule()))

View File

@@ -1031,7 +1031,7 @@ static SILInstruction *isSuperInitUse(UpcastInst *Inst) {
// If we're reading a .sil file, treat a call to "superinit" as a // If we're reading a .sil file, treat a call to "superinit" as a
// super.init call as a hack to allow us to write testcases. // super.init call as a hack to allow us to write testcases.
auto *AI = dyn_cast<ApplyInst>(inst); auto *AI = dyn_cast<ApplyInst>(inst);
if (AI && inst->getLoc().is<SILFileLocation>()) if (AI && inst->getLoc().isSILFile())
if (auto *Fn = AI->getCalleeFunction()) if (auto *Fn = AI->getCalleeFunction())
if (Fn->getName() == "superinit") if (Fn->getName() == "superinit")
return inst; return inst;
@@ -1070,7 +1070,7 @@ static SILInstruction *isSuperInitUse(UpcastInst *Inst) {
static bool isSelfInitUse(SILInstruction *I) { static bool isSelfInitUse(SILInstruction *I) {
// If we're reading a .sil file, treat a call to "selfinit" as a // If we're reading a .sil file, treat a call to "selfinit" as a
// self.init call as a hack to allow us to write testcases. // self.init call as a hack to allow us to write testcases.
if (I->getLoc().is<SILFileLocation>()) { if (I->getLoc().isSILFile()) {
if (auto *AI = dyn_cast<ApplyInst>(I)) if (auto *AI = dyn_cast<ApplyInst>(I))
if (auto *Fn = AI->getCalleeFunction()) if (auto *Fn = AI->getCalleeFunction())
if (Fn->getName().startswith("selfinit")) if (Fn->getName().startswith("selfinit"))

View File

@@ -75,7 +75,7 @@ static void diagnoseUnreachable(const SILInstruction *I,
// transparently inlined. We should have already emitted these // transparently inlined. We should have already emitted these
// diagnostics when we process the callee function prior to // diagnostics when we process the callee function prior to
// inlining it. // inlining it.
if (!L.hasASTLocation() || L.is<MandatoryInlinedLocation>()) if (!L || L.is<MandatoryInlinedLocation>())
return; return;
// The most common case of getting an unreachable instruction is a // The most common case of getting an unreachable instruction is a

View File

@@ -183,7 +183,7 @@ static void analyzeUseOfInOut(Operand *UI, StackSlotState &state) {
// We only look at autogenerated copy_addr's. We don't want to muck with // We only look at autogenerated copy_addr's. We don't want to muck with
// user variables, as in: // user variables, as in:
// func f(inout a : Int) { var b = a } // func f(inout a : Int) { var b = a }
if (!CAI->getLoc().isAutoGenerated() && !CAI->getLoc().is<SILFileLocation>()) if (!CAI->getLoc().isAutoGenerated() && !CAI->getLoc().isSILFile())
return; return;
// Get a stack slot, looking through mark_uninitialized if necessary. // Get a stack slot, looking through mark_uninitialized if necessary.

View File

@@ -34,8 +34,8 @@ static SILBasicBlock *createInitialPreheader(SILBasicBlock *Header) {
} }
// Create the branch to the header. // Create the branch to the header.
SILBuilder(Preheader) SILBuilder(Preheader).createBranch(RegularLocation(SourceLoc()), Header,
.createBranch(SILFileLocation(SourceLoc()), Header, Args); Args);
return Preheader; return Preheader;
} }

View File

@@ -282,7 +282,7 @@ static SILFunction *createBogusSILFunction(SILModule &M,
SourceLoc loc; SourceLoc loc;
return M.getOrCreateFunction( return M.getOrCreateFunction(
SILLinkage::Private, name, type.castTo<SILFunctionType>(), nullptr, SILLinkage::Private, name, type.castTo<SILFunctionType>(), nullptr,
SILFileLocation(loc), IsNotBare, IsNotTransparent, IsNotFragile, RegularLocation(loc), IsNotBare, IsNotTransparent, IsNotFragile,
IsNotThunk, SILFunction::NotRelevant); IsNotThunk, SILFunction::NotRelevant);
} }
@@ -402,7 +402,7 @@ SILFunction *SILDeserializer::readSILFunction(DeclID FID,
auto fn = existingFn; auto fn = existingFn;
// TODO: use the correct SILLocation from module. // TODO: use the correct SILLocation from module.
SILLocation loc = SILFileLocation(SourceLoc()); SILLocation loc = RegularLocation(SourceLoc());
// If we have an existing function, verify that the types match up. // If we have an existing function, verify that the types match up.
if (fn) { if (fn) {
@@ -624,7 +624,7 @@ bool SILDeserializer::readSILInstruction(SILFunction *Fn, SILBasicBlock *BB,
ModuleID OwningModuleID; ModuleID OwningModuleID;
SourceLoc SLoc; SourceLoc SLoc;
ArrayRef<uint64_t> ListOfValues; ArrayRef<uint64_t> ListOfValues;
SILLocation Loc = SILFileLocation(SLoc); SILLocation Loc = RegularLocation(SLoc);
switch (RecordKind) { switch (RecordKind) {
default: default: