| 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_SCALABLESTATICANALYSISFRAMEWORK_CORE_ASTENTITYMAPPING_H |
| 10 | #define LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_CORE_ASTENTITYMAPPING_H |
| 11 | |
| 12 | #include "clang/AST/Decl.h" |
| 13 | #include "clang/ScalableStaticAnalysisFramework/Core/Model/EntityName.h" |
| 14 | #include "llvm/ADT/StringRef.h" |
| 15 | #include <optional> |
| 16 | |
| 17 | namespace 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. |
| 34 | std::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. |
| 43 | std::optional<EntityName> getEntityNameForReturn(const FunctionDecl *FD); |
| 44 | |
| 45 | } // namespace clang::ssaf |
| 46 | |
| 47 | #endif // LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_CORE_ASTENTITYMAPPING_H |
| 48 | |