clang
20.0.0git
lib
Tooling
Transformer
SourceCode.cpp
Go to the documentation of this file.
1
//===--- SourceCode.cpp - Source code manipulation routines -----*- 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 provides functions that simplify extraction of source code.
10
//
11
//===----------------------------------------------------------------------===//
12
#include "
clang/Tooling/Transformer/SourceCode.h
"
13
#include "
clang/AST/ASTContext.h
"
14
#include "
clang/AST/Attr.h
"
15
#include "
clang/AST/Comment.h
"
16
#include "
clang/AST/Decl.h
"
17
#include "
clang/AST/DeclCXX.h
"
18
#include "
clang/AST/DeclTemplate.h
"
19
#include "
clang/AST/Expr.h
"
20
#include "
clang/Basic/SourceManager.h
"
21
#include "
clang/Lex/Lexer.h
"
22
#include "llvm/Support/Errc.h"
23
#include "llvm/Support/Error.h"
24
#include <set>
25
26
using namespace
clang
;
27
28
using
llvm::errc;
29
using
llvm::StringError;
30
31
StringRef
clang::tooling::getText
(
CharSourceRange
Range
,
32
const
ASTContext
&Context) {
33
return
Lexer::getSourceText
(
Range
, Context.
getSourceManager
(),
34
Context.