File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,20 @@ class SourceManager {
38
38
// / to speed up stats.
39
39
mutable llvm::DenseMap<StringRef, llvm::vfs::Status> StatusCache;
40
40
41
+ struct ReplacedRangeType {
42
+ SourceRange Original;
43
+ SourceRange New;
44
+ ReplacedRangeType () {}
45
+ ReplacedRangeType (NoneType) {}
46
+ ReplacedRangeType (SourceRange Original, SourceRange New)
47
+ : Original(Original), New(New) {
48
+ assert (Original.isValid () && New.isValid ());
49
+ }
50
+
51
+ explicit operator bool () const { return Original.isValid (); }
52
+ };
53
+ ReplacedRangeType ReplacedRange;
54
+
41
55
// \c #sourceLocation directive handling.
42
56
struct VirtualFile {
43
57
CharSourceRange Range;
@@ -89,6 +103,9 @@ class SourceManager {
89
103
90
104
SourceLoc getCodeCompletionLoc () const ;
91
105
106
+ const ReplacedRangeType &getReplacedRange () const { return ReplacedRange; }
107
+ void setReplacedRange (const ReplacedRangeType &val) { ReplacedRange = val; }
108
+
92
109
// / Returns true if \c LHS is before \c RHS in the source buffer.
93
110
bool isBeforeInBuffer (SourceLoc LHS, SourceLoc RHS) const {
94
111
return LHS.Value .getPointer () < RHS.Value .getPointer ();
Original file line number Diff line number Diff line change @@ -417,6 +417,7 @@ bool CompletionInstance::performCachedOperationIfPossible(
417
417
418
418
auto *AFD = cast<AbstractFunctionDecl>(DC);
419
419
AFD->setBodyToBeReparsed (newBodyRange);
420
+ SM.setReplacedRange ({AFD->getOriginalBodySourceRange (), newBodyRange});
420
421
421
422
traceDC = AFD;
422
423
break ;
You can’t perform that action at this time.
0 commit comments