
Summary: Introduces a utility library in Refactoring/ to collect routines related to source-code manipulation. In this change, we move "extended-range" functions from the FixIt library (in clangTooling) to this new library. We need to use this functionality in Refactoring/ and cannot access it if it resides in Tooling/, because that would cause clangToolingRefactor to depend on clangTooling, which would be a circular dependency. Reviewers: ilya-biryukov, ioeric Reviewed By: ilya-biryukov Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60269 llvm-svn: 357764
30 lines
1.0 KiB
C++
30 lines
1.0 KiB
C++
//===--- FixIt.cpp - FixIt Hint utilities -----------------------*- C++ -*-===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file contains implementations of utitilies to ease source code rewriting
|
|
// by providing helper functions related to FixItHint.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
#include "clang/Tooling/FixIt.h"
|
|
#include "clang/Lex/Lexer.h"
|
|
|
|
namespace clang {
|
|
namespace tooling {
|
|
namespace fixit {
|
|
|
|
namespace internal {
|
|
StringRef getText(CharSourceRange Range, const ASTContext &Context) {
|
|
return Lexer::getSourceText(Range, Context.getSourceManager(),
|
|
Context.getLangOpts());
|
|
}
|
|
} // namespace internal
|
|
|
|
} // end namespace fixit
|
|
} // end namespace tooling
|
|
} // end namespace clang
|