clang 22.0.0git
ASTEntityMapping.h
Go to the documentation of this file.
1//===- ASTEntityMapping.h - AST to SSAF Entity mapping ----------*- 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#ifndef LLVM_CLANG_ANALYSIS_SCALABLE_ASTENTITYMAPPING_H
10#define LLVM_CLANG_ANALYSIS_SCALABLE_ASTENTITYMAPPING_H
11
12#include "clang/AST/Decl.h"
14#include "llvm/ADT/StringRef.h"
15#include <optional>
16
17namespace clang::ssaf {
18
19/// Maps a declaration to an EntityName.
20///
21/// Supported declaration types for entity mapping:
22/// - Functions and methods
23/// - Global Variables
24/// - Function parameters
25/// - Struct/class/union type definitions
26/// - Struct/class/union fields
27///
28/// Implicit declarations and compiler builtins are not mapped.
29///
30/// \param D The declaration to map. Must not be null.
31///
32/// \return An EntityName if the declaration can be mapped, std::nullopt
33/// otherwise.
34std::optional<EntityName> getEntityName(const Decl *D);
35
36/// Maps return entity of a function to an EntityName.
37/// The returned name uniquely identifies the return value of function \param
38/// FD.
39///
40/// \param FD The function declaration. Must not be null.
41///
42/// \return An EntityName for the function's return entity.
43std::optional<EntityName> getEntityNameForReturn(const FunctionDecl *FD);
44
45} // namespace clang::ssaf
46
47#endif // LLVM_CLANG_ANALYSIS_SCALABLE_ASTENTITYMAPPING_H
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:86
Represents a function declaration or definition.
Definition Decl.h:2000
std::optional< EntityName > getEntityNameForReturn(const FunctionDecl *FD)
Maps return entity of a function to an EntityName.
std::optional< EntityName > getEntityName(const Decl *D)
Maps a declaration to an EntityName.