Conscience Core
Classes | Functions | Variables
conscience_core::bridging::commands::metadata Namespace Reference

Classes

class  ClassASTConsumer
 
class  ClassASTVisitor
 
class  ClassFrontendAction
 
class  CscCommandMetadataBuilder
 
struct  CscCommandMetadataBuilderResult
 
struct  CscCommandMetadataBuilderResultItem
 
class  CscCommandMetadataCacheBuilder
 
struct  CscCommandMetadataObjects
 
struct  CscCommandMetadataParserContext
 
struct  CscConstructorDoc
 
struct  CscJsonCacheData
 

Functions

static unique_ptr< CscLoggerinitLogger ()
 
string getDeclaringHeaderFilePath (const clang::TypeDecl &objectType, clang::ASTContext &astContext)
 
static const CscCommandDataTypeNodeMetadatacreateMetadataForType (const clang::QualType &type, const string &name, const string &doc, CscCommandMetadataParserContext *context, bool useFieldsRatherThanConstructorForObjects, bool noFallbackOnObjectType)
 
string collectDocText (clang::comments::Comment *comment, string &docStr)
 
string collectDocText (clang::comments::Comment *comment)
 
vector< string > getParamTypesAsPureCode (const clang::CXXConstructorDecl *ctor, const clang::ASTContext &astContext)
 
string collectDocText (clang::comments::FullComment *fullComment)
 
static bool isStdString (const clang::QualType &originalType)
 
const CscEnumInfosgetEnumInfos (const clang::QualType &rawT, const CscCommandMetadataParserContext *context)
 
const CscEnumInfosgetEnumInfosByQualifiedName (const string &qualifiedName)
 
string qualifiedNameToSimpleName (const string &enumQualifiedName)
 
void createEnumInfos (const string &enumQualifiedName, const string &doc, const map< string, unsigned long long > &values, const map< string, string > &valuesDoc, const string &headerRelativePath)
 
CscConstructorDoc collectDoc (const clang::FunctionDecl *funcDecl, const clang::ASTContext &context)
 
vector< clang::QualType > extractClassTemplateArgQualType (const clang::QualType &T)
 
static pair< string, vector< clang::QualType > > getTemplateInfo (const clang::QualType &T)
 
static clang::QualType getStrippedType (clang::QualType T)
 Retire const, reference, pointer, etc. pour arriver au “noyau” du type. More...
 
string getSourceCode (const clang::DeclaratorDecl *ctorDecl, const clang::ASTContext &context)
 
string getFunctionSignature (const clang::CXXMethodDecl *methodDecl, clang::ASTContext &context)
 
optional< string > getStringLiteral (const clang::Expr *initExpr, clang::ASTContext &context)
 
clang::CXXConstructorDecl * getMostRelevantConstructor (clang::CXXRecordDecl *objectType, clang::ASTContext &context)
 
const CscCommandDataTypeMetadatacreateOrUpdateObjectMetadata (const string &headerFileRelativePath, const string &classQualifiedName, const string &classSimpleName, const string &doc, CscCommandMetadataParserContext *context, const vector< const CscCommandDataTypeNodeMetadata * > &paramsMetadata, bool registerTypeInCache)
 
const CscCommandDataTypeMetadatacreateMetaTypeForObjectTypeUsingConstructor (clang::CXXRecordDecl *objectType, CscCommandMetadataParserContext *context, bool registerTypeInCache=true)
 
const CscCommandDataTypeMetadatacreateMetaTypeForObjectTypeUsingPublicFieldsAndGetters (clang::CXXRecordDecl *objectType, CscCommandMetadataParserContext *context)
 
const CscCommandDataTypeMetadatacreateMetaTypeForObjectType (const clang::QualType &objectType, CscCommandMetadataParserContext *context)
 
const CscCommandDataTypeNodeMetadatacreateParamMetaTypeForObjectType (const string &name, const string &doc, const clang::QualType &objectType, CscCommandMetadataParserContext *context, bool useFieldsRatherThanConstructorForObjects, CscCommandPtrType ptrType)
 
