clang 10.0.0git

FixIt.cpp
Go to the documentation of this file.
1 //===--- FixIt.cpp - FixIt Hint utilities -----------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains implementations of utitilies to ease source code rewriting
10 // by providing helper functions related to FixItHint.
11 //
12 //===----------------------------------------------------------------------===//
13 #include "clang/Tooling/FixIt.h"
14 #include "clang/Lex/Lexer.h"
15
16 namespace clang {
17 namespace tooling {
18 namespace fixit {
19
20 namespace internal {
21 StringRef getText(CharSourceRange Range, const ASTContext &Context) {
22 return Lexer::getSourceText(Range, Context.getSourceManager(),
23 Context.getLangOpts());
24 }
25 } // namespace internal
26
27 } // end namespace fixit
28 } // end namespace tooling
29 } // end namespace clang
clang::tooling::fixit::internal::getText
StringRef getText(CharSourceRange Range, const ASTContext &Context)
Returns the source-code text in the specified range.
Definition: FixIt.cpp:21
FixIt.h
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:168
clang::tooling::Range
A source range independent of the SourceManager.
Definition: Replacement.h:44
clang::Lexer::getSourceText
static StringRef getSourceText(CharSourceRange Range, const SourceManager &SM, const LangOptions &LangOpts, bool *Invalid=nullptr)
Returns a string for the source that the range encompasses.
Definition: Lexer.cpp:939
clang::CharSourceRange
Represents a character-granular source range.
Definition: SourceLocation.h:250
Lexer.h
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
clang::ASTContext::getSourceManager
SourceManager & getSourceManager()
Definition: ASTContext.h:679
clang::ASTContext::getLangOpts
const LangOptions & getLangOpts() const
Definition: ASTContext.h:724