19#include "clang/AST/ASTTypeTraits.h"
20#include "clang/AST/Attr.h"
21#include "clang/AST/Decl.h"
22#include "clang/AST/DeclBase.h"
23#include "clang/AST/DeclCXX.h"
24#include "clang/AST/DeclTemplate.h"
25#include "clang/AST/Stmt.h"
26#include "clang/Basic/SourceLocation.h"
27#include "clang/Basic/SourceManager.h"
28#include "clang/Basic/TokenKinds.h"
29#include "clang/Tooling/Core/Replacement.h"
30#include "clang/Tooling/Syntax/Tokens.h"
31#include "llvm/ADT/STLExtras.h"
32#include "llvm/ADT/StringRef.h"
33#include "llvm/Support/Casting.h"
34#include "llvm/Support/Error.h"
52 const DynTypedNode &AstNode = SelNode->
ASTNode;
53 if (
const FunctionDecl *FD = AstNode.get<FunctionDecl>())
55 if (AstNode.get<CompoundStmt>() &&
58 return P->ASTNode.get<FunctionDecl>();
63std::optional<Path> getSourceFile(llvm::StringRef FileName,
74std::optional<const DeclContext *>
75findContextForNS(llvm::StringRef TargetNS,
const DeclContext *CurContext) {
76 assert(TargetNS.empty() || TargetNS.ends_with(
"::"));
78 CurContext = CurContext->getEnclosingNamespaceContext();
80 if (TargetNS.empty()) {
81 while (!CurContext->isTranslationUnit())
82 CurContext = CurContext->getParent();
87 std::string TargetContextNS =
88 CurContext->isNamespace()
89 ? llvm::cast<NamespaceDecl>(CurContext)->getQualifiedNameAsString()
91 TargetContextNS.append(
"::");
93 llvm::StringRef CurrentContextNS(TargetContextNS);
96 if (!CurrentContextNS.starts_with(TargetNS))
99 while (CurrentContextNS != TargetNS) {
100 CurContext = CurContext->getParent();
103 CurrentContextNS = CurrentContextNS.take_front(
104 CurrentContextNS.drop_back(2).rfind(
"::") + 2);
112llvm::Expected<std::string>
113getFunctionSourceAfterReplacements(
const FunctionDecl *FD,
114 const tooling::Replacements &Replacements,
115 bool TargetFileIsHeader) {
116 const auto &SM = FD->getASTContext().getSourceManager();
118 SM, FD->getASTContext().getLangOpts(), FD->getSourceRange());
120 return error(
"Couldn't get range for function.");
123 unsigned FuncBegin = SM.getFileOffset(OrigFuncRange->getBegin());
124 unsigned FuncEnd = Replacements.getShiftedCodePosition(
125 SM.getFileOffset(OrigFuncRange->getEnd()));
128 auto QualifiedFunc = tooling::applyAllReplacements(
129 SM.getBufferData(SM.getMainFileID()), Replacements);
131 return QualifiedFunc.takeError();
133 auto Source = QualifiedFunc->substr(FuncBegin, FuncEnd - FuncBegin + 1);
134 std::string TemplatePrefix;
135 auto AddToTemplatePrefixIfApplicable = [&](
const Decl *
D) {
136 const TemplateParameterList *Params =
D->getDescribedTemplateParams();
139 for (Decl *P : *Params) {
140 if (
auto *TTP = dyn_cast<TemplateTypeParmDecl>(P))
141 TTP->removeDefaultArgument();
142 else if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(P))
143 NTTP->removeDefaultArgument();
144 else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(P))
145 TTPD->removeDefaultArgument();
148 llvm::raw_string_ostream Stream(S);
149 Params->print(Stream, FD->getASTContext());
152 TemplatePrefix.insert(0, S);
154 AddToTemplatePrefixIfApplicable(FD);
155 if (
auto *MD = llvm::dyn_cast<CXXMethodDecl>(FD)) {
156 for (
const CXXRecordDecl *Parent = MD->getParent(); Parent;
158 llvm::dyn_cast_or_null<const CXXRecordDecl>(Parent->getParent())) {
159 AddToTemplatePrefixIfApplicable(Parent);
163 if (TargetFileIsHeader)
164 Source.insert(0,
"inline ");
165 if (!TemplatePrefix.empty())
166 Source.insert(0, TemplatePrefix);
173llvm::Expected<tooling::Replacements>
174deleteTokensWithKind(
const syntax::TokenBuffer &TokBuf, tok::TokenKind Kind,
175 SourceRange FromRange) {
176 tooling::Replacements DelKeywordCleanups;
177 llvm::Error Errors = llvm::Error::success();
178 bool FoundAny =
false;
179 for (
const auto &Tok : TokBuf.expandedTokens(FromRange)) {
180 if (Tok.kind() != Kind)
183 auto Spelling = TokBuf.spelledForExpanded(llvm::ArrayRef(Tok));
185 Errors = llvm::joinErrors(
187 error(
"define outline: couldn't remove `{0}` keyword.",
188 tok::getKeywordSpelling(Kind)));
191 auto &SM = TokBuf.sourceManager();
192 CharSourceRange DelRange =
193 syntax::Token::range(SM, Spelling->front(), Spelling->back())
196 DelKeywordCleanups.add(tooling::Replacement(SM, DelRange,
"")))
197 Errors = llvm::joinErrors(std::move(Errors), std::move(Err));
200 Errors = llvm::joinErrors(
202 error(
"define outline: couldn't find `{0}` keyword to remove.",
203 tok::getKeywordSpelling(Kind)));
207 return std::move(Errors);
208 return DelKeywordCleanups;
217llvm::Expected<std::string>
218getFunctionSourceCode(
const FunctionDecl *FD,
const DeclContext *TargetContext,
219 const syntax::TokenBuffer &TokBuf,
220 const HeuristicResolver *Resolver,
221 bool TargetFileIsHeader) {
222 auto &
AST = FD->getASTContext();
223 auto &SM =
AST.getSourceManager();
225 llvm::Error Errors = llvm::Error::success();
226 tooling::Replacements DeclarationCleanups;
236 if (
Ref.Qualifier ||
Ref.Targets.empty() ||
Ref.NameLoc.isMacroID())
239 if (
auto ReturnTypeRange = FD->getReturnTypeSourceRange();
240 Ref.NameLoc != FD->getLocation() &&
241 (ReturnTypeRange.isInvalid() ||
242 SM.isBeforeInTranslationUnit(
Ref.NameLoc,
243 ReturnTypeRange.getBegin()) ||
244 SM.isBeforeInTranslationUnit(ReturnTypeRange.getEnd(),
248 for (
const NamedDecl *ND :
Ref.Targets) {
249 if (ND->getKind() == Decl::TemplateTypeParm)
251 if (ND->getDeclContext() !=
Ref.Targets.front()->getDeclContext()) {
252 elog(
"Targets from multiple contexts: {0}, {1}",
258 const NamedDecl *ND =
Ref.Targets.front();
259 std::string Qualifier =
261 SM.getLocForStartOfFile(SM.getMainFileID()), ND);
262 if (ND->getDeclContext()->isDependentContext() &&
263 llvm::isa<TypeDecl>(ND)) {
264 Qualifier.insert(0,
"typename ");
266 if (
auto Err = DeclarationCleanups.add(
267 tooling::Replacement(SM,
Ref.NameLoc, 0, Qualifier)))
268 Errors = llvm::joinErrors(std::move(Errors), std::move(Err));
277 if (
const auto *Destructor = llvm::dyn_cast<CXXDestructorDecl>(FD)) {
278 if (
auto Err = DeclarationCleanups.add(tooling::Replacement(
279 SM, Destructor->getLocation(), 0,
281 SM.getLocForStartOfFile(SM.getMainFileID()),
283 Errors = llvm::joinErrors(std::move(Errors), std::move(Err));
288 for (
const auto *PVD : FD->parameters()) {
289 if (!PVD->hasDefaultArg())
292 auto DelRange = CharSourceRange::getTokenRange(PVD->getDefaultArgRange());
294 auto Tokens = TokBuf.expandedTokens(PVD->getSourceRange())
295 .take_while([&SM, &DelRange](
const syntax::Token &Tok) {
296 return SM.isBeforeInTranslationUnit(
297 Tok.location(), DelRange.getBegin());
299 if (TokBuf.expandedTokens(DelRange.getAsRange()).front().kind() !=
304 llvm::find_if(llvm::reverse(Tokens), [](
const syntax::Token &Tok) {
305 return Tok.kind() == tok::equal;
307 assert(Tok != Tokens.rend());
308 DelRange.setBegin(Tok->location());
311 DeclarationCleanups.add(tooling::Replacement(SM, DelRange,
"")))
312 Errors = llvm::joinErrors(std::move(Errors), std::move(Err));
315 auto DelAttr = [&](
const Attr *
A) {
319 TokBuf.spelledForExpanded(TokBuf.expandedTokens(
A->getRange()));
320 assert(
A->getLocation().isValid());
321 if (!AttrTokens || AttrTokens->empty()) {
322 Errors = llvm::joinErrors(
323 std::move(Errors),
error(
"define outline: Can't move out of line as "
324 "function has a macro `{0}` specifier.",
328 CharSourceRange DelRange =
329 syntax::Token::range(SM, AttrTokens->front(), AttrTokens->back())
332 DeclarationCleanups.add(tooling::Replacement(SM, DelRange,
"")))
333 Errors = llvm::joinErrors(std::move(Errors), std::move(Err));
336 DelAttr(FD->getAttr<OverrideAttr>());
337 DelAttr(FD->getAttr<FinalAttr>());
339 auto DelKeyword = [&](tok::TokenKind Kind, SourceRange FromRange) {
340 auto DelKeywords = deleteTokensWithKind(TokBuf, Kind, FromRange);
342 Errors = llvm::joinErrors(std::move(Errors), DelKeywords.takeError());
345 DeclarationCleanups = DeclarationCleanups.merge(*DelKeywords);
348 if (FD->isInlineSpecified())
349 DelKeyword(tok::kw_inline, {FD->getBeginLoc(), FD->getLocation()});
350 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
351 if (MD->isVirtualAsWritten())
352 DelKeyword(tok::kw_virtual, {FD->getBeginLoc(), FD->getLocation()});
354 DelKeyword(tok::kw_static, {FD->getBeginLoc(), FD->getLocation()});
356 if (
const auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
357 if (CD->isExplicit())
358 DelKeyword(tok::kw_explicit, {FD->getBeginLoc(), FD->getLocation()});
362 return std::move(Errors);
363 return getFunctionSourceAfterReplacements(FD, DeclarationCleanups,
367struct InsertionPoint {
368 const DeclContext *EnclosingNamespace =
nullptr;
372enum class RelativeInsertPos { Before, After };
373struct InsertionAnchor {
375 RelativeInsertPos RelInsertPos = RelativeInsertPos::Before;
381SourceRange getDeletionRange(
const FunctionDecl *FD,
382 const syntax::TokenBuffer &TokBuf) {
383 auto DeletionRange = FD->getBody()->getSourceRange();
384 if (
auto *CD = llvm::dyn_cast<CXXConstructorDecl>(FD)) {
387 SourceLocation InitStart;
389 for (
const auto *CInit : CD->inits()) {
391 if (CInit->getSourceOrder() != 0)
393 InitStart = CInit->getSourceLocation();
396 if (InitStart.isValid()) {
397 auto Toks = TokBuf.expandedTokens(CD->getSourceRange());
399 Toks = Toks.take_while([&TokBuf, &InitStart](
const syntax::Token &Tok) {
400 return TokBuf.sourceManager().isBeforeInTranslationUnit(Tok.location(),
405 llvm::find_if(llvm::reverse(Toks), [](
const syntax::Token &Tok) {
406 return Tok.kind() == tok::colon;
408 assert(Tok != Toks.rend());
409 DeletionRange.setBegin(Tok->location());
412 return DeletionRange;
431class DefineOutline :
public Tweak {
433 const char *id()
const override;
435 bool hidden()
const override {
return false; }
436 llvm::StringLiteral kind()
const override {
439 std::string title()
const override {
440 return "Move function body to out-of-line";
443 bool prepare(
const Selection &Sel)
override {
444 SameFile = !
isHeaderFile(Sel.AST->tuPath(), Sel.AST->getLangOpts());
445 Source = getSelectedFunction(Sel.ASTSelection.commonAncestor());
448 if (!Source || !Source->doesThisDeclarationHaveABody() ||
449 Source->isOutOfLine())
454 if (Source->getTemplateSpecializationInfo())
457 auto *MD = llvm::dyn_cast<CXXMethodDecl>(Source);
459 if (Source->getDescribedFunctionTemplate())
465 for (
const CXXRecordDecl *Parent = MD->getParent(); Parent;
467 llvm::dyn_cast_or_null<const CXXRecordDecl>(Parent->getParent())) {
468 if (
const TemplateParameterList *Params =
469 Parent->getDescribedTemplateParams()) {
476 for (NamedDecl *P : *Params) {
477 if (!
P->getIdentifier())
484 if (MD->getDescribedTemplate())
489 for (
const DeclContext *DC = MD->getParent(); DC; DC = DC->getParent()) {
490 if (
auto *ND = llvm::dyn_cast<NamedDecl>(DC)) {
491 if (ND->getDeclName().isEmpty() &&
492 (!SameFile || !llvm::dyn_cast<NamespaceDecl>(ND)))
503 Expected<Effect> apply(
const Selection &Sel)
override {
504 const SourceManager &SM = Sel.AST->getSourceManager();
505 std::optional<Path> CCFile;
506 auto Anchor = getDefinitionOfAdjacentDecl(Sel);
508 CCFile = Anchor->Loc.uri.file();
510 CCFile = SameFile ? Sel.AST->tuPath().str()
511 : getSourceFile(Sel.AST->tuPath(), Sel);
514 return error(
"Couldn't find a suitable implementation file.");
515 assert(Sel.FS &&
"FS Must be set in apply");
516 auto Buffer = Sel.FS->getBufferForFile(*CCFile);
520 return llvm::errorCodeToError(Buffer.getError());
522 auto Contents = Buffer->get()->getBuffer();
523 SourceManagerForFile SMFF(*CCFile, Contents);
525 std::optional<Position> InsertionPos;
527 if (
auto P = getInsertionPointFromExistingDefinition(
528 SMFF, **Buffer, Anchor->Loc, Anchor->RelInsertPos, Sel.AST)) {
533 std::optional<std::size_t> Offset;
534 const DeclContext *EnclosingNamespace =
nullptr;
535 std::string EnclosingNamespaceName;
539 Sel.AST->getLangOpts());
540 }
else if (SameFile) {
541 auto P = getInsertionPointInMainFile(Sel.AST);
543 return P.takeError();
545 EnclosingNamespace =
P->EnclosingNamespace;
548 Contents, Source->getQualifiedNameAsString(), Sel.AST->getLangOpts());
549 assert(!Region.EligiblePoints.empty());
550 EnclosingNamespaceName = Region.EnclosingNamespace;
551 InsertionPos = Region.EligiblePoints.back();
557 return O.takeError();
560 findContextForNS(EnclosingNamespaceName, Source->getDeclContext());
562 return error(
"define outline: couldn't find a context for target");
563 EnclosingNamespace = *TargetContext;
567 assert(EnclosingNamespace);
569 auto FuncDef = getFunctionSourceCode(
570 Source, EnclosingNamespace, Sel.AST->getTokens(),
571 Sel.AST->getHeuristicResolver(),
572 SameFile &&
isHeaderFile(Sel.AST->tuPath(), Sel.AST->getLangOpts()));
574 return FuncDef.takeError();
576 const tooling::Replacement InsertFunctionDef(*CCFile, *Offset, 0, *FuncDef);
577 auto Effect = Effect::mainFileEdit(
578 SMFF.get(), tooling::Replacements(InsertFunctionDef));
580 return Effect.takeError();
582 tooling::Replacements HeaderUpdates(tooling::Replacement(
583 Sel.AST->getSourceManager(),
585 SM, Sel.AST->getLangOpts(),
586 getDeletionRange(Source, Sel.AST->getTokens()))),
589 if (Source->isInlineSpecified()) {
591 deleteTokensWithKind(Sel.AST->getTokens(), tok::kw_inline,
592 {Source->getBeginLoc(), Source->getLocation()});
594 return DelInline.takeError();
595 HeaderUpdates = HeaderUpdates.merge(*DelInline);
599 tooling::Replacements &R = Effect->ApplyEdits[*CCFile].Replacements;
600 R = R.merge(HeaderUpdates);
602 auto HeaderFE = Effect::fileEdit(SM, SM.getMainFileID(), HeaderUpdates);
604 return HeaderFE.takeError();
605 Effect->ApplyEdits.try_emplace(HeaderFE->first,
606 std::move(HeaderFE->second));
608 return std::move(*Effect);
611 std::optional<InsertionAnchor>
612 getDefinitionOfAdjacentDecl(
const Selection &Sel) {
615 std::optional<Location> Anchor;
617 auto CheckCandidate = [&](Decl *Candidate) {
618 assert(Candidate != Source);
619 if (
auto Func = llvm::dyn_cast_or_null<FunctionDecl>(Candidate);
620 !Func || Func->isThisDeclarationADefinition()) {
623 std::optional<Location> CandidateLoc;
624 Sel.Index->lookup({{
getSymbolID(Candidate)}}, [&](
const Symbol &S) {
629 log(
"getDefinitionOfAdjacentDecl: {0}", Loc.takeError());
643 bool CandidateSameFile = TuURI == CandidateLoc->uri.uri();
644 if (SameFile && !CandidateSameFile)
646 if (!SameFile && CandidateSameFile) {
647 if (Candidate->isTemplateDecl())
651 Anchor = *CandidateLoc;
657 const DeclContext *ParentContext = Source->getParent();
658 const auto SourceIt = llvm::find_if(
659 ParentContext->decls(), [
this](
const Decl *D) { return D == Source; });
660 if (SourceIt == ParentContext->decls_end())
662 const int Preceding = std::distance(ParentContext->decls_begin(), SourceIt);
663 const int Following =
664 std::distance(SourceIt, ParentContext->decls_end()) - 1;
665 for (
int Offset = 1; Offset <= Preceding || Offset <= Following; ++Offset) {
666 if (Offset <= Preceding)
668 *std::next(ParentContext->decls_begin(), Preceding - Offset));
670 return InsertionAnchor{*Anchor, RelativeInsertPos::After};
671 if (Offset <= Following)
672 CheckCandidate(*std::next(SourceIt, Offset));
674 return InsertionAnchor{*Anchor, RelativeInsertPos::Before};
682 template <
typename Iterator>
683 Iterator skipTokenPair(Iterator Begin, Iterator End, tok::TokenKind StartKind,
684 tok::TokenKind EndKind) {
686 for (
auto It = Begin; It != End; ++It) {
687 if (It->kind() == StartKind) {
689 }
else if (It->kind() == EndKind) {
703 std::optional<Position> getInsertionPointFromExistingDefinition(
704 SourceManagerForFile &SMFF,
const llvm::MemoryBuffer &Buffer,
705 const Location &Loc, RelativeInsertPos RelInsertPos, ParsedAST *
AST) {
709 SourceLocation InsertionLoc;
710 SourceManager &SM = SMFF.get();
712 auto InsertBefore = [&] {
719 auto Tokens = syntax::tokenize(
720 syntax::FileRange(SM.getMainFileID(), 0, *StartOffset), SM,
724 for (
auto I = std::rbegin(Tokens);
725 InsertionLoc.isInvalid() && I != std::rend(Tokens); ++I) {
730 if (I != std::rbegin(Tokens))
731 InsertionLoc = std::prev(I)->location();
733 InsertionLoc = I->endLocation();
739 if (InsertionLoc.isInvalid())
740 InsertionLoc = Tokens.front().location();
743 if (RelInsertPos == RelativeInsertPos::Before) {
750 syntax::tokenize(syntax::FileRange(SM.getMainFileID(), *StartOffset,
751 Buffer.getBuffer().size()),
752 SM,
AST->getLangOpts());
753 std::optional<syntax::Token> Tok;
756 auto ClosingParen = skipTokenPair(Tokens.begin(), Tokens.end(),
757 tok::l_paren, tok::r_paren);
758 if (ClosingParen != Tokens.end()) {
760 auto AfterParams = std::next(ClosingParen);
761 if (AfterParams != Tokens.end() && AfterParams->kind() == tok::equal) {
762 auto NextIt = std::next(AfterParams);
763 if (NextIt != Tokens.end() && NextIt->kind() == tok::kw_default) {
765 auto SemiIt = std::next(NextIt);
766 if (SemiIt != Tokens.end() && SemiIt->kind() == tok::semi) {
773 if (!Tok && AfterParams != Tokens.end()) {
774 auto ClosingBrace = skipTokenPair(AfterParams, Tokens.end(),
775 tok::l_brace, tok::r_brace);
776 if (ClosingBrace != Tokens.end()) {
783 InsertionLoc = Tok->endLocation();
788 if (!InsertionLoc.isValid())
796 llvm::Expected<InsertionPoint> getInsertionPointInMainFile(ParsedAST *
AST) {
800 auto *Klass = Source->getDeclContext()->getOuterLexicalRecordContext();
802 return error(
"moving to same file not supported for free functions");
803 const SourceLocation EndLoc = Klass->getBraceRange().getEnd();
804 const auto &TokBuf =
AST->getTokens();
805 auto Tokens = TokBuf.expandedTokens();
806 auto It = llvm::lower_bound(
807 Tokens, EndLoc, [](
const syntax::Token &Tok, SourceLocation EndLoc) {
808 return Tok.location() < EndLoc;
810 while (It != Tokens.end()) {
811 if (It->kind() != tok::semi) {
816 AST->getSourceManager().getDecomposedLoc(It->endLocation()).second;
817 return InsertionPoint{Klass->getEnclosingNamespaceContext(), Offset};
820 "failed to determine insertion location: no end of class found");
824 const FunctionDecl *Source =
nullptr;
825 bool SameFile =
false;
#define REGISTER_TWEAK(Subclass)
An interface base for small context-sensitive refactoring actions.
static URI createFile(llvm::StringRef AbsolutePath)
This creates a file:// URI for AbsolutePath. The path must be absolute.
std::string toString() const
Returns a string URI with all components percent-encoded.
FIXME: Skip testing on windows temporarily due to the different escaping code mode.
llvm::Expected< Location > indexToLSPLocation(const SymbolLocation &Loc, llvm::StringRef TUPath)
Ensure we have enough bits to represent all SymbolTag values.
SymbolID getSymbolID(const Decl *D)
Gets the symbol ID for a declaration. Returned SymbolID might be null.
std::optional< SourceRange > toHalfOpenFileRange(const SourceManager &SM, const LangOptions &LangOpts, SourceRange R)
Turns a token range into a half-open range and checks its correctness.
std::string getQualification(ASTContext &Context, const DeclContext *DestContext, SourceLocation InsertionPoint, const NamedDecl *ND)
Gets the nested name specifier necessary for spelling ND in DestContext, at InsertionPoint.
void findExplicitReferences(const Stmt *S, llvm::function_ref< void(ReferenceLoc)> Out, const HeuristicResolver *Resolver)
Recursively traverse S and report all references explicitly written in the code.
llvm::Error error(std::error_code EC, const char *Fmt, Ts &&... Vals)
Position sourceLocToPosition(const SourceManager &SM, SourceLocation Loc)
Turn a SourceLocation into a [line, column] pair.
void log(const char *Fmt, Ts &&... Vals)
EligibleRegion getEligiblePoints(llvm::StringRef Code, llvm::StringRef FullyQualifiedName, const LangOptions &LangOpts)
Returns most eligible region to insert a definition for FullyQualifiedName in the Code.
llvm::Expected< size_t > positionToOffset(llvm::StringRef Code, Position P, bool AllowColumnsBeyondLineLength)
Turn a [line, column] pair into an offset in Code.
std::optional< Path > getCorrespondingHeaderOrSource(PathRef OriginalFile, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS)
Given a header file, returns the best matching source file, and vice visa.
std::string getNamespaceAtPosition(StringRef Code, const Position &Pos, const LangOptions &LangOpts)
std::string printQualifiedName(const NamedDecl &ND)
Returns the qualified name of ND.
void elog(const char *Fmt, Ts &&... Vals)
bool isHeaderFile(llvm::StringRef FileName, std::optional< LangOptions > LangOpts)
Infers whether this is a header from the FileName and LangOpts (if presents).
cppcoreguidelines::ProBoundsAvoidUncheckedContainerAccessCheck P
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Simplified description of a clang AST node.
static const llvm::StringLiteral REFACTOR_KIND
Represents a symbol occurrence in the source file.
Information about a reference written in the source code, independent of the actual AST node that thi...
Input to prepare and apply tweaks.