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)
|
|| isXCommand(actionResult, resultValue)
|
||||||
|| isqCommand() || isUCommand(actionResult) || isICommand()
|
|| isqCommand() || isUCommand(actionResult) || isICommand()
|
||||||
|| isOCommand() || israwInputCommand() || isprintASTCommand()
|
|| isOCommand() || israwInputCommand() || isprintASTCommand()
|
||||||
|| isdynamicExtensionsCommand()
|
|| isdynamicExtensionsCommand() || ishelpCommand() || isfileExCommand()
|
||||||
|| ishelpCommand() || isfileExCommand() || isfilesCommand() || isClassCommand()
|
|| isfilesCommand() || isClassCommand() || isgCommand()
|
||||||
|| isgCommand() || isTypedefCommand() || isprintIRCommand()
|
|| isTypedefCommand() || isprintIRCommand()
|
||||||
|| isShellCommand(actionResult, resultValue)
|
|| isShellCommand(actionResult, resultValue) || isstoreStateCommand()
|
||||||
|| isstoreStateCommand() || iscompareStateCommand() || isundoCommand()
|
|| iscompareStateCommand() || isstatsCommand() || isundoCommand()
|
||||||
|| isRedirectCommand(actionResult);
|
|| isRedirectCommand(actionResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,6 +404,21 @@ namespace cling {
|
|||||||
return false;
|
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() {
|
bool MetaParser::isundoCommand() {
|
||||||
if (getCurTok().is(tok::ident) &&
|
if (getCurTok().is(tok::ident) &&
|
||||||
getCurTok().getIdent().equals("undo")) {
|
getCurTok().getIdent().equals("undo")) {
|
||||||
|
@ -31,7 +31,7 @@ namespace cling {
|
|||||||
// PrintASTCommand | DynamicExtensionsCommand | HelpCommand |
|
// PrintASTCommand | DynamicExtensionsCommand | HelpCommand |
|
||||||
// FileExCommand | FilesCommand | ClassCommand |
|
// FileExCommand | FilesCommand | ClassCommand |
|
||||||
// GCommand | PrintIRCommand | StoreStateCommand |
|
// GCommand | PrintIRCommand | StoreStateCommand |
|
||||||
// CompareStateCommand | undoCommand
|
// CompareStateCommand | StatsCommand | undoCommand
|
||||||
// LCommand := 'L' FilePath
|
// LCommand := 'L' FilePath
|
||||||
// >Command := '>' FilePath
|
// >Command := '>' FilePath
|
||||||
// qCommand := 'q'
|
// qCommand := 'q'
|
||||||
@ -44,6 +44,7 @@ namespace cling {
|
|||||||
// PrintIRCommand := 'printIR' [Constant]
|
// PrintIRCommand := 'printIR' [Constant]
|
||||||
// StoreStateCommand := 'storeState' "Ident"
|
// StoreStateCommand := 'storeState' "Ident"
|
||||||
// CompareStateCommand := 'compareState' "Ident"
|
// CompareStateCommand := 'compareState' "Ident"
|
||||||
|
// StatsCommand := 'stats' ['ast']
|
||||||
// undoCommand := 'undo' [Constant]
|
// undoCommand := 'undo' [Constant]
|
||||||
// DynamicExtensionsCommand := 'dynamicExtensions' [Constant]
|
// DynamicExtensionsCommand := 'dynamicExtensions' [Constant]
|
||||||
// HelpCommand := 'help'
|
// HelpCommand := 'help'
|
||||||
@ -93,6 +94,7 @@ namespace cling {
|
|||||||
bool isprintIRCommand();
|
bool isprintIRCommand();
|
||||||
bool isstoreStateCommand();
|
bool isstoreStateCommand();
|
||||||
bool iscompareStateCommand();
|
bool iscompareStateCommand();
|
||||||
|
bool isstatsCommand();
|
||||||
bool isundoCommand();
|
bool isundoCommand();
|
||||||
bool isdynamicExtensionsCommand();
|
bool isdynamicExtensionsCommand();
|
||||||
bool ishelpCommand();
|
bool ishelpCommand();
|
||||||
|
@ -154,6 +154,12 @@ namespace cling {
|
|||||||
m_Interpreter.compareInterpreterState(name);
|
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*/)
|
void MetaSema::actOndynamicExtensionsCommand(SwitchMode mode/* = kToggle*/)
|
||||||
const {
|
const {
|
||||||
if (mode == kToggle) {
|
if (mode == kToggle) {
|
||||||
|
@ -145,6 +145,12 @@ namespace cling {
|
|||||||
///
|
///
|
||||||
void actOncompareStateCommand(llvm::StringRef name) const;
|
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
|
///\brief Switches on/off the experimental dynamic extensions (dynamic
|
||||||
/// scopes) and late binding.
|
/// scopes) and late binding.
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user