clang 23.0.0git
clang::ssaf Namespace Reference

Namespaces

namespace  ErrorMessages

Classes

class  AnalysisBase
 Minimal common base for both analysis kinds. More...
class  AnalysisDriver
 Orchestrates whole-program analysis over an LUSummary. More...
class  AnalysisName
 Uniquely identifies a whole-program analysis and the AnalysisResult it produces. More...
class  AnalysisRegistry
 Unified registry for SummaryAnalysis and DerivedAnalysis implementations. More...
class  AnalysisResult
 Base class for whole-program analysis results. More...
class  BuildNamespace
 Represents a single namespace in the build process. More...
struct  CallGraphSummary
 Summary of direct call-graph edges for a single function entity. More...
class  DerivedAnalysis
 Typed intermediate that concrete derived analyses inherit from. More...
class  DerivedAnalysisBase
 Type-erased base for derived analyses. More...
class  EntityId
 Lightweight opaque handle representing an entity in an EntityIdTable. More...
class  EntityIdTable
 Manages entity name interning and provides efficient EntityId handles. More...
class  EntityLinkage
 Represents the linkage properties of an entity in the program model. More...
class  EntityLinker
class  EntityName
 Uniquely identifies an entity in a program. More...
class  EntityPointerLevelTranslator
class  EntitySummary
 Base class for analysis-specific summary data. More...
class  EntitySummaryEncoding
 Represents EntitySummary data in its serialized, format-specific encoding. More...
class  ErrorBuilder
 Fluent API for constructing contextual errors. More...
struct  FormatFile
struct  FormatInfoEntry
struct  HasAnalysisName
 Type trait that checks whether T has a static analysisName() method returning AnalysisName. More...
struct  HasAnalysisName< T, std::void_t< decltype(T::analysisName())> >
struct  HasSummaryName
 Type trait that checks whether T has a static summaryName() method returning SummaryName. More...
struct  HasSummaryName< T, std::void_t< decltype(T::summaryName())> >
class  JSONEntitySummaryEncoding
class  JSONFormat
class  LUSummary
 Represents a link unit (LU) summary containing merged entity summaries. More...
class  LUSummaryConsumer
 Consumes a LUSummary by dispatching its entity data to registered SummaryDataBuilders and returning the results in a SummaryDataStore. More...
class  LUSummaryEncoding
 Represents a link unit summary in its serialized encoding. More...
class  NestedBuildNamespace
 Represents a hierarchical sequence of build namespaces. More...
class  SerializationFormat
 Abstract base class for serialization formats. More...
class  SummaryAnalysis
 Typed intermediate that concrete summary analyses inherit from. More...
class  SummaryAnalysisBase
 Type-erased base for summary analyses. More...
class  SummaryData
 Base class for whole-program analysis data. More...
class  SummaryDataBuilder
 Typed intermediate template that concrete builders inherit from. More...
class  SummaryDataBuilderBase
 Abstract base class for all summary data builders. More...
class  SummaryDataBuilderRegistry
 Registry for SummaryDataBuilder implementations. More...
class  SummaryDataStore
 Owns a collection of SummaryData objects keyed by SummaryName. More...
class  SummaryName
 Uniquely identifies an analysis summary. More...
class  TUSummary
 Data extracted for a given translation unit and for a given set of analyses. More...
class  TUSummaryBuilder
class  TUSummaryEncoding
 Represents a translation unit summary in its serialized encoding. More...
class  TUSummaryExtractor
class  TUSummaryExtractorFrontendAction
 Wraps the existing FrontendAction and injects the extractor ASTConsumers into the pipeline after the ASTConsumers of the wrapped action. More...
class  UnsafeBufferUsageEntitySummary
 An UnsafeBufferUsageEntitySummary contains a set of EntityPointerLevels extracted from unsafe buffer pointers contributed by an entity. More...
class  UnsafeBufferUsageTUSummaryExtractor
class  WPASuite
 Bundles the EntityIdTable (moved from the LUSummary) and the analysis results produced by one AnalysisDriver::run() call, keyed by AnalysisName. More...

Typedefs

