[Lldb-commits] [lldb] r204110 - create constants for multichar constants

Saleem Abdulrasool compnerd at compnerd.org
Mon Mar 17 21:43:47 PDT 2014


Author: compnerd
Date: Mon Mar 17 23:43:47 2014
New Revision: 204110

URL: http://llvm.org/viewvc/llvm-project?rev=204110&view=rev
Log:
create constants for multichar constants

Multichar constants are not portable as the byte order is undefined.  Use a
constant value instead.  This avoids a warning when compiling with gcc 4.8+
(-Wmultichar) and makes the code more portable.

Modified:
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=204110&r1=204109&r2=204110&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Mon Mar 17 23:43:47 2014
@@ -678,6 +678,9 @@ protected:
 
 class CommandObjectTargetVariable : public CommandObjectParsed
 {
+    static const uint32_t SHORT_OPTION_FILE = 0x66696c65;   // 'file'
+    static const uint32_t SHORT_OPTION_SHLB = 0x73686c62;   // 'shlb'
+
 public:
     CommandObjectTargetVariable (CommandInterpreter &interpreter) :
         CommandObjectParsed (interpreter,
@@ -688,8 +691,12 @@ public:
         m_option_group (interpreter),
         m_option_variable (false), // Don't include frame options
         m_option_format (eFormatDefault),
-        m_option_compile_units    (LLDB_OPT_SET_1, false, "file", 'file', 0, eArgTypeFilename, "A basename or fullpath to a file that contains global variables. This option can be specified multiple times."),
-        m_option_shared_libraries (LLDB_OPT_SET_1, false, "shlib",'shlb', 0, eArgTypeFilename, "A basename or fullpath to a shared library to use in the search for global variables. This option can be specified multiple times."),
+        m_option_compile_units    (LLDB_OPT_SET_1, false, "file",
+                                   SHORT_OPTION_FILE, 0, eArgTypeFilename,
+                                   "A basename or fullpath to a file that contains global variables. This option can be specified multiple times."),
+        m_option_shared_libraries (LLDB_OPT_SET_1, false, "shlib",
+                                   SHORT_OPTION_SHLB, 0, eArgTypeFilename,
+                                   "A basename or fullpath to a shared library to use in the search for global variables. This option can be specified multiple times."),
         m_varobj_options()
     {
         CommandArgumentEntry arg;

Modified: lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp?rev=204110&r1=204109&r2=204110&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp Mon Mar 17 23:43:47 2014
@@ -28,11 +28,15 @@ OptionGroupOutputFile::~OptionGroupOutpu
 {
 }
 
+static const uint32_t SHORT_OPTION_APND = 0x61706e64;   // 'apnd'
+
 static OptionDefinition
 g_option_table[] =
 {
     { LLDB_OPT_SET_1 , false, "outfile", 'o', OptionParser::eRequiredArgument, NULL, 0, eArgTypeFilename , "Specify a path for capturing command output."},
-    { LLDB_OPT_SET_1 , false, "append-outfile" , 'apnd', OptionParser::eNoArgument, NULL, 0, eArgTypeNone , "Append to the the file specified with '--outfile <path>'."},
+    { LLDB_OPT_SET_1 , false, "append-outfile" , SHORT_OPTION_APND,
+      OptionParser::eNoArgument, NULL, 0, eArgTypeNone ,
+      "Append to the the file specified with '--outfile <path>'."},
 };
 
 uint32_t
@@ -61,7 +65,7 @@ OptionGroupOutputFile::SetOptionValue (C
             error = m_file.SetValueFromCString (option_arg);
             break;
 
-        case 'apnd':
+        case SHORT_OPTION_APND:
             m_append.SetCurrentValue(true);
             break;
 





More information about the lldb-commits mailing list