//==- ProgramPoint.h - Program Points for Path-Sensitive Analysis --*- C++ -*-// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file defines the interface ProgramPoint, which identifies a // distinct location in a function. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_ANALYSIS_PROGRAMPOINT_H #define LLVM_CLANG_ANALYSIS_PROGRAMPOINT_H #include "clang/Analysis/AnalysisDeclContext.h" #include "clang/Analysis/CFG.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Casting.h" #include "llvm/Support/DataTypes.h" #include <cassert> #include <optional> #include <string> #include <utility> namespace clang { class AnalysisDeclContext; class LocationContext; /// ProgramPoints can be "tagged" as representing points specific to a given /// analysis entity. Tags are abstract annotations, with an associated /// description and potentially other information. class ProgramPointTag { … }; class SimpleProgramPointTag : public ProgramPointTag { … }; class ProgramPoint { … }; class BlockEntrance : public ProgramPoint { … }; class BlockExit : public ProgramPoint { … }; // FIXME: Eventually we want to take a CFGElementRef as parameter here too. class StmtPoint : public ProgramPoint { … }; class PreStmt : public StmtPoint { … }; class PostStmt : public StmtPoint { … }; class FunctionExitPoint : public ProgramPoint { … }; // PostCondition represents the post program point of a branch condition. class PostCondition : public PostStmt { … }; class LocationCheck : public StmtPoint { … }; class PreLoad : public LocationCheck { … }; class PreStore : public LocationCheck { … }; class PostLoad : public PostStmt { … }; /// Represents a program point after a store evaluation. class PostStore : public PostStmt { … }; class PostLValue : public PostStmt { … }; /// Represents a point after we ran remove dead bindings BEFORE /// processing the given statement. class PreStmtPurgeDeadSymbols : public StmtPoint { … }; /// Represents a point after we ran remove dead bindings AFTER /// processing the given statement. class PostStmtPurgeDeadSymbols : public StmtPoint { … }; class BlockEdge : public ProgramPoint { … }; class PostInitializer : public ProgramPoint { … }; /// Represents an implicit call event. /// /// The nearest statement is provided for diagnostic purposes. class ImplicitCallPoint : public ProgramPoint { … }; /// Represents a program point just before an implicit call event. /// /// Explicit calls will appear as PreStmt program points. class PreImplicitCall : public ImplicitCallPoint { … }; /// Represents a program point just after an implicit call event. /// /// Explicit calls will appear as PostStmt program points. class PostImplicitCall : public ImplicitCallPoint { … }; class PostAllocatorCall : public StmtPoint { … }; /// Represents a point when we begin processing an inlined call. /// CallEnter uses the caller's location context. class CallEnter : public ProgramPoint { … }; /// Represents a point when we start the call exit sequence (for inlined call). /// /// The call exit is simulated with a sequence of nodes, which occur between /// CallExitBegin and CallExitEnd. The following operations occur between the /// two program points: /// - CallExitBegin /// - Bind the return value /// - Run Remove dead bindings (to clean up the dead symbols from the callee). /// - CallExitEnd class CallExitBegin : public ProgramPoint { … }; /// Represents a point when we finish the call exit sequence (for inlined call). /// \sa CallExitBegin class CallExitEnd : public ProgramPoint { … }; /// Represents a point when we exit a loop. /// When this ProgramPoint is encountered we can be sure that the symbolic /// execution of the corresponding LoopStmt is finished on the given path. /// Note: It is possible to encounter a LoopExit element when we haven't even /// encountered the loop itself. At the current state not all loop exits will /// result in a LoopExit program point. class LoopExit : public ProgramPoint { … }; /// This is a meta program point, which should be skipped by all the diagnostic /// reasoning etc. class EpsilonPoint : public ProgramPoint { … }; } // end namespace clang namespace llvm { // Traits specialization for DenseMap template <> struct DenseMapInfo<clang::ProgramPoint> { … }; } // end namespace llvm #endif