static optional< clang::QualType > isSharedPtr (const clang::QualType &rawT)
 
static optional< clang::QualType > isUniquePtr (const clang::QualType &rawT)
 
static optional< clang::QualType > isSmartPtr (const clang::QualType &rawT)
 
bool isCppType (const clang::QualType &type)
 
const CscCommandDataTypeNodeMetadatacreateMetadataForPtrType (const clang::QualType &type, const string &name, const string &doc, CscCommandMetadataParserContext *context, bool useFieldsRatherThanConstructorForObjects, CscCommandPtrType ptrType)
 
bool isCommandClass (clang::CXXRecordDecl *decl)
 
const CscCommandResultMetadatabuildResultMetadata (const clang::CXXMethodDecl *executeMethod, CscCommandMetadataParserContext *context)
 
string normalizeWhitespace (const string &input)
 
void trimSpacesFrom (string &s, size_t start)
 
vector< string > getCompilationArgsForWindows (const vector< string > &requestedArgsPrefixes, bool adjustLlvmPaths)
 
vector< string > getCompilationArgsFromCompileCommandsJson (const vector< string > &requestedArgsPrefixes, bool adjustLlvmPaths)
 
static llvm::cl::OptionCategory clangToolCategory ("class-info-extractor options")
 
const CscCommandDataTypeNodeMetadatagetTypeNodeFromJson (const string &paramName, CscJsonObjectReader &paramJson)
 
CscCommandDataTypeMetadatagetTypeFromJson (CscJsonObjectReader &typeJson, optional< string > commandId={})
 
bool isAnyDependentTypeOrEnumInModifiedList (CscJsonObjectReader &typeJson, const vector< string > &modifiedEnumQualifiedNames, const vector< string > &modifiedTypeQualifiedNames)
 
CscJsonObjectloadJsonCache (const fs::path &cacheFile)
 
CscJsonObjectgetJsonForTypeNode (const CscCommandDataTypeNodeMetadata *typeNode, CscJsonCacheData *cacheData)
 
void setHeaderRelativePathInJson (string &relativePath, CscJsonObject &json, const string &commandId)
 
CscJsonObjectgetJsonForType (const string &commandId, const CscCommandDataTypeMetadata *typeMetadata, CscJsonCacheData *cacheData=nullptr)
 

Variables

static bool CLANG_DEBUG_AND_WARNINGS = false
 
static string COMMAND_BASE_CLASS_QUALIFIED_NAME = "conscience_core::bridging::commands::CscCommand"
 
static string COMMAND_EXECUTE_METHOD_NAME = "doExecute"
 
static string CACHE_KEY_TYPES = "types"
 
static string CACHE_KEY_COMMANDS = "commands"
 
static string CACHE_KEY_ENUMS = "enums"
 
static auto logger = initLogger()
 
static map< string, const CscEnumInfos * > enumInfos
 
static const string COMMAND_RESULT_CLASS_PREFIX = "CscCommandExecutionResult"
 
static const vector< string > ignoredCommandFilenames
 
static const string CORE_COMMANDS_DIR_RELATIVE_PATH = "Bridging/EnvironmentInteractionCommands"
 
static const vector< string > COMPILATION_ARGS_PREFIX_ALL = {"-resource-dir", "-isysroot", "-isystem", "-I", "-D", "-mmacosx", "-std", "-arch"}
 

Detailed Description

Conscience's Commands metadata generation module -> please see CscCommandMetadataBuilder doc

See also
CscCommandMetadataBuilder

Function Documentation

◆ buildResultMetadata()

const CscCommandResultMetadata* conscience_core::bridging::commands::metadata::buildResultMetadata ( const clang::CXXMethodDecl *  executeMethod,
CscCommandMetadataParserContext context 
)

◆ clangToolCategory()

static llvm::cl::OptionCategory conscience_core::bridging::commands::metadata::clangToolCategory ( "class-info-extractor options"  )
static

◆ collectDoc()

CscConstructorDoc conscience_core::bridging::commands::metadata::collectDoc ( const clang::FunctionDecl *  funcDecl,
const clang::ASTContext &  context 
)

