Classes | Namespaces | Macros | Functions | Variables
CodeGenerator.cpp File Reference
#include <algorithm>
#include <optional>
#include <vector>
#include "ASTHelpers.h"
#include "ClangCompat.h"
#include "CodeGenerator.h"
#include "DPrint.h"
#include "Insights.h"
#include "InsightsHelpers.h"
#include "InsightsOnce.h"
#include "InsightsStrCat.h"
#include "NumberIterator.h"
#include "clang/AST/RecordLayout.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Sema/Sema.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Path.h"
#include "CodeGeneratorTypes.h"
Include dependency graph for CodeGenerator.cpp:

Go to the source code of this file.

Classes

class  clang::insights::ArrayInitCodeGenerator
 
class  clang::insights::StructuredBindingsCodeGenerator
 
class  clang::insights::UsingCodeGenerator
 Handle using statements which pull functions ore members from a base class into the class. More...
 
class  clang::insights::LambdaInitCaptureCodeGenerator
 A special code generator for Lambda init captures which use std::move. More...
 
class  clang::insights::LambdaNameOnlyCodeGenerator
 
class  clang::insights::BindingDeclFinder
 Find a DeclRefExpr belonging to a DecompositionDecl. More...
 
class  clang::insights::TemporaryDeclFinder
 Find a DeclRefExpr belonging to a DecompositionDecl. More...
 
class  clang::insights::ContinueASTTransformer
 

Namespaces

 clang
 
 clang::insights
 

Macros

#define LAMBDA_SCOPE_HELPER(type)    LambdaScopeHandler lambdaScopeHandler{mLambdaStack, mOutputFormatHelper, LambdaCallerType::type};
 Convenience macro to create a LambdaScopeHandler on the stack. More...
 
#define CONDITIONAL_LAMBDA_SCOPE_HELPER(type, cond)
 The lambda scope helper is only created if cond is true. More...
 
#define BUILD_OPT_AND(name, param)   std::function name = [](param t) -> MyOptional<param>
 
#define BUILD_OPT_AND_O(name, param, ret)   std::function name = [](param t) -> MyOptional<ret>
 
#define SUPPORTED_DECL(type)
 
#define IGNORED_DECL   SUPPORTED_DECL
 
#define SUPPORTED_STMT(type)
 
#define IGNORED_STMT   SUPPORTED_STMT
 
#define CASE(K, retVal)    case BuiltinType::K: return retVal
 

Functions

 clang::insights::BUILD_OPT_AND (IsPointer, QualType)
 
 clang::insights::BUILD_OPT_AND (IsPOD, QualType)
 
 clang::insights::BUILD_OPT_AND_O (CanonicalType, const InitListExpr &, QualType)
 
static std::string clang::insights::AccessToStringWithColon (const AccessSpecifier &access)
 
static std::string_view clang::insights::GetCastName (const CastKind castKind, bool constnessChange=false)
 
static std::string_view clang::insights::GetTagDeclTypeName (const TagDecl &decl)
 
static std::string_view clang::insights::ArrowOrDot (bool isArrow)
 
template<typename T >
static T clang::insights::ValueOrDefault (bool b, T v)
 
template<typename T >
static T clang::insights::ValueOr (bool b, T val, T el)
 
static std::optional< std::string > clang::insights::GetFieldDeclNameForLambda (const FieldDecl &fieldDecl, const CXXRecordDecl &cxxRecordDecl)
 
static std::string_view clang::insights::GetStorageClassAsString (const StorageClass &sc)
 
static std::string clang::insights::GetStorageClassAsStringWithSpace (const StorageClass &sc)
 
static std::string clang::insights::GetQualifiers (const VarDecl &vd)
 
static std::string clang::insights::FormatVarTemplateSpecializationDecl (const Decl *decl, std::string &&defaultName)
 
int clang::insights::GetGlobalVtablePos (const CXXRecordDecl *record, const CXXRecordDecl *recordB)
 
void clang::insights::PushVtableEntry (const CXXRecordDecl *record, const CXXRecordDecl *recordB, VarDecl *decl)
 
static void clang::insights::PushGlobalVariable (const Expr *callExpr)
 
static void clang::insights::PushGlobalVariableDtor (const Expr *callExpr)
 
std::string clang::insights::EmitGlobalVariableCtors ()
 
static bool clang::insights::IsPrimaryTemplatePackExpansionExpr (const ParenListExpr *stmt)
 
static std::string clang::insights::GetTypeConstraintAsString (const TypeConstraint *typeConstraint)
 
static std::string_view clang::insights::Ellipsis (bool b)
 
static std::string_view clang::insights::EllipsisSpace (bool b)
 
static std::optional< std::pair< QualType, APValue > > clang::insights::EvaluateNTTPAsConstantExpr (const Expr *expr)
 Evaluates a potential NTTP as a constant expression. More...
 
template<typename... Args>
static bool clang::insights::IsStmtRequiringSemi (const Stmt *stmt)
 
static bool clang::insights::IsConstQualifiedType (QualType type)
 
static auto & clang::insights::GetRecordLayout (const RecordDecl *recordDecl)
 
auto clang::insights::GetSpaces (std::string::size_type offset)
 

Variables

template<typename T >
std::function clang::insights::Isa
 
static SmallVector< std::pair< std::pair< const CXXRecordDecl *, const CXXRecordDecl * >, VarDecl * >, 10 > clang::insights::gVtables {}
 
static SmallVector< Expr *, 10 > clang::insights::globalVarCtors {}
 
static SmallVector< Expr *, 10 > clang::insights::globalVarDtors {}
 

Macro Definition Documentation

◆ BUILD_OPT_AND

#define BUILD_OPT_AND (   name,
  param 
)    std::function name = [](param t) -> MyOptional<param>

Definition at line 45 of file CodeGenerator.cpp.

◆ BUILD_OPT_AND_O

#define BUILD_OPT_AND_O (   name,
  param,
  ret 
)    std::function name = [](param t) -> MyOptional<ret>

Definition at line 46 of file CodeGenerator.cpp.

◆ CASE

#define CASE (   K,
  retVal 
)     case BuiltinType::K: return retVal

◆ CONDITIONAL_LAMBDA_SCOPE_HELPER

#define CONDITIONAL_LAMBDA_SCOPE_HELPER (   type,
  cond 
)
Value:
std::optional<LambdaScopeHandler> lambdaScopeHandler; \
if(cond) { \
lambdaScopeHandler.emplace(mLambdaStack, mOutputFormatHelper, LambdaCallerType::type); \
}

The lambda scope helper is only created if cond is true.

Definition at line 34 of file CodeGenerator.cpp.

◆ IGNORED_DECL

#define IGNORED_DECL   SUPPORTED_DECL

◆ IGNORED_STMT

#define IGNORED_STMT   SUPPORTED_STMT

◆ LAMBDA_SCOPE_HELPER

#define LAMBDA_SCOPE_HELPER (   type)     LambdaScopeHandler lambdaScopeHandler{mLambdaStack, mOutputFormatHelper, LambdaCallerType::type};

Convenience macro to create a LambdaScopeHandler on the stack.

Definition at line 29 of file CodeGenerator.cpp.

◆ SUPPORTED_DECL

#define SUPPORTED_DECL (   type)
Value:
if(isa<type>(stmt)) { \
InsertArg(static_cast<const type*>(stmt)); \
return; \
}

◆ SUPPORTED_STMT

#define SUPPORTED_STMT (   type)
Value:
if(isa<type>(stmt)) { \
InsertArg(dyn_cast_or_null<type>(stmt)); \
return; \
}