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 {
3838 // / to speed up stats.
3939 mutable llvm::DenseMap<StringRef, llvm::vfs::Status> StatusCache;
4040
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+
4155 // \c #sourceLocation directive handling.
4256 struct VirtualFile {
4357 CharSourceRange Range;
@@ -89,6 +103,9 @@ class SourceManager {
89103
90104 SourceLoc getCodeCompletionLoc () const ;
91105
106+ const ReplacedRangeType &getReplacedRange () const { return ReplacedRange; }
107+ void setReplacedRange (const ReplacedRangeType &val) { ReplacedRange = val; }
108+
92109 // / Returns true if \c LHS is before \c RHS in the source buffer.
93110 bool isBeforeInBuffer (SourceLoc LHS, SourceLoc RHS) const {
94111 return LHS.Value .getPointer () < RHS.Value .getPointer ();
Original file line number Diff line number Diff line change @@ -417,6 +417,7 @@ bool CompletionInstance::performCachedOperationIfPossible(
417417
418418 auto *AFD = cast<AbstractFunctionDecl>(DC);
419419 AFD->setBodyToBeReparsed (newBodyRange);
420+ SM.setReplacedRange ({AFD->getOriginalBodySourceRange (), newBodyRange});
420421
421422 traceDC = AFD;
422423 break ;
You can’t perform that action at this time.
0 commit comments