◆ collectDocText() [1/3]

string conscience_core::bridging::commands::metadata::collectDocText ( clang::comments::Comment *  comment)
inline

◆ collectDocText() [2/3]

string conscience_core::bridging::commands::metadata::collectDocText ( clang::comments::Comment *  comment,
string &  docStr 
)

◆ collectDocText() [3/3]

string conscience_core::bridging::commands::metadata::collectDocText ( clang::comments::FullComment *  fullComment)
inline

◆ createEnumInfos()

void conscience_core::bridging::commands::metadata::createEnumInfos ( const string &  enumQualifiedName,
const string &  doc,
const map< string, unsigned long long > &  values,
const map< string, string > &  valuesDoc,
const string &  headerRelativePath 
)
inline

◆ createMetadataForPtrType()

const CscCommandDataTypeNodeMetadata* conscience_core::bridging::commands::metadata::createMetadataForPtrType ( const clang::QualType &  type,
const string &  name,
const string &  doc,
CscCommandMetadataParserContext context,
bool  useFieldsRatherThanConstructorForObjects,
CscCommandPtrType  ptrType 
)
inline

◆ createMetadataForType()

static const CscCommandDataTypeNodeMetadata * conscience_core::bridging::commands::metadata::createMetadataForType ( const clang::QualType &  type,
const string &  name,
const string &  doc,
CscCommandMetadataParserContext context,
bool  useFieldsRatherThanConstructorForObjects,
bool  noFallbackOnObjectType 
)
static
Parameters
noFallbackOnObjectTypetechnical detail -> in some cases we do not want to fallback on an generic object type detection (clang considers everythign as an object in the end..)

◆ createMetaTypeForObjectType()

const CscCommandDataTypeMetadata* conscience_core::bridging::commands::metadata::createMetaTypeForObjectType ( const clang::QualType &  objectType,
CscCommandMetadataParserContext context 
)
inline

◆ createMetaTypeForObjectTypeUsingConstructor()

const CscCommandDataTypeMetadata* conscience_core::bridging::commands::metadata::createMetaTypeForObjectTypeUsingConstructor ( clang::CXXRecordDecl *  objectType,
CscCommandMetadataParserContext context,
bool  registerTypeInCache = true 
)
inline

◆ createMetaTypeForObjectTypeUsingPublicFieldsAndGetters()

const CscCommandDataTypeMetadata* conscience_core::bridging::commands::metadata::createMetaTypeForObjectTypeUsingPublicFieldsAndGetters ( clang::CXXRecordDecl *  objectType,
CscCommandMetadataParserContext context 
)
inline

◆ createOrUpdateObjectMetadata()

const CscCommandDataTypeMetadata* conscience_core::bridging::commands::metadata::createOrUpdateObjectMetadata ( const string &  headerFileRelativePath,
const string &  classQualifiedName,
const string &  classSimpleName,
const string &  doc,
CscCommandMetadataParserContext context,
const vector< const CscCommandDataTypeNodeMetadata * > &  paramsMetadata,
bool  registerTypeInCache 
)
inline

◆ createParamMetaTypeForObjectType()

const CscCommandDataTypeNodeMetadata* conscience_core::bridging::commands::metadata::createParamMetaTypeForObjectType ( const string &  name,
const string &  doc,
const clang::QualType &  objectType,
CscCommandMetadataParserContext context,
bool  useFieldsRatherThanConstructorForObjects,
CscCommandPtrType  ptrType 
)
inline

◆ extractClassTemplateArgQualType()

vector<clang::QualType> conscience_core::bridging::commands::metadata::extractClassTemplateArgQualType ( const clang::QualType &  T)

◆ getCompilationArgsForWindows()

vector<string> conscience_core::bridging::commands::metadata::getCompilationArgsForWindows ( const vector< string > &  requestedArgsPrefixes,
bool  adjustLlvmPaths 
)

◆ getCompilationArgsFromCompileCommandsJson()

CSC_DLL_IMPORTEXPORT vector< string > conscience_core::bridging::commands::metadata::getCompilationArgsFromCompileCommandsJson ( const vector< string > &  requestedArgsPrefixes,
bool  adjustLlvmPaths 
)

◆ getDeclaringHeaderFilePath()

string conscience_core::bridging::commands::metadata::getDeclaringHeaderFilePath ( const clang::TypeDecl &  objectType,
clang::ASTContext &  astContext 
)
inline

◆ getEnumInfos()

const CscEnumInfos* conscience_core::bridging::commands::metadata::getEnumInfos ( const clang::QualType &  rawT,
const CscCommandMetadataParserContext context 
)

◆ getEnumInfosByQualifiedName()

const CscEnumInfos* conscience_core::bridging::commands::metadata::getEnumInfosByQualifiedName ( const string &  qualifiedName)

◆ getFunctionSignature()

string conscience_core::bridging::commands::metadata::getFunctionSignature ( const clang::CXXMethodDecl *  methodDecl,
clang::ASTContext &  context 
)

◆ getJsonForType()

CscJsonObject* conscience_core::bridging::commands::metadata::getJsonForType ( const string &  commandId,
const CscCommandDataTypeMetadata typeMetadata,
CscJsonCacheData cacheData = nullptr 
)
inline
Parameters
commandIdcommand ID in which context this type was resolved. For user custom commands, type can be user declared. We save this commandId in json cache just for this case∆

◆ getJsonForTypeNode()

CscJsonObject* conscience_core::bridging::commands::metadata::getJsonForTypeNode ( const CscCommandDataTypeNodeMetadata typeNode,
CscJsonCacheData cacheData 
)
inline

◆ getMostRelevantConstructor()

clang::CXXConstructorDecl* conscience_core::bridging::commands::metadata::getMostRelevantConstructor ( clang::CXXRecordDecl *  objectType,
clang::ASTContext &  context 
)
inline

◆ getParamTypesAsPureCode()

vector<string> conscience_core::bridging::commands::metadata::getParamTypesAsPureCode ( const clang::CXXConstructorDecl *  ctor,
const clang::ASTContext &  astContext 
)

◆ getSourceCode()

string conscience_core::bridging::commands::metadata::getSourceCode ( const clang::DeclaratorDecl *  ctorDecl,
const clang::ASTContext &  context 
)

◆ getStringLiteral()

optional<string> conscience_core::bridging::commands::metadata::getStringLiteral ( const clang::Expr *  initExpr,
clang::ASTContext &  context 
)

◆ getStrippedType()

static clang::QualType conscience_core::bridging::commands::metadata::getStrippedType ( clang::QualType  T)
static

Retire const, reference, pointer, etc. pour arriver au “noyau” du type.

◆ getTemplateInfo()

static pair<string, vector<clang::QualType> > conscience_core::bridging::commands::metadata::getTemplateInfo ( const clang::QualType &  T)
static

◆ getTypeFromJson()

CscCommandDataTypeMetadata* conscience_core::bridging::commands::metadata::getTypeFromJson ( CscJsonObjectReader typeJson,
optional< string >  commandId = {} 
)

◆ getTypeNodeFromJson()

const CscCommandDataTypeNodeMetadata* conscience_core::bridging::commands::metadata::getTypeNodeFromJson ( const string &  paramName,
CscJsonObjectReader paramJson 
)

◆ initLogger()

static unique_ptr<CscLogger> conscience_core::bridging::commands::metadata::initLogger ( )
inlinestatic

◆ isAnyDependentTypeOrEnumInModifiedList()

bool conscience_core::bridging::commands::metadata::isAnyDependentTypeOrEnumInModifiedList ( CscJsonObjectReader typeJson,
const vector< string > &  modifiedEnumQualifiedNames,
const vector< string > &  modifiedTypeQualifiedNames 
)
inline

◆ isCommandClass()

bool conscience_core::bridging::commands::metadata::isCommandClass ( clang::CXXRecordDecl *  decl)

◆ isCppType()

bool conscience_core::bridging::commands::metadata::isCppType ( const clang::QualType &  type)
inline

◆ isSharedPtr()

static optional<clang::QualType> conscience_core::bridging::commands::metadata::isSharedPtr ( const clang::QualType &  rawT)
static

◆ isSmartPtr()

static optional<clang::QualType> conscience_core::bridging::commands::metadata::isSmartPtr ( const clang::QualType &  rawT)
static

◆ isStdString()

static bool conscience_core::bridging::commands::metadata::isStdString ( const clang::QualType &  originalType)
static

◆ isUniquePtr()

static optional<clang::QualType> conscience_core::bridging::commands::metadata::isUniquePtr ( const clang::QualType &  rawT)
static

◆ loadJsonCache()

CscJsonObject* conscience_core::bridging::commands::metadata::loadJsonCache ( const fs::path &  cacheFile)
inline
Returns
json cache from file with interpolation

◆ normalizeWhitespace()

string conscience_core::bridging::commands::metadata::normalizeWhitespace ( const string &  input)

◆ qualifiedNameToSimpleName()

string conscience_core::bridging::commands::metadata::qualifiedNameToSimpleName ( const string &  enumQualifiedName)
inline

◆ setHeaderRelativePathInJson()

void conscience_core::bridging::commands::metadata::setHeaderRelativePathInJson ( string &  relativePath,
CscJsonObject json,
const string &  commandId 
)
inline

◆ trimSpacesFrom()

void conscience_core::bridging::commands::metadata::trimSpacesFrom ( string &  s,
size_t  start 
)

Removes contiguous spaces starting at a given index until a non-space character or end of string.

Variable Documentation

◆ CACHE_KEY_COMMANDS

string conscience_core::bridging::commands::metadata::CACHE_KEY_COMMANDS = "commands"
inlinestatic

◆ CACHE_KEY_ENUMS

string conscience_core::bridging::commands::metadata::CACHE_KEY_ENUMS = "enums"
inlinestatic

◆ CACHE_KEY_TYPES

string conscience_core::bridging::commands::metadata::CACHE_KEY_TYPES = "types"
inlinestatic

◆ CLANG_DEBUG_AND_WARNINGS

bool conscience_core::bridging::commands::metadata::CLANG_DEBUG_AND_WARNINGS = false
inlinestatic

◆ COMMAND_BASE_CLASS_QUALIFIED_NAME

string conscience_core::bridging::commands::metadata::COMMAND_BASE_CLASS_QUALIFIED_NAME = "conscience_core::bridging::commands::CscCommand"
inlinestatic

◆ COMMAND_EXECUTE_METHOD_NAME

string conscience_core::bridging::commands::metadata::COMMAND_EXECUTE_METHOD_NAME = "doExecute"
inlinestatic

◆ COMMAND_RESULT_CLASS_PREFIX

const string conscience_core::bridging::commands::metadata::COMMAND_RESULT_CLASS_PREFIX = "CscCommandExecutionResult"
static

◆ COMPILATION_ARGS_PREFIX_ALL

const vector<string> conscience_core::bridging::commands::metadata::COMPILATION_ARGS_PREFIX_ALL = {"-resource-dir", "-isysroot", "-isystem", "-I", "-D", "-mmacosx", "-std", "-arch"}
static

◆ CORE_COMMANDS_DIR_RELATIVE_PATH

const string conscience_core::bridging::commands::metadata::CORE_COMMANDS_DIR_RELATIVE_PATH = "Bridging/EnvironmentInteractionCommands"
inlinestatic

◆ enumInfos

map<string, const CscEnumInfos *> conscience_core::bridging::commands::metadata::enumInfos
static

◆ ignoredCommandFilenames

const vector<string> conscience_core::bridging::commands::metadata::ignoredCommandFilenames
static
Initial value:
= {
"CommandParamsSpec.h",
"CommandHelper.h",
"CscCommandsProcessor.h",
"FunctionCommandWrapper.h",
"CommandsAll.h",
"CscCommandMetadataBuilder.h",
"CommandStateManager.h",
"CommandCommons.h",
"Command.h"}

◆ logger

auto conscience_core::bridging::commands::metadata::logger = initLogger()
static