Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions include/swift/AST/DeclNameLoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ class DeclNameLoc {
/// Retrieve a pointer to either the only source location that was
/// stored or to the array of source locations that was stored.
SourceLoc const * getSourceLocs() const {
if (NumArgumentLabels == 0 && !HasModuleSelectorLoc)
if (NumArgumentLabels == 0 && !HasModuleSelectorLoc) {
if (LocationInfo == nullptr)
return nullptr;
return reinterpret_cast<SourceLoc const *>(&LocationInfo);
}

return reinterpret_cast<SourceLoc const *>(LocationInfo);
}
Expand Down Expand Up @@ -110,7 +113,10 @@ class DeclNameLoc {

/// Retrieve the location of the base name.
SourceLoc getBaseNameLoc() const {
return getSourceLocs()[BaseNameIndex];
const SourceLoc *SourceLocs = getSourceLocs();
if (SourceLocs == nullptr)
return SourceLoc();
return SourceLocs[BaseNameIndex];
}

/// Retrieve the location of the left parentheses.
Expand Down