summaryrefslogtreecommitdiffstats
path: root/include/clang/Tooling/FixIt.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Tooling/FixIt.h')
-rw-r--r--include/clang/Tooling/FixIt.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/include/clang/Tooling/FixIt.h b/include/clang/Tooling/FixIt.h
index b36f378d63..5fce71f2d8 100644
--- a/include/clang/Tooling/FixIt.h
+++ b/include/clang/Tooling/FixIt.h
@@ -1,9 +1,8 @@
//===--- FixIt.h - FixIt Hint utilities -------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -27,25 +26,26 @@ namespace tooling {
namespace fixit {
namespace internal {
-StringRef getText(SourceRange Range, const ASTContext &Context);
+StringRef getText(CharSourceRange Range, const ASTContext &Context);
-/// Returns the SourceRange of a SourceRange. This identity function is
-/// used by the following template abstractions.
-inline SourceRange getSourceRange(const SourceRange &Range) { return Range; }
+/// Returns the token CharSourceRange corresponding to \p Range.
+inline CharSourceRange getSourceRange(const SourceRange &Range) {
+ return CharSourceRange::getTokenRange(Range);
+}
-/// Returns the SourceRange of the token at Location \p Loc.
-inline SourceRange getSourceRange(const SourceLocation &Loc) {
- return SourceRange(Loc);
+/// Returns the CharSourceRange of the token at Location \p Loc.
+inline CharSourceRange getSourceRange(const SourceLocation &Loc) {
+ return CharSourceRange::getTokenRange(Loc, Loc);
}
-/// Returns the SourceRange of an given Node. \p Node is typically a
+/// Returns the CharSourceRange of an given Node. \p Node is typically a
/// 'Stmt', 'Expr' or a 'Decl'.
-template <typename T> SourceRange getSourceRange(const T &Node) {
- return Node.getSourceRange();
+template <typename T> CharSourceRange getSourceRange(const T &Node) {
+ return CharSourceRange::getTokenRange(Node.getSourceRange());
}
} // end namespace internal
-// Returns a textual representation of \p Node.
+/// Returns a textual representation of \p Node.
template <typename T>
StringRef getText(const T &Node, const ASTContext &Context) {
return internal::getText(internal::getSourceRange(Node), Context);