grimar created this revision.
grimar added reviewers: clayborg, LLDB.
Currently, lldb fails to build with the following errors when MSVS update 3 is
used:
> fatal error C1001: An internal error has occurred in the compiler.
> (compiler file 'msc1.cpp', line 1468)
> To work around this problem, try simplifying or changing the program near
> the locations listed above.
Seems it is relative with the `constexpr`. This patch simplifies the code a bit
and allows it to compile and run.
https://reviews.llvm.org/D55995
Files:
include/lldb/Target/Target.h
source/Commands/CommandObjectBreakpointCommand.cpp
source/Commands/CommandObjectCommands.cpp
source/Commands/CommandObjectExpression.cpp
source/Commands/CommandObjectTarget.cpp
source/Commands/CommandObjectThread.cpp
source/Commands/CommandObjectWatchpointCommand.cpp
source/Core/Debugger.cpp
source/Interpreter/OptionGroupWatchpoint.cpp
source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
source/Target/Target.cpp
Index: source/Target/Target.cpp
===================================================================
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -63,8 +63,6 @@
using namespace lldb;
using namespace lldb_private;
-constexpr std::chrono::milliseconds EvaluateExpressionOptions::default_timeout;
-
Target::Arch::Arch(const ArchSpec &spec)
: m_spec(spec),
m_plugin_up(PluginManager::CreateArchitectureInstance(spec)) {}
@@ -3130,7 +3128,7 @@
//--------------------------------------------------------------
// clang-format off
-static constexpr OptionEnumValueElement g_dynamic_value_types[] = {
+static const OptionEnumValueElement g_dynamic_value_types[] = {
{eNoDynamicValues, "no-dynamic-values",
"Don't calculate the dynamic type of values"},
{eDynamicCanRunTarget, "run-target", "Calculate the dynamic type of values "
@@ -3142,7 +3140,7 @@
return OptionEnumValues(g_dynamic_value_types);
}
-static constexpr OptionEnumValueElement g_inline_breakpoint_enums[] = {
+static const OptionEnumValueElement g_inline_breakpoint_enums[] = {
{eInlineBreakpointsNever, "never", "Never look for inline breakpoint "
"locations (fastest). This setting "
"should only be used if you know that "
@@ -3161,16 +3159,16 @@
eX86DisFlavorATT
} x86DisassemblyFlavor;
-static constexpr OptionEnumValueElement g_x86_dis_flavor_value_types[] = {
+static const OptionEnumValueElement g_x86_dis_flavor_value_types[] = {
{eX86DisFlavorDefault, "default", "Disassembler default (currently att)."},
{eX86DisFlavorIntel, "intel", "Intel disassembler flavor."},
{eX86DisFlavorATT, "att", "AT&T disassembler flavor."} };
-static constexpr OptionEnumValueElement g_hex_immediate_style_values[] = {
+static const OptionEnumValueElement g_hex_immediate_style_values[] = {
{Disassembler::eHexStyleC, "c", "C-style (0xffff)."},
{Disassembler::eHexStyleAsm, "asm", "Asm-style (0ffffh)."} };
-static constexpr OptionEnumValueElement g_load_script_from_sym_file_values[] = {
+static const OptionEnumValueElement g_load_script_from_sym_file_values[] = {
{eLoadScriptFromSymFileTrue, "true",
"Load debug scripts inside symbol files"},
{eLoadScriptFromSymFileFalse, "false",
@@ -3178,7 +3176,7 @@
{eLoadScriptFromSymFileWarn, "warn",
"Warn about debug scripts inside symbol files but do not load them."} };
-static constexpr
+static const
OptionEnumValueElement g_load_current_working_dir_lldbinit_values[] = {
{eLoadCWDlldbinitTrue, "true",
"Load .lldbinit files from current directory"},
@@ -3187,7 +3185,7 @@
{eLoadCWDlldbinitWarn, "warn",
"Warn about loading .lldbinit files from current directory"} };
-static constexpr OptionEnumValueElement g_memory_module_load_level_values[] = {
+static const OptionEnumValueElement g_memory_module_load_level_values[] = {
{eMemoryModuleLoadLevelMinimal, "minimal",
"Load minimal information when loading modules from memory. Currently "
"this setting loads sections only."},
@@ -3198,7 +3196,7 @@
"Load complete information when loading modules from memory. Currently "
"this setting loads sections and all symbols."} };
-static constexpr PropertyDefinition g_properties[] = {
+static const PropertyDefinition g_properties[] = {
{"default-arch", OptionValue::eTypeArch, true, 0, nullptr, {},
"Default architecture to choose, when there's a choice."},
{"move-to-nearest-code", OptionValue::eTypeBoolean, false, true, nullptr,
@@ -3486,7 +3484,7 @@
//----------------------------------------------------------------------
// TargetProperties
//----------------------------------------------------------------------
-static constexpr PropertyDefinition g_experimental_properties[]{
+static const PropertyDefinition g_experimental_properties[]{
{"inject-local-vars", OptionValue::eTypeBoolean, true, true, nullptr,
{},
"If true, inject local variables explicitly into the expression text. "
Index: source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
===================================================================
--- source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -58,7 +58,7 @@
// range looking for a kernel
};
-static constexpr OptionEnumValueElement g_kaslr_kernel_scan_enum_values[] = {
+static const OptionEnumValueElement g_kaslr_kernel_scan_enum_values[] = {
{eKASLRScanNone, "none",
"Do not read memory looking for a Darwin kernel when attaching."},
{eKASLRScanLowgloAddresses, "basic", "Check for the Darwin kernel's load "
@@ -70,7 +70,7 @@
"Scan through the entire potential address range of Darwin kernel (only "
"on 32-bit targets)."}};
-static constexpr PropertyDefinition g_properties[] = {
+static const PropertyDefinition g_properties[] = {
{"load-kexts", OptionValue::eTypeBoolean, true, true, NULL, {},
"Automatically loads kext images when attaching to a kernel."},
{"scan-type", OptionValue::eTypeEnum, true, eKASLRScanNearPC, NULL,
Index: source/Interpreter/OptionGroupWatchpoint.cpp
===================================================================
--- source/Interpreter/OptionGroupWatchpoint.cpp
+++ source/Interpreter/OptionGroupWatchpoint.cpp
@@ -16,19 +16,19 @@
using namespace lldb;
using namespace lldb_private;
-static constexpr OptionEnumValueElement g_watch_type[] = {
+static const OptionEnumValueElement g_watch_type[] = {
{OptionGroupWatchpoint::eWatchRead, "read", "Watch for read"},
{OptionGroupWatchpoint::eWatchWrite, "write", "Watch for write"},
{OptionGroupWatchpoint::eWatchReadWrite, "read_write",
"Watch for read/write"} };
-static constexpr OptionEnumValueElement g_watch_size[] = {
+static const OptionEnumValueElement g_watch_size[] = {
{1, "1", "Watch for byte size of 1"},
{2, "2", "Watch for byte size of 2"},
{4, "4", "Watch for byte size of 4"},
{8, "8", "Watch for byte size of 8"} };
-static constexpr OptionDefinition g_option_table[] = {
+static const OptionDefinition g_option_table[] = {
{LLDB_OPT_SET_1, false, "watch", 'w', OptionParser::eRequiredArgument,
nullptr, OptionEnumValues(g_watch_type), 0, eArgTypeWatchType,
"Specify the type of watching to perform."},
Index: source/Core/Debugger.cpp
===================================================================
--- source/Core/Debugger.cpp
+++ source/Core/Debugger.cpp
@@ -182,7 +182,7 @@
// args}}:\n}{${function.changed}\n{${module.file.basename}`}{${function.name-
// without-args}}:\n}{${current-pc-arrow} }{${addr-file-or-load}}:
-static constexpr OptionEnumValueElement s_stop_show_column_values[] = {
+static const OptionEnumValueElement s_stop_show_column_values[] = {
{eStopShowColumnAnsiOrCaret, "ansi-or-caret",
"Highlight the stop column with ANSI terminal codes when color/ANSI mode "
"is enabled; otherwise, fall back to using a text-only caret (^) as if "
@@ -196,7 +196,7 @@
"display thread stop locations."},
{eStopShowColumnNone, "none", "Do not highlight the stop column."}};
-static constexpr PropertyDefinition g_properties[] = {
+static const PropertyDefinition g_properties[] = {
{"auto-confirm", OptionValue::eTypeBoolean, true, false, nullptr, {},
"If true all confirmation prompts will receive their default reply."},
{"disassembly-format", OptionValue::eTypeFormatEntity, true, 0,
Index: source/Commands/CommandObjectWatchpointCommand.cpp
===================================================================
--- source/Commands/CommandObjectWatchpointCommand.cpp
+++ source/Commands/CommandObjectWatchpointCommand.cpp
@@ -34,18 +34,18 @@
// language to lldb and have it pickable here without having to change this
// enumeration by hand and rebuild lldb proper.
-static constexpr OptionEnumValueElement g_script_option_enumeration[] = {
+static const OptionEnumValueElement g_script_option_enumeration[] = {
{eScriptLanguageNone, "command",
"Commands are in the lldb command interpreter language"},
{eScriptLanguagePython, "python", "Commands are in the Python language."},
{eSortOrderByName, "default-script",
"Commands are in the default scripting language."} };
-static constexpr OptionEnumValues ScriptOptionEnum() {
+static const OptionEnumValues ScriptOptionEnum() {
return OptionEnumValues(g_script_option_enumeration);
}
-static constexpr OptionDefinition g_watchpoint_command_add_options[] = {
+static const OptionDefinition g_watchpoint_command_add_options[] = {
// clang-format off
{ LLDB_OPT_SET_1, false, "one-liner", 'o', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeOneLiner, "Specify a one-line watchpoint command inline. Be sure to surround it with quotes." },
{ LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Specify whether watchpoint command execution should terminate on error." },
Index: source/Commands/CommandObjectThread.cpp
===================================================================
--- source/Commands/CommandObjectThread.cpp
+++ source/Commands/CommandObjectThread.cpp
@@ -243,7 +243,7 @@
// CommandObjectThreadBacktrace
//-------------------------------------------------------------------------
-static constexpr OptionDefinition g_thread_backtrace_options[] = {
+static const OptionDefinition g_thread_backtrace_options[] = {
// clang-format off
{ LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeCount, "How many frames to display (-1 for all)" },
{ LLDB_OPT_SET_1, false, "start", 's', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeFrameIndex, "Frame in which to start the backtrace" },
@@ -398,17 +398,17 @@
enum StepScope { eStepScopeSource, eStepScopeInstruction };
-static constexpr OptionEnumValueElement g_tri_running_mode[] = {
+static const OptionEnumValueElement g_tri_running_mode[] = {
{eOnlyThisThread, "this-thread", "Run only this thread"},
{eAllThreads, "all-threads", "Run all threads"},
{eOnlyDuringStepping, "while-stepping",
"Run only this thread while stepping"} };
-static constexpr OptionEnumValues TriRunningModes() {
+static const OptionEnumValues TriRunningModes() {
return OptionEnumValues(g_tri_running_mode);
}
-static constexpr OptionDefinition g_thread_step_scope_options[] = {
+static const OptionDefinition g_thread_step_scope_options[] = {
// clang-format off
{ LLDB_OPT_SET_1, false, "step-in-avoids-no-debug", 'a', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "A boolean value that sets whether stepping into functions will step over functions with no debug information." },
{ LLDB_OPT_SET_1, false, "step-out-avoids-no-debug", 'A', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "A boolean value, if true stepping out of functions will continue to step out till it hits a function with debug information." },
@@ -992,15 +992,15 @@
// CommandObjectThreadUntil
//-------------------------------------------------------------------------
-static constexpr OptionEnumValueElement g_duo_running_mode[] = {
+static const OptionEnumValueElement g_duo_running_mode[] = {
{eOnlyThisThread, "this-thread", "Run only this thread"},
{eAllThreads, "all-threads", "Run all threads"} };
-static constexpr OptionEnumValues DuoRunningModes() {
+static const OptionEnumValues DuoRunningModes() {
return OptionEnumValues(g_duo_running_mode);
}
-static constexpr OptionDefinition g_thread_until_options[] = {
+static const OptionDefinition g_thread_until_options[] = {
// clang-format off
{ LLDB_OPT_SET_1, false, "frame", 'f', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeFrameIndex, "Frame index for until operation - defaults to 0" },
{ LLDB_OPT_SET_1, false, "thread", 't', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeThreadIndex, "Thread index for the thread for until operation" },
Index: source/Commands/CommandObjectTarget.cpp
===================================================================
--- source/Commands/CommandObjectTarget.cpp
+++ source/Commands/CommandObjectTarget.cpp
@@ -137,7 +137,7 @@
// Note that the negation in the argument name causes a slightly confusing
// mapping of the enum values,
-static constexpr OptionEnumValueElement g_dependents_enumaration[] = {
+static const OptionEnumValueElement g_dependents_enumaration[] = {
{eLoadDependentsDefault, "default",
"Only load dependents when the target is an executable."},
{eLoadDependentsNo, "true",
@@ -145,7 +145,7 @@
{eLoadDependentsYes, "false",
"Load dependents, even if the target is not an executable."}};
-static constexpr OptionDefinition g_dependents_options[] = {
+static const OptionDefinition g_dependents_options[] = {
{LLDB_OPT_SET_1, false, "no-dependents", 'd',
OptionParser::eOptionalArgument, nullptr,
OptionEnumValues(g_dependents_enumaration), 0, eArgTypeValue,
@@ -1982,13 +1982,13 @@
#pragma mark CommandObjectTargetModulesDumpSymtab
-static constexpr OptionEnumValueElement g_sort_option_enumeration[] = {
+static const OptionEnumValueElement g_sort_option_enumeration[] = {
{eSortOrderNone, "none",
"No sorting, use the original symbol table order."},
{eSortOrderByAddress, "address", "Sort output by symbol address."},
{eSortOrderByName, "name", "Sort output by symbol name."} };
-static constexpr OptionDefinition g_target_modules_dump_symtab_options[] = {
+static const OptionDefinition g_target_modules_dump_symtab_options[] = {
// clang-format off
{ LLDB_OPT_SET_1, false, "sort", 's', OptionParser::eRequiredArgument, nullptr, OptionEnumValues(g_sort_option_enumeration), 0, eArgTypeSortOrder, "Supply a sort order when dumping the symbol table." }
// clang-format on
Index: source/Commands/CommandObjectExpression.cpp
===================================================================
--- source/Commands/CommandObjectExpression.cpp
+++ source/Commands/CommandObjectExpression.cpp
@@ -39,17 +39,17 @@
CommandObjectExpression::CommandOptions::~CommandOptions() = default;
-static constexpr OptionEnumValueElement g_description_verbosity_type[] = {
+static const OptionEnumValueElement g_description_verbosity_type[] = {
{eLanguageRuntimeDescriptionDisplayVerbosityCompact, "compact",
"Only show the description string"},
{eLanguageRuntimeDescriptionDisplayVerbosityFull, "full",
"Show the full output, including persistent variable's name and type"} };
-static constexpr OptionEnumValues DescriptionVerbosityTypes() {
+static const OptionEnumValues DescriptionVerbosityTypes() {
return OptionEnumValues(g_description_verbosity_type);
}
-static constexpr OptionDefinition g_expression_options[] = {
+static const OptionDefinition g_expression_options[] = {
// clang-format off
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "all-threads", 'a', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Should we run all threads if the execution doesn't complete on one thread."},
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "ignore-breakpoints", 'i', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Ignore breakpoint hits while running expressions"},
Index: source/Commands/CommandObjectCommands.cpp
===================================================================
--- source/Commands/CommandObjectCommands.cpp
+++ source/Commands/CommandObjectCommands.cpp
@@ -1531,11 +1531,11 @@
{eScriptedCommandSynchronicityCurrentValue, "current",
"Do not alter current setting"} };
-static constexpr OptionEnumValues ScriptSynchroType() {
+static const OptionEnumValues ScriptSynchroType() {
return OptionEnumValues(g_script_synchro_type);
}
-static constexpr OptionDefinition g_script_add_options[] = {
+static const OptionDefinition g_script_add_options[] = {
// clang-format off
{ LLDB_OPT_SET_1, false, "function", 'f', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePythonFunction, "Name of the Python function to bind to this command name." },
{ LLDB_OPT_SET_2, false, "class", 'c', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePythonClass, "Name of the Python class to bind to this command name." },
Index: source/Commands/CommandObjectBreakpointCommand.cpp
===================================================================
--- source/Commands/CommandObjectBreakpointCommand.cpp
+++ source/Commands/CommandObjectBreakpointCommand.cpp
@@ -36,18 +36,18 @@
// language to lldb and have it pickable here without having to change this
// enumeration by hand and rebuild lldb proper.
-static constexpr OptionEnumValueElement g_script_option_enumeration[] = {
+static const OptionEnumValueElement g_script_option_enumeration[] = {
{eScriptLanguageNone, "command",
"Commands are in the lldb command interpreter language"},
{eScriptLanguagePython, "python", "Commands are in the Python language."},
{eSortOrderByName, "default-script",
"Commands are in the default scripting language."} };
-static constexpr OptionEnumValues ScriptOptionEnum() {
+static const OptionEnumValues ScriptOptionEnum() {
return OptionEnumValues(g_script_option_enumeration);
}
-static constexpr OptionDefinition g_breakpoint_add_options[] = {
+static const OptionDefinition g_breakpoint_add_options[] = {
// clang-format off
{ LLDB_OPT_SET_1, false, "one-liner", 'o', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeOneLiner, "Specify a one-line breakpoint command inline. Be sure to surround it with quotes." },
{ LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "Specify whether breakpoint command execution should terminate on error." },
Index: include/lldb/Target/Target.h
===================================================================
--- include/lldb/Target/Target.h
+++ include/lldb/Target/Target.h
@@ -240,23 +240,10 @@
class EvaluateExpressionOptions {
public:
-// MSVC has a bug here that reports C4268: 'const' static/global data
-// initialized with compiler generated default constructor fills the object
-// with zeros. Confirmed that MSVC is *not* zero-initializing, it's just a
-// bogus warning.
-#if defined(_MSC_VER)
-#pragma warning(push)
-#pragma warning(disable : 4268)
-#endif
- static constexpr std::chrono::milliseconds default_timeout{500};
-#if defined(_MSC_VER)
-#pragma warning(pop)
-#endif
-
- static constexpr ExecutionPolicy default_execution_policy =
- eExecutionPolicyOnlyWhenNeeded;
-
- EvaluateExpressionOptions() = default;
+ static const ExecutionPolicy default_execution_policy =
+ eExecutionPolicyOnlyWhenNeeded;
+
+ EvaluateExpressionOptions() : m_timeout(std::chrono::milliseconds(500)){};
ExecutionPolicy GetExecutionPolicy() const { return m_execution_policy; }
@@ -411,7 +398,7 @@
bool m_running_utility_expression = false;
lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
- Timeout<std::micro> m_timeout = default_timeout;
+ Timeout<std::micro> m_timeout;
Timeout<std::micro> m_one_thread_timeout = llvm::None;
lldb::ExpressionCancelCallback m_cancel_callback = nullptr;
void *m_cancel_callback_baton = nullptr;
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits