clang 8.0.0

FixIt.cpp
Go to the documentation of this file.
1 //===--- FixIt.cpp - FixIt Hint utilities -----------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains implementations of utitilies to ease source code rewriting
11 // by providing helper functions related to FixItHint.
12 //
13 //===----------------------------------------------------------------------===//
14 #include "clang/Tooling/FixIt.h"
15 #include "clang/Lex/Lexer.h"
16
17 namespace clang {
18 namespace tooling {
19 namespace fixit {
20
21 namespace internal {
22 StringRef getText(SourceRange Range, const ASTContext &Context) {
23 return Lexer::getSourceText(CharSourceRange::getTokenRange(Range),
24 Context.getSourceManager(),
25 Context.getLangOpts());
26 }
27 } // end namespace internal
28
29 } // end namespace fixit
30 } // end namespace tooling
31 } // end namespace clang
clang::CharSourceRange::getTokenRange
static CharSourceRange getTokenRange(SourceRange R)
Definition: SourceLocation.h:244
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:155
clang::tooling::fixit::internal::getText
StringRef getText(SourceRange Range, const ASTContext &Context)
Definition: FixIt.cpp:22
clang::tooling::Range
A source range independent of the SourceManager.
Definition: Replacement.h:45
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:932
Lexer.h
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:22
clang::ASTContext::getSourceManager
SourceManager & getSourceManager()
Definition: ASTContext.h:662
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:198
clang::ASTContext::getLangOpts
const LangOptions & getLangOpts() const
Definition: ASTContext.h:707