Classes | Namespaces | Macros | Typedefs | Functions | Variables
Insights.cpp File Reference
#include <array>
#include "clang/AST/ASTContext.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Rewrite/Core/Rewriter.h"
#include "clang/Tooling/CommonOptionsParser.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/raw_ostream.h"
#include <vector>
#include "CodeGenerator.h"
#include "DPrint.h"
#include "Insights.h"
#include "version.h"
#include "InsightsOptions.def"
#include "clang/Basic/Version.h"
Include dependency graph for Insights.cpp:

Go to the source code of this file.

Classes

class  FindIncludes
 
class  CppInsightASTConsumer
 
class  CppInsightFrontendAction
 

Namespaces

 clang
 
 clang::insights
 

Macros

#define INSIGHTS_OPT(option, name, deflt, description, category)
 

Typedefs

using clang::insights::GlobalInsertMap = std::pair< bool, std::string_view >
 
using IncludeData = std::pair< const SourceLocation, std::string >
 

Functions

const InsightsOptionsGetInsightsOptions ()
 Get the global C++ Insights options. More...
 
InsightsOptionsGetInsightsOptionsRW ()
 
static llvm::cl::OptionCategory gInsightCategory ("Insights"sv)
 
static llvm::cl::OptionCategory gInsightEduCategory ("Insights-Educational"sv, "This transformations are only for education purposes. The resulting code most likely does not compile."sv)
 
static llvm::cl::opt< bool > gStdinMode ("stdin", llvm::cl::desc("Read the input from <stdin>."sv), llvm::cl::init(false), llvm::cl::cat(gInsightCategory))
 
static llvm::cl::opt< bool > gUseLibCpp ("use-libc++", llvm::cl::desc("Use libc++."sv), llvm::cl::init(false), llvm::cl::cat(gInsightCategory))
 
const ASTContext & GetGlobalAST ()
 Get access to the ASTContext. More...
 
const CompilerInstance & GetGlobalCI ()
 Get access to the CompilerInstance. More...
 
std::string clang::insights::EmitGlobalVariableCtors ()
 
void clang::insights::AddGLobalInsertMapEntry (GlobalInserts idx, std::string_view value)
 
void clang::insights::EnableGlobalInsert (GlobalInserts idx)
 
static void PrintVersion (raw_ostream &ostream)
 
int main (int argc, const char **argv)
 

Variables

static InsightsOptions gInsightsOptions {}
 
static const ASTContext * gAST {}
 
static const CompilerInstance * gCI {}
 
static constinit std::array< GlobalInsertMap, static_cast< size_t >GlobalInserts::MAX)> clang::insights::gGlobalInserts {}
 

Macro Definition Documentation

◆ INSIGHTS_OPT

#define INSIGHTS_OPT (   option,
  name,
  deflt,
  description,
  category 
)
Value:
static llvm::cl::opt<bool, true> g##name(option, \
llvm::cl::desc(std::string_view{description}), \
llvm::cl::NotHidden, \
llvm::cl::location(gInsightsOptions.name), \
llvm::cl::init(deflt), \
llvm::cl::cat(category));
static InsightsOptions gInsightsOptions
Definition: Insights.cpp:34

Definition at line 68 of file Insights.cpp.

Typedef Documentation

◆ IncludeData

using IncludeData = std::pair<const SourceLocation, std::string>

Definition at line 113 of file Insights.cpp.

Function Documentation

◆ GetGlobalAST()

const ASTContext& GetGlobalAST ( )

Get access to the ASTContext.

Definition at line 81 of file Insights.cpp.

References gAST.

