MCPcopy Create free account
hub / github.com/andreasfertig/cppinsights / main

Function main

Insights.cpp:339–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337//-----------------------------------------------------------------------------
338
339int main(int argc, const char** argv)
340{
341 // Headers go first
342 using enum GlobalInserts;
343 AddGLobalInsertMapEntry(HeaderNew,
344 "#include <new> // for thread-safe static's placement new\n#include <stdint.h> // for "
345 "uint64_t under Linux/GCC"sv);
346 AddGLobalInsertMapEntry(HeaderException, "#include <exception> // for noexcept transformation"sv);
347 AddGLobalInsertMapEntry(HeaderUtility, "#include <utility> // std::move"sv);
348 AddGLobalInsertMapEntry(HeaderStddef, "#include <stddef.h> // NULL and more"sv);
349 AddGLobalInsertMapEntry(HeaderAssert, "#include <assert.h> // _Static_assert"sv);
350 AddGLobalInsertMapEntry(HeaderStdlib, "#include <stdlib.h> // abort"sv);
351
352 // Now all the forward declared functions
353 AddGLobalInsertMapEntry(FuncCxaStart, "void __cxa_start(void);"sv);
354 AddGLobalInsertMapEntry(FuncCxaAtExit, "void __cxa_atexit(void);"sv);
355 AddGLobalInsertMapEntry(FuncMalloc, "void* malloc(unsigned int);"sv);
356 AddGLobalInsertMapEntry(FuncFree, R"(extern "C" void free(void*);)"sv);
357 AddGLobalInsertMapEntry(FuncMemset, R"(extern "C" void* memset(void*, int, unsigned int);)"sv);
358 AddGLobalInsertMapEntry(FuncMemcpy, R"(void* memcpy(void*, const void*, unsigned int);)"sv);
359 AddGLobalInsertMapEntry(
360 FuncCxaVecNew,
361 R"(extern "C" void* __cxa_vec_new(void*, unsigned int, unsigned int, unsigned int, void* (*)(void*), void* (*)(void*));)"sv);
362 AddGLobalInsertMapEntry(
363 FuncCxaVecCtor,
364 R"(extern "C" void* __cxa_vec_ctor(void*, unsigned int, unsigned int, unsigned int, void* (*)(void*), void* (*)(void*));)"sv);
365 AddGLobalInsertMapEntry(
366 FuncCxaVecDel,
367 R"(extern "C" void __cxa_vec_delete(void *, unsigned int, unsigned int, void* (*destructor)(void *) );)"sv);
368 AddGLobalInsertMapEntry(
369 FuncCxaVecDtor,
370 R"(extern "C" void __cxa_vec_dtor(void *, unsigned int, unsigned int, void* (*destructor)(void *) );)"sv);
371 AddGLobalInsertMapEntry(FuncVtableStruct, R"(typedef int (*__vptp)();
372
373struct __mptr
374{
375 short d;
376 short i;
377 __vptp f;
378};
379
380extern struct __mptr* __vtbl_array[];
381)"sv);
382 AddGLobalInsertMapEntry(FuncCxaPureVirtual, R"(extern "C" void __cxa_pure_virtual() { abort(); })");
383
384 llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
385 llvm::cl::SetVersionPrinter(&PrintVersion);
386
387 auto opExpected = CommonOptionsParser::create(argc, argv, gInsightCategory);
388
389 if(auto err = opExpected.takeError()) {
390 if(gAutoComplete) {
391#define INSIGHTS_OPT(option, name, deflt, description, category) llvm::outs() << "--" << option << " ";
392
393#include "InsightsOptions.def"
394
395 return 0;
396 } else {

Callers

nothing calls this directly

Calls 7

AddGLobalInsertMapEntryFunction · 0.85
ErrorFunction · 0.85
EnableGlobalInsertFunction · 0.85
createFunction · 0.50
getMethod · 0.45
sizeMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected