[Tooling] add a createReplacement overload for StringRef
authorAlexander Kornienko <alexfh@google.com>
Thu, 4 May 2017 15:34:06 +0000 (15:34 +0000)
committerAlexander Kornienko <alexfh@google.com>
Thu, 4 May 2017 15:34:06 +0000 (15:34 +0000)
llvm-svn: 302159

clang/include/clang/Tooling/FixIt.h

index e2259d4..c1e5088 100644 (file)
@@ -65,6 +65,13 @@ FixItHint createReplacement(const D &Destination, const S &Source,
                                       getText(Source, Context));
 }
 
+// \brief Returns a FixItHint to replace \p Destination by \p Source.
+template <typename D>
+FixItHint createReplacement(const D &Destination, StringRef Source) {
+  return FixItHint::CreateReplacement(internal::getSourceRange(Destination),
+                                      Source);
+}
+
 } // end namespace fixit
 } // end namespace tooling
 } // end namespace clang