using SerializationFormatRegistry = llvm::Registry<SerializationFormat>
template<typename Derived>
using DerivesFromEntitySummary
using TUSummaryExtractorRegistry
using Array = llvm::json::Array
using Object = llvm::json::Object
using Value = llvm::json::Value

Enumerations

enum class  BuildNamespaceKind : unsigned short { CompilationUnit , LinkUnit }
enum class  EntityLinkageType { None , Internal , External }

Functions

EntityPointerLevel incrementPointerLevel (const EntityPointerLevel &E)
 An EntityPointerLevel is associated with a level of the declared pointer/array type of an entity.
llvm::json::Value entityPointerLevelToJSON (const EntityPointerLevel &EPL, JSONFormat::EntityIdToJSONFn EntityId2JSON)
Expected< EntityPointerLevel > entityPointerLevelFromJSON (const llvm::json::Value &EPLData, JSONFormat::EntityIdFromJSONFn EntityIdFromJSON)
llvm::Expected< std::unique_ptr< EntitySummary > > serializeDeserializeRoundTrip (const UnsafeBufferUsageEntitySummary &S, std::function< uint64_t(EntityId)> IdToIntFn, std::function< llvm::Expected< EntityId >(uint64_t)> IdFromIntFn)
std::optional< EntityNamegetEntityName (const Decl *D)
 Maps a declaration to an EntityName.
std::optional< EntityNamegetEntityNameForReturn (const FunctionDecl *FD)
 Maps return entity of a function to an EntityName.
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, BuildNamespaceKind BNK)
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const BuildNamespace &BN)
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const NestedBuildNamespace &NBN)
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const EntityId &Id)
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, EntityLinkageType Linkage)
 Writes a string representation of the linkage type to the stream.
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const EntityLinkage &Linkage)
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const EntityName &EN)
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const SummaryName &SN)
bool isFormatRegistered (llvm::StringRef FormatName)
 Check if a SerializationFormat was registered with a given name.
std::unique_ptr< SerializationFormatmakeFormat (llvm::StringRef FormatName)
 Try to instantiate a SerializationFormat with a given name.
void printAvailableFormats (llvm::raw_ostream &OS)
 Print the list of available serialization formats.
bool isTUSummaryExtractorRegistered (llvm::StringRef SummaryName)
 Check if a TUSummaryExtractor was registered with a given name.
std::unique_ptr< ASTConsumermakeTUSummaryExtractor (llvm::StringRef SummaryName, TUSummaryBuilder &Builder)
 Try to instantiate a TUSummaryExtractor with a given name.
void printAvailableTUSummaryExtractors (llvm::raw_ostream &OS)
 Print the list of available TUSummaryExtractors.
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const AnalysisName &AN)
llvm::StringRef getToolName ()
 Returns the name of the running tool, as set by initTool().
void fail (const char *Msg)
template<typename... Ts>
void fail (const char *Fmt, Ts &&...Args)
void fail (llvm::Error Err)
void loadPlugins (llvm::ArrayRef< std::string > Paths)
void initTool (int argc, const char **argv, llvm::StringRef Version, llvm::cl::OptionCategory &Category, llvm::StringRef ToolHeading)
 Sets ToolName, ToolVersion, and the version printer, hides unrelated command-line options, and parses arguments.
template<typename NodeTy, typename... Ts>
llvm::Error makeErrAtNode (clang::ASTContext &Ctx, const NodeTy *N, llvm::StringRef Fmt, const Ts &...Args)
template<typename... Ts>
llvm::Error makeSawButExpectedError (const llvm::json::Value &Saw, llvm::StringRef Expected, const Ts &...ExpectedArgs)
template<typename DeclOrExpr>
bool hasPtrOrArrType (const DeclOrExpr *E)
llvm::Error makeEntityNameErr (clang::ASTContext &Ctx, const clang::NamedDecl *D)
void findContributors (ASTContext &Ctx, std::vector< const NamedDecl * > &Contributors)
 Find all contributors in an AST.
void findMatchesIn (const NamedDecl *Contributor, llvm::function_ref< void(const DynTypedNode &)> MatchActionRef)
 Perform "MatchAction" on each Stmt and Decl belonging to the Contributor.
