Implement .stats command printing out statistics about internal ADT
This commit is contained in:
parent
03010a5af1
commit
943350a7c2
@ -112,11 +112,11 @@ namespace cling {
|
||||
|| isXCommand(actionResult, resultValue)
|
||||
|| isqCommand() || isUCommand(actionResult) || isICommand()
|
||||
|| isOCommand() || israwInputCommand() || isprintASTCommand()
|
||||
|| isdynamicExtensionsCommand()
|
||||
|| ishelpCommand() || isfileExCommand() || isfilesCommand() || isClassCommand()
|
||||
|| isgCommand() || isTypedefCommand() || isprintIRCommand()
|
||||
|| isShellCommand(actionResult, resultValue)
|
||||
|| isstoreStateCommand() || iscompareStateCommand() || isundoCommand()
|
||||
|| isdynamicExtensionsCommand() || ishelpCommand() || isfileExCommand()
|
||||
|| isfilesCommand() || isClassCommand() || isgCommand()
|
||||
|| isTypedefCommand() || isprintIRCommand()
|
||||
|| isShellCommand(actionResult, resultValue) || isstoreStateCommand()
|
||||
|| iscompareStateCommand() || isstatsCommand() || isundoCommand()
|
||||
|| isRedirectCommand(actionResult);
|
||||
}
|
||||
|
||||
@ -404,6 +404,21 @@ namespace cling {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MetaParser::isstatsCommand() {
|
||||
if (getCurTok().is(tok::ident) &&
|
||||
getCurTok().getIdent().equals("stats")) {
|
||||
consumeToken();
|
||||
skipWhitespace();
|
||||
if (!getCurTok().is(tok::ident))
|
||||
return false; // FIXME: Issue proper diagnostics
|
||||
std::string ident = getCurTok().getIdent();
|
||||
consumeToken();
|
||||
m_Actions->actOnstatsCommand(ident);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MetaParser::isundoCommand() {
|
||||
if (getCurTok().is(tok::ident) &&
|
||||
getCurTok().getIdent().equals("undo")) {
|
||||
|
@ -31,7 +31,7 @@ namespace cling {
|
||||
// PrintASTCommand | DynamicExtensionsCommand | HelpCommand |
|
||||
// FileExCommand | FilesCommand | ClassCommand |
|
||||
// GCommand | PrintIRCommand | StoreStateCommand |
|
||||
// CompareStateCommand | undoCommand
|
||||
// CompareStateCommand | StatsCommand | undoCommand
|
||||
// LCommand := 'L' FilePath
|
||||
// >Command := '>' FilePath
|
||||
// qCommand := 'q'
|
||||
@ -44,6 +44,7 @@ namespace cling {
|
||||
// PrintIRCommand := 'printIR' [Constant]
|
||||
// StoreStateCommand := 'storeState' "Ident"
|
||||
// CompareStateCommand := 'compareState' "Ident"
|
||||
// StatsCommand := 'stats' ['ast']
|
||||
// undoCommand := 'undo' [Constant]
|
||||
// DynamicExtensionsCommand := 'dynamicExtensions' [Constant]
|
||||
// HelpCommand := 'help'
|
||||
@ -93,6 +94,7 @@ namespace cling {
|
||||
bool isprintIRCommand();
|
||||
bool isstoreStateCommand();
|
||||
bool iscompareStateCommand();
|
||||
bool isstatsCommand();
|
||||
bool isundoCommand();
|
||||
bool isdynamicExtensionsCommand();
|
||||
bool ishelpCommand();
|
||||
|
@ -154,6 +154,12 @@ namespace cling {
|
||||
m_Interpreter.compareInterpreterState(name);
|
||||
}
|
||||
|
||||
void MetaSema::actOnstatsCommand(llvm::StringRef name) const {
|
||||
if (name.equals("ast")) {
|
||||
m_Interpreter.getCI()->getSema().getASTContext().PrintStats();
|
||||
}
|
||||
}
|
||||
|
||||
void MetaSema::actOndynamicExtensionsCommand(SwitchMode mode/* = kToggle*/)
|
||||
const {
|
||||
if (mode == kToggle) {
|
||||
|
@ -145,6 +145,12 @@ namespace cling {
|
||||
///
|
||||
void actOncompareStateCommand(llvm::StringRef name) const;
|
||||
|
||||
///\brief Show stats for various internal data structures.
|
||||
///
|
||||
///\param[in] name - Name of the structure.
|
||||
///
|
||||
void actOnstatsCommand(llvm::StringRef name) const;
|
||||
|
||||
///\brief Switches on/off the experimental dynamic extensions (dynamic
|
||||
/// scopes) and late binding.
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user