Skip to content

Commit 72d1ebb

Browse files
author
Gabor Horvath
committed
[cxx-interop] Use the locations imported from C++
A recent PR (#77204) started to import C++ source locations into Swift. This PR flips a switch so these locations are actually used more widely.
1 parent 09c89fb commit 72d1ebb

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/AST/Decl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,7 @@ static_assert(sizeof(checkSourceLocType(&ID##Decl::getLoc)) == 2, \
10111011
return getLocFromSource();
10121012
switch(File->getKind()) {
10131013
case FileUnitKind::Source:
1014+
case FileUnitKind::ClangModule:
10141015
return getLocFromSource();
10151016
case FileUnitKind::SerializedAST: {
10161017
if (!SerializedOK)
@@ -1019,7 +1020,6 @@ static_assert(sizeof(checkSourceLocType(&ID##Decl::getLoc)) == 2, \
10191020
}
10201021
case FileUnitKind::Builtin:
10211022
case FileUnitKind::Synthesized:
1022-
case FileUnitKind::ClangModule:
10231023
case FileUnitKind::DWARFModule:
10241024
return SourceLoc();
10251025
}

test/Interop/Cxx/class/nonescapable-errors.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public func noAnnotations() -> View {
4848
// CHECK-NOT: nonescapable.h:19
4949
f2(nil, nil)
5050
// CHECK: nonescapable.h:23:6: warning: the returned type 'View' is annotated as non-escapable; its lifetime dependencies must be annotated
51+
// CHECKL nonescapable.h:23:6: error: cannot infer lifetime dependence, no parameters found that are either ~Escapable or Escapable with a borrowing ownership
5152
g(nil)
5253
return View()
5354
}

0 commit comments

Comments
 (0)