clang 20.0.0git
USRFinder.h
Go to the documentation of this file.
1//===--- USRFinder.h - Clang refactoring library --------------------------===//
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/// \file
10/// Methods for determining the USR of a symbol at a location in source
11/// code.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CLANG_TOOLING_REFACTORING_RENAME_USRFINDER_H
16#define LLVM_CLANG_TOOLING_REFACTORING_RENAME_USRFINDER_H
17
18#include "clang/AST/AST.h"
20#include <string>
21#include <vector>
22
23namespace clang {
24
25class ASTContext;
26class Decl;
27class SourceLocation;
28class NamedDecl;
29
30namespace tooling {
31
32// Given an AST context and a point, returns a NamedDecl identifying the symbol
33// at the point. Returns null if nothing is found at the point.
34const NamedDecl *getNamedDeclAt(const ASTContext &Context,
35 const SourceLocation Point);
36
37// Given an AST context and a fully qualified name, returns a NamedDecl
38// identifying the symbol with a matching name. Returns null if nothing is
39// found for the name.
40const NamedDecl *getNamedDeclFor(const ASTContext &Context,
41 const std::string &Name);
42
43// Converts a Decl into a USR.
44std::string getUSRForDecl(const Decl *Decl);
45
46} // end namespace tooling
47} // end namespace clang
48
49#endif // LLVM_CLANG_TOOLING_REFACTORING_RENAME_USRFINDER_H
Defines the clang::ASTContext interface.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
const NamedDecl * getNamedDeclFor(const ASTContext &Context, const std::string &Name)
Definition: USRFinder.cpp:128
const NamedDecl * getNamedDeclAt(const ASTContext &Context, const SourceLocation Point)
Definition: USRFinder.cpp:77
std::string getUSRForDecl(const Decl *Decl)
Definition: USRFinder.cpp:135
The JSON file list parser is used to communicate input to InstallAPI.