File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -154,7 +154,14 @@ RawComment Decl::getRawComment(bool SerializedOK) const {
154
154
if (!CachedLocs->DocRanges .empty ()) {
155
155
SmallVector<SingleRawComment, 4 > SRCs;
156
156
for (const auto &Range : CachedLocs->DocRanges ) {
157
- SRCs.push_back ({ Range, Context.SourceMgr });
157
+ if (Range.isValid ()) {
158
+ SRCs.push_back ({ Range, Context.SourceMgr });
159
+ } else {
160
+ // if we've run into an invalid range, don't bother trying to load any of
161
+ // the other comments
162
+ SRCs.clear ();
163
+ break ;
164
+ }
158
165
}
159
166
auto RC = RawComment (Context.AllocateCopy (llvm::makeArrayRef (SRCs)));
160
167
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %empty-directory(%t/Source)
3
+ // RUN: %empty-directory(%t/NoSourceInfo.framework/Modules/NoSourceInfo.swiftmodule)
4
+ // RUN: %empty-directory(%t/NoSourceInfo.framework/Modules/NoSourceInfo.swiftmodule/Project)
5
+
6
+ // RUN: cp %s %t/Source/Input.swift
7
+
8
+ // RUN: %target-swift-frontend -module-name NoSourceInfo -emit-module -emit-module-path %t/NoSourceInfo.framework/Modules/NoSourceInfo.swiftmodule/%target-swiftmodule-name -emit-module-doc-path %t/NoSourceInfo.framework/Modules/NoSourceInfo.swiftmodule/%target-swiftdoc-name -emit-module-interface-path %t/NoSourceInfo.framework/Modules/NoSourceInfo.swiftmodule/%target-swiftinterface-name -emit-module-source-info-path %t/NoSourceInfo.framework/Modules/NoSourceInfo.swiftmodule/Project/%target-swiftsourceinfo-name %t/Source/Input.swift
9
+
10
+ // RUN: mv %t/Source %t/MovedSource
11
+
12
+ // RUN: %target-swift-symbolgraph-extract -module-name NoSourceInfo -F %t -pretty-print -output-dir %t
13
+ // RUN: %FileCheck %s --input-file %t/NoSourceInfo.symbols.json
14
+
15
+ // CHECK: s:12NoSourceInfo1SV
16
+ // CHECK: docComment
17
+ // CHECK: This is a test
18
+
19
+ /// This is a test
20
+ public struct S {
21
+ /// This is also a test
22
+ public var x : Int
23
+ }
24
+
25
+ /// writing some docs here
26
+ open class C < Data> {
27
+ /// writing more docs over there
28
+ public init ( ) { }
29
+ }
30
+
31
+ open class CO : C < String > {
32
+ override public init ( ) { super. init ( ) }
33
+ }
You can’t perform that action at this time.
0 commit comments