Referenced by clang::insights::asthelpers::_mkDeclStmt(), clang::insights::asthelpers::AccessMember(), clang::insights::asthelpers::ArraySubscript(), clang::insights::asthelpers::Bool(), clang::insights::asthelpers::Break(), clang::insights::BUILD_OPT_AND(), clang::insights::BuildSuspendVarName(), clang::insights::asthelpers::Call(), clang::insights::asthelpers::CallMemberFun(), clang::insights::asthelpers::Case(), clang::insights::asthelpers::CastLToRValue(), clang::insights::asthelpers::Catch(), clang::insights::asthelpers::Comment(), clang::insights::asthelpers::ContantArrayTy(), clang::insights::asthelpers::Equal(), clang::insights::EvaluateNTTPAsConstantExpr(), clang::insights::asthelpers::Function(), clang::insights::asthelpers::FunctionBase(), clang::insights::GetRecordLayout(), clang::insights::GetTemporaryName(), clang::insights::GetType(), clang::insights::asthelpers::Goto(), clang::insights::CodeGenerator::HandleLocalStaticNonTrivialClass(), clang::insights::asthelpers::If(), clang::insights::asthelpers::InitList(), clang::insights::CoroutinesCodeGenerator::InsertArg(), clang::insights::CfrontCodeGenerator::InsertArg(), clang::insights::CodeGenerator::InsertAttribute(), clang::insights::CoroutinesCodeGenerator::InsertCoroutine(), clang::insights::CfrontCodeGenerator::InsertCXXMethodDecl(), clang::insights::CodeGenerator::InsertTemplateArg(), clang::insights::CodeGenerator::InsertTemplateArgsObjectParam(), clang::insights::CodeGenerator::InsertTemplateParameters(), clang::insights::asthelpers::Int32(), clang::insights::asthelpers::Label(), clang::insights::asthelpers::mkBinaryOperator(), clang::insights::asthelpers::mkCompoundStmt(), clang::insights::asthelpers::mkDeclRefExpr(), clang::insights::asthelpers::mkFieldDecl(), clang::insights::asthelpers::mkLabelDecl(), clang::insights::asthelpers::mkNullStmt(), clang::insights::asthelpers::mkStdFunctionDecl(), clang::insights::asthelpers::mkUnaryOperator(), clang::insights::asthelpers::New(), clang::insights::asthelpers::Parameter(), clang::insights::asthelpers::Paren(), clang::insights::ProcessFields(), clang::insights::asthelpers::Ptr(), clang::insights::asthelpers::ReinterpretCast(), clang::insights::asthelpers::Return(), clang::insights::asthelpers::Sizeof(), clang::insights::asthelpers::StaticCast(), clang::insights::asthelpers::Struct(), clang::insights::asthelpers::Switch(), clang::insights::TemporaryDeclFinder::TemporaryDeclFinder(), clang::insights::asthelpers::Throw(), clang::insights::asthelpers::Try(), clang::insights::asthelpers::Typedef(), clang::insights::asthelpers::Variable(), clang::insights::CoroutineASTTransformer::VisitCoroutineBodyStmt(), clang::insights::TemporaryDeclFinder::VisitCXXTemporaryObjectExpr(), and clang::insights::asthelpers::VoidTy().

◆ GetGlobalCI()

const CompilerInstance& GetGlobalCI ( )

Get access to the CompilerInstance.

Definition at line 88 of file Insights.cpp.

References gCI.

Referenced by clang::insights::HasOverload().

◆ GetInsightsOptions()

const InsightsOptions& GetInsightsOptions ( )

◆ GetInsightsOptionsRW()

InsightsOptions& GetInsightsOptionsRW ( )

Definition at line 43 of file Insights.cpp.

References gInsightsOptions.

◆ gInsightCategory()

static llvm::cl::OptionCategory gInsightCategory ( "Insights"  sv)
static

Referenced by main().

◆ gInsightEduCategory()

static llvm::cl::OptionCategory gInsightEduCategory ( "Insights-Educational"  sv,
"This transformations are only for education purposes. The resulting code most likely does not compile."  sv 
)
static

◆ gStdinMode()

static llvm::cl::opt<bool> gStdinMode ( "stdin"  ,
llvm::cl::desc("Read the input from <stdin>."sv)  ,
llvm::cl::init(false)  ,
llvm::cl::cat(gInsightCategory  
)
static

Referenced by main().

◆ gUseLibCpp()

static llvm::cl::opt<bool> gUseLibCpp ( "use-libc++"  ,
llvm::cl::desc("Use libc++."sv)  ,
llvm::cl::init(false)  ,
llvm::cl::cat(gInsightCategory  
)
static

Referenced by main().

◆ main()

int main ( int  argc,
const char **  argv 
)

◆ PrintVersion()

static void PrintVersion ( raw_ostream &  ostream)
static

Definition at line 335 of file Insights.cpp.

Referenced by main().

Variable Documentation

◆ gAST

const ASTContext* gAST {}
static

Definition at line 80 of file Insights.cpp.

Referenced by GetGlobalAST(), and CppInsightASTConsumer::HandleTranslationUnit().

◆ gCI

const CompilerInstance* gCI {}
static

Definition at line 87 of file Insights.cpp.

Referenced by CppInsightFrontendAction::CreateASTConsumer(), and GetGlobalCI().

◆ gInsightsOptions

InsightsOptions gInsightsOptions {}
static