llvm::StringRef buildNamespaceKindToString (BuildNamespaceKind BNK)
 Returns the canonical string representation of BNK used for serialization and display (e.g.
std::optional< BuildNamespaceKindbuildNamespaceKindFromString (llvm::StringRef Str)
 Parses a string produced by buildNamespaceKindToString().
llvm::StringRef entityLinkageTypeToString (EntityLinkageType LT)
 Returns the canonical string representation of LT used for serialization and display (e.g.
std::optional< EntityLinkageTypeentityLinkageTypeFromString (llvm::StringRef Str)
 Parses a string produced by entityLinkageTypeToString().
llvm::Expected< ValuereadJSON (llvm::StringRef Path)
llvm::Error writeJSON (Value &&V, llvm::StringRef Path)
SummaryName summaryNameFromJSON (llvm::StringRef SummaryNameStr)
llvm::StringRef summaryNameToJSON (const SummaryName &SN)
AnalysisName analysisNameFromJSON (llvm::StringRef AnalysisNameStr)
llvm::StringRef analysisNameToJSON (const AnalysisName &AN)
llvm::Expected< BuildNamespaceKindbuildNamespaceKindFromJSON (llvm::StringRef BuildNamespaceKindStr)
llvm::StringRef buildNamespaceKindToJSON (BuildNamespaceKind BNK)
static llvm::Expected< std::pair< llvm::StringRef, llvm::StringRef > > entityNameCoreFromJSON (const Object &EntityNameObject)
 Reads "usr" and "suffix" fields from an EntityName JSON object.
llvm::Expected< EntityLinkageTypeentityLinkageTypeFromJSON (llvm::StringRef EntityLinkageTypeStr)
llvm::StringRef entityLinkageTypeToJSON (EntityLinkageType LT)
static llvm::Expected< EntityIdentityIdTableEntryIdFromJSON (const Object &EntityIdTableEntryObject, llvm::function_ref< EntityId(uint64_t)> MakeId)
 Shared logic for reading the "id" field from an EntityIdTableEntry object.
static llvm::Expected< EntityIdTableentityIdTableFromJSONImpl (const Array &EntityIdTableArray, llvm::function_ref< llvm::Expected< std::pair< EntityName, EntityId > >(const Object &)> EntryReader, llvm::function_ref< std::map< EntityName, EntityId > &(EntityIdTable &)> GetEntities)
 Shared logic for deserializing an EntityIdTable from a JSON array.

Variables

template<typename T>
constexpr bool HasSummaryName_v = HasSummaryName<T>::value
template<typename T>
constexpr bool HasAnalysisName_v = HasAnalysisName<T>::value
constexpr const char * JSONFormatFileExtension = ".json"
constexpr const char * JSONEntityIdKey = "@"
 An entity ID is encoded as the single-key object {"@": <index>}.
static constexpr llvm::StringLiteral ErrorSeparator = " + "
static constexpr llvm::StringLiteral ContextSeparator = "\n"

Typedef Documentation

◆ Array

using clang::ssaf::Array = llvm::json::Array

Definition at line 37 of file JSONFormatImpl.h.

◆ DerivesFromEntitySummary

template<typename Derived>
using clang::ssaf::DerivesFromEntitySummary
Initial value:
std::enable_if_t<std::is_base_of_v<EntitySummary, Derived>>

Definition at line 25 of file EntitySummary.h.

◆ Object

using clang::ssaf::Object = llvm::json::Object

Definition at line 38 of file JSONFormatImpl.h.

◆ SerializationFormatRegistry

◆ TUSummaryExtractorRegistry

Initial value:
llvm::Registry<TUSummaryExtractor, TUSummaryBuilder &>

Definition at line 51 of file ExtractorRegistry.h.

◆ Value

using clang::ssaf::Value = llvm::json::Value

Definition at line 39 of file JSONFormatImpl.h.

Enumeration Type Documentation

◆ BuildNamespaceKind

enum class clang::ssaf::BuildNamespaceKind : unsigned short
strong
Enumerator
CompilationUnit 
LinkUnit 

Definition at line 30 of file BuildNamespace.h.

◆ EntityLinkageType

enum class clang::ssaf::EntityLinkageType
strong
Enumerator
None 

local variables, function parameters

Internal 

static functions/variables, anonymous namespace

External 

globally visible across translation units

Definition at line 17 of file EntityLinkage.h.

Function Documentation

◆ analysisNameFromJSON()

AnalysisName clang::ssaf::analysisNameFromJSON ( llvm::StringRef AnalysisNameStr)

Definition at line 150 of file JSONFormatImpl.cpp.

◆ analysisNameToJSON()

llvm::StringRef clang::ssaf::analysisNameToJSON ( const AnalysisName & AN)

Definition at line 154 of file JSONFormatImpl.cpp.

References clang::ssaf::AnalysisName::str().

◆ buildNamespaceKindFromJSON()

llvm::Expected< BuildNamespaceKind > clang::ssaf::buildNamespaceKindFromJSON ( llvm::StringRef BuildNamespaceKindStr)

◆ buildNamespaceKindFromString()

std::optional< BuildNamespaceKind > clang::ssaf::buildNamespaceKindFromString ( llvm::StringRef Str)
inline

Parses a string produced by buildNamespaceKindToString().

Returns std::nullopt if Str does not match any known BuildNamespaceKind value.

Definition at line 46 of file ModelStringConversions.h.

References CompilationUnit, and LinkUnit.

Referenced by buildNamespaceKindFromJSON().

◆ buildNamespaceKindToJSON()

llvm::StringRef clang::ssaf::buildNamespaceKindToJSON ( BuildNamespaceKind BNK)

Definition at line 220 of file JSONFormatImpl.cpp.

References buildNamespaceKindToString().

◆ buildNamespaceKindToString()

llvm::StringRef clang::ssaf::buildNamespaceKindToString ( BuildNamespaceKind BNK)
inline

Returns the canonical string representation of BNK used for serialization and display (e.g.

"CompilationUnit", "LinkUnit").

Definition at line 33 of file ModelStringConversions.h.

References CompilationUnit, and LinkUnit.

Referenced by buildNamespaceKindToJSON(), and operator<<().

◆ entityIdTableEntryIdFromJSON()

llvm::Expected< EntityId > clang::ssaf::entityIdTableEntryIdFromJSON ( const Object & EntityIdTableEntryObject,
llvm::function_ref< EntityId(uint64_t)> MakeId )
static

Shared logic for reading the "id" field from an EntityIdTableEntry object.

Definition at line 446 of file JSONFormatImpl.cpp.

References clang::ssaf::ErrorBuilder::build(), clang::ssaf::ErrorBuilder::create(), and clang::ssaf::ErrorMessages::FailedToReadObjectAtField.

◆ entityIdTableFromJSONImpl()

llvm::Expected< EntityIdTable > clang::ssaf::entityIdTableFromJSONImpl ( const Array & EntityIdTableArray,
llvm::function_ref< llvm::Expected< std::pair< EntityName, EntityId > >(const Object &)> EntryReader,
llvm::function_ref< std::map< EntityName, EntityId > &(EntityIdTable &)> GetEntities )
static

◆ entityLinkageTypeFromJSON()

llvm::Expected< EntityLinkageType > clang::ssaf::entityLinkageTypeFromJSON ( llvm::StringRef EntityLinkageTypeStr)

◆ entityLinkageTypeFromString()

std::optional< EntityLinkageType > clang::ssaf::entityLinkageTypeFromString ( llvm::StringRef Str)
inline

Parses a string produced by entityLinkageTypeToString().

Returns std::nullopt if Str does not match any known EntityLinkageType value.

Definition at line 75 of file ModelStringConversions.h.

References External, Internal, and None.

Referenced by entityLinkageTypeFromJSON().

◆ entityLinkageTypeToJSON()

llvm::StringRef clang::ssaf::entityLinkageTypeToJSON ( EntityLinkageType LT)

Definition at line 406 of file JSONFormatImpl.cpp.

References entityLinkageTypeToString().

◆ entityLinkageTypeToString()

llvm::StringRef clang::ssaf::entityLinkageTypeToString ( EntityLinkageType LT)
inline

Returns the canonical string representation of LT used for serialization and display (e.g.

"None", "Internal", "External").

Definition at line 60 of file ModelStringConversions.h.

References External, Internal, and None.

Referenced by entityLinkageTypeToJSON(), and operator<<().

◆ entityNameCoreFromJSON()

llvm::Expected< std::pair< llvm::StringRef, llvm::StringRef > > clang::ssaf::entityNameCoreFromJSON ( const Object & EntityNameObject)
static

Reads "usr" and "suffix" fields from an EntityName JSON object.

Shared core logic for both TU and LU entity name deserialization.

Definition at line 317 of file JSONFormatImpl.cpp.

References clang::ssaf::ErrorBuilder::build(), clang::ssaf::ErrorBuilder::create(), and clang::ssaf::ErrorMessages::FailedToReadObjectAtField.

◆ entityPointerLevelFromJSON()

Expected< EntityPointerLevel > clang::ssaf::entityPointerLevelFromJSON ( const llvm::json::Value & EPLData,
JSONFormat::EntityIdFromJSONFn EntityIdFromJSON )

Definition at line 270 of file EntityPointerLevel.cpp.

References makeSawButExpectedError().

Referenced by deserializeImpl().

◆ entityPointerLevelToJSON()

llvm::json::Value clang::ssaf::entityPointerLevelToJSON ( const EntityPointerLevel & EPL,
JSONFormat::EntityIdToJSONFn EntityId2JSON )

Definition at line 264 of file EntityPointerLevel.cpp.

Referenced by serialize().

◆ fail() [1/3]

template<typename... Ts>
void clang::ssaf::fail ( const char * Fmt,
Ts &&... Args )
inline

Definition at line 43 of file Utils.h.

References fail(), and noreturn.

◆ fail() [2/3]

void clang::ssaf::fail ( const char * Msg)

◆ fail() [3/3]

void clang::ssaf::fail ( llvm::Error Err)

Definition at line 132 of file Utils.cpp.

References fail(), and noreturn.

◆ findContributors()

void clang::ssaf::findContributors ( ASTContext & Ctx,
std::vector< const NamedDecl * > & Contributors )

Find all contributors in an AST.

Definition at line 101 of file SSAFAnalysesCommon.cpp.

Referenced by clang::ssaf::UnsafeBufferUsageTUSummaryExtractor::HandleTranslationUnit().

◆ findMatchesIn()

void clang::ssaf::findMatchesIn ( const NamedDecl * Contributor,
llvm::function_ref< void(const DynTypedNode &)> MatchActionRef )

Perform "MatchAction" on each Stmt and Decl belonging to the Contributor.

Parameters
Contributor
MatchActionRefa reference (view) to a "MatchAction"

Definition at line 109 of file SSAFAnalysesCommon.cpp.

Referenced by clang::ssaf::UnsafeBufferUsageTUSummaryExtractor::extractEntitySummary().

◆ getEntityName()

std::optional< EntityName > clang::ssaf::getEntityName ( const Decl * D)

Maps a declaration to an EntityName.

Supported declaration types for entity mapping:

  • Functions and methods
  • Global Variables
  • Function parameters
  • Struct/class/union type definitions
  • Struct/class/union fields

Implicit declarations and compiler builtins are not mapped.

Parameters
DThe declaration to map. Must not be null.
Returns
An EntityName if the declaration can be mapped, std::nullopt otherwise.

Definition at line 21 of file ASTEntityMapping.cpp.

References clang::cast(), clang::index::generateUSRForDecl(), clang::isa(), and clang::Decl::isImplicit().

Referenced by clang::ssaf::UnsafeBufferUsageTUSummaryExtractor::HandleTranslationUnit(), and clang::ssaf::EntityPointerLevelTranslator::translate().

◆ getEntityNameForReturn()

std::optional< EntityName > clang::ssaf::getEntityNameForReturn ( const FunctionDecl * FD)

Maps return entity of a function to an EntityName.

The returned name uniquely identifies the return value of function

Parameters
FD.
FDThe function declaration. Must not be null.
Returns
An EntityName for the function's return entity.

Definition at line 62 of file ASTEntityMapping.cpp.

References clang::index::generateUSRForDecl(), clang::FunctionDecl::getBuiltinID(), and clang::Decl::isImplicit().

Referenced by clang::ssaf::EntityPointerLevelTranslator::translate().

◆ getToolName()

llvm::StringRef clang::ssaf::getToolName ( )

Returns the name of the running tool, as set by initTool().

Definition at line 125 of file Utils.cpp.

◆ hasPtrOrArrType()

template<typename DeclOrExpr>
bool clang::ssaf::hasPtrOrArrType ( const DeclOrExpr * E)

Definition at line 39 of file SSAFAnalysesCommon.h.

◆ incrementPointerLevel()

EntityPointerLevel clang::ssaf::incrementPointerLevel ( const EntityPointerLevel & E)

An EntityPointerLevel is associated with a level of the declared pointer/array type of an entity.

In the fully-expanded spelling of the declared type, a EntityPointerLevel is associated with a '*' (or a '[]‘) in / that declaration. / / For example, for 'int *p[10];’, there are two EntityPointerLevels. / One is associated with 'int *[10]' of 'p' and the other is associated with / 'int *' of 'p'. / / An EntityPointerLevel can be identified by an EntityId and an unsigned / integer indicating the pointer level: '(EntityId, PointerLevel)'. / An EntityPointerLevel 'P' is valid iff 'P.EntityId' has a pointer type with / at least 'P.PointerLevel' levels (This implies 'P.PointerLevel > 0'). / / For the same example 'int *p[10];', the EntityPointerLevels below are valid: / - '(p, 2)' is associated with the 'int *' part of the declared type of 'p'; / - '(p, 1)' is associated with the 'int *[10]' part of the declared type of / 'p'. class EntityPointerLevel { EntityId Entity; unsigned PointerLevel;

friend class EntityPointerLevelTranslator; For unittests: friend EntityPointerLevel buildEntityPointerLevel(EntityId, unsigned);

EntityPointerLevel(std::pair<EntityId, unsigned> Pair) : Entity(Pair.first), PointerLevel(Pair.second) {}

public: EntityId getEntity() const { return Entity; } unsigned getPointerLevel() const { return PointerLevel; }

bool operator==(const EntityPointerLevel &Other) const { return std::tie(Entity, PointerLevel) == std::tie(Other.Entity, Other.PointerLevel); }

bool operator!=(const EntityPointerLevel &Other) const { return !(*this == Other); }

bool operator<(const EntityPointerLevel &Other) const { return std::tie(Entity, PointerLevel) < std::tie(Other.Entity, Other.PointerLevel); }

/ Compares EntityPointerLevels; additionally, partially compares / EntityPointerLevel with EntityId. struct Comparator { using is_transparent = void; bool operator()(const EntityPointerLevel &L, const EntityPointerLevel &R) const { return L < R; } bool operator()(const EntityId &L, const EntityPointerLevel &R) const { return L < R.getEntity(); } bool operator()(const EntityPointerLevel &L, const EntityId &R) const { return L.getEntity() < R; } }; };

using EntityPointerLevelSet = std::set<EntityPointerLevel, EntityPointerLevel::Comparator>;

/ Translate a pointer/array type expression 'E' to a (set of) / EntityPointerLevel(s) associated with the declared type of the base address / of E. If the base address of E is not associated with an entity, the / translation result is an empty set. / /

Parameters
Ethe pointer expression to be translated /
Ctxthe AST context of E /
AddEntitythe callback provided by the caller to convert EntityNames / to EntityIds. llvm::Expected<EntityPointerLevelSet> translateEntityPointerLevel( const Expr *E, ASTContext &Ctx, llvm::function_ref<EntityId(EntityName EN)> AddEntity);

/ Creates a EntityPointerLevel from a pair of an EntityId and a pointer / level: EntityPointerLevel buildEntityPointerLevel(EntityId, unsigned);

/ Create an EntityPointerLevel (EPL) from a NamedDecl of a pointer/array type. / /

Parameters
NDthe NamedDecl of a pointer/array type. /
AddEntitythe callback provided by the caller to convert EntityNames / to EntityIds. /
IsFunRettrue iff the created EPL is associated with the return type / of a function entity. llvm::Expected<EntityPointerLevel> createEntityPointerLevel(const NamedDecl *ND, llvm::function_ref<EntityId(EntityName EN)> AddEntity, bool IsFunRet = false);

/ Creates a new EntityPointerLevel (EPL) from E by incrementing E's / pointer level. /

Returns
the EPL that is associated with the pointee (or array element) type / of E's associated pointer/array type of the same entity.

Definition at line 250 of file EntityPointerLevel.cpp.

References clang::ssaf::EntityPointerLevelTranslator::incrementPointerLevel().

◆ initTool()

void clang::ssaf::initTool ( int argc,
const char ** argv,
llvm::StringRef Version,
llvm::cl::OptionCategory & Category,
llvm::StringRef ToolHeading )

Sets ToolName, ToolVersion, and the version printer, hides unrelated command-line options, and parses arguments.

Must be called after InitLLVM.

Definition at line 147 of file Utils.cpp.

◆ isFormatRegistered()

bool clang::ssaf::isFormatRegistered ( llvm::StringRef FormatName)

Check if a SerializationFormat was registered with a given name.

Definition at line 17 of file SerializationFormatRegistry.cpp.

References isFormatRegistered().

Referenced by isFormatRegistered(), and parseOutputFileFormatAndPathOrReportError().

◆ isTUSummaryExtractorRegistered()

bool clang::ssaf::isTUSummaryExtractorRegistered ( llvm::StringRef SummaryName)

Check if a TUSummaryExtractor was registered with a given name.

Definition at line 17 of file ExtractorRegistry.cpp.

References isTUSummaryExtractorRegistered().

Referenced by isTUSummaryExtractorRegistered(), makeTUSummaryExtractors(), and reportUnrecognizedExtractorNames().

◆ loadPlugins()

void clang::ssaf::loadPlugins ( llvm::ArrayRef< std::string > Paths)

Definition at line 137 of file Utils.cpp.

References fail().

◆ makeEntityNameErr()

◆ makeErrAtNode()

template<typename NodeTy, typename... Ts>
llvm::Error clang::ssaf::makeErrAtNode ( clang::ASTContext & Ctx,
const NodeTy * N,
llvm::StringRef Fmt,
const Ts &... Args )

◆ makeFormat()

std::unique_ptr< SerializationFormat > clang::ssaf::makeFormat ( llvm::StringRef FormatName)

Try to instantiate a SerializationFormat with a given name.

This might return null if the construction of the desired SerializationFormat failed. It's a fatal error if there is no format registered with the name.

Definition at line 25 of file SerializationFormatRegistry.cpp.

◆ makeSawButExpectedError()

template<typename... Ts>
llvm::Error clang::ssaf::makeSawButExpectedError ( const llvm::json::Value & Saw,
llvm::StringRef Expected,
const Ts &... ExpectedArgs )

Definition at line 30 of file SSAFAnalysesCommon.h.

Referenced by deserializeImpl(), and entityPointerLevelFromJSON().

◆ makeTUSummaryExtractor()

std::unique_ptr< ASTConsumer > clang::ssaf::makeTUSummaryExtractor ( llvm::StringRef SummaryName,
TUSummaryBuilder & Builder )

Try to instantiate a TUSummaryExtractor with a given name.

This might return null if the construction of the desired TUSummaryExtractor failed. It's a fatal error if there is no extractor registered with the name.

Definition at line 25 of file ExtractorRegistry.cpp.

Referenced by makeTUSummaryExtractors().

◆ operator<<() [1/9]

llvm::raw_ostream & clang::ssaf::operator<< ( llvm::raw_ostream & OS,
BuildNamespaceKind BNK )

Definition at line 57 of file BuildNamespace.cpp.

References buildNamespaceKindToString().

◆ operator<<() [2/9]

llvm::raw_ostream & clang::ssaf::operator<< ( llvm::raw_ostream & OS,
const AnalysisName & AN )

Definition at line 13 of file AnalysisName.cpp.

References clang::ssaf::AnalysisName::str().

◆ operator<<() [3/9]

llvm::raw_ostream & clang::ssaf::operator<< ( llvm::raw_ostream & OS,
const BuildNamespace & BN )

Definition at line 61 of file BuildNamespace.cpp.

◆ operator<<() [4/9]

llvm::raw_ostream & clang::ssaf::operator<< ( llvm::raw_ostream & OS,
const EntityId & Id )

Definition at line 13 of file EntityId.cpp.

◆ operator<<() [5/9]

llvm::raw_ostream & clang::ssaf::operator<< ( llvm::raw_ostream & OS,
const EntityLinkage & Linkage )

Definition at line 28 of file EntityLinkage.cpp.

◆ operator<<() [6/9]

llvm::raw_ostream & clang::ssaf::operator<< ( llvm::raw_ostream & OS,
const EntityName & EN )

Definition at line 36 of file EntityName.cpp.

◆ operator<<() [7/9]

llvm::raw_ostream & clang::ssaf::operator<< ( llvm::raw_ostream & OS,
const NestedBuildNamespace & NBN )

Definition at line 65 of file BuildNamespace.cpp.

◆ operator<<() [8/9]

llvm::raw_ostream & clang::ssaf::operator<< ( llvm::raw_ostream & OS,
const SummaryName & SN )

Definition at line 13 of file SummaryName.cpp.

References clang::ssaf::SummaryName::str().

◆ operator<<() [9/9]

llvm::raw_ostream & clang::ssaf::operator<< ( llvm::raw_ostream & OS,
EntityLinkageType Linkage )

Writes a string representation of the linkage type to the stream.

Definition at line 23 of file EntityLinkage.cpp.

References entityLinkageTypeToString().

◆ printAvailableFormats()

void clang::ssaf::printAvailableFormats ( llvm::raw_ostream & OS)

Print the list of available serialization formats.

Definition at line 33 of file SerializationFormatRegistry.cpp.

Referenced by clang::driver::Driver::HandleImmediateArgs().

◆ printAvailableTUSummaryExtractors()

void clang::ssaf::printAvailableTUSummaryExtractors ( llvm::raw_ostream & OS)

Print the list of available TUSummaryExtractors.

Definition at line 34 of file ExtractorRegistry.cpp.

Referenced by clang::driver::Driver::HandleImmediateArgs().

◆ readJSON()

◆ serializeDeserializeRoundTrip()

llvm::Expected< std::unique_ptr< EntitySummary > > clang::ssaf::serializeDeserializeRoundTrip ( const UnsafeBufferUsageEntitySummary & S,
std::function< uint64_t(EntityId)> IdToIntFn,
std::function< llvm::Expected< EntityId >(uint64_t)> IdFromIntFn )

Definition at line 92 of file UnsafeBufferUsage.cpp.

References deserializeImpl(), std::function, and serialize().

◆ summaryNameFromJSON()

SummaryName clang::ssaf::summaryNameFromJSON ( llvm::StringRef SummaryNameStr)

Definition at line 140 of file JSONFormatImpl.cpp.

◆ summaryNameToJSON()

llvm::StringRef clang::ssaf::summaryNameToJSON ( const SummaryName & SN)

Definition at line 144 of file JSONFormatImpl.cpp.

References clang::ssaf::SummaryName::str().

◆ writeJSON()

Variable Documentation

◆ ContextSeparator

llvm::StringLiteral clang::ssaf::ContextSeparator = "\n"
staticconstexpr

Definition at line 17 of file ErrorBuilder.cpp.

Referenced by clang::ssaf::ErrorBuilder::build().

◆ ErrorSeparator

llvm::StringLiteral clang::ssaf::ErrorSeparator = " + "
staticconstexpr

Definition at line 16 of file ErrorBuilder.cpp.

Referenced by clang::ssaf::ErrorBuilder::wrap().

◆ HasAnalysisName_v

template<typename T>
bool clang::ssaf::HasAnalysisName_v = HasAnalysisName<T>::value
inlineconstexpr

Definition at line 32 of file AnalysisTraits.h.

Referenced by clang::ssaf::WPASuite::contains(), and clang::ssaf::WPASuite::get().

◆ HasSummaryName_v

template<typename T>
bool clang::ssaf::HasSummaryName_v = HasSummaryName<T>::value
inlineconstexpr

◆ JSONEntityIdKey

const char* clang::ssaf::JSONEntityIdKey = "@"
inlineconstexpr

An entity ID is encoded as the single-key object {"@": <index>}.

Definition at line 127 of file JSONFormatImpl.h.

◆ JSONFormatFileExtension

const char* clang::ssaf::JSONFormatFileExtension = ".json"
inlineconstexpr

Definition at line 45 of file JSONFormatImpl.h.

Referenced by readJSON(), and writeJSON().