[Lldb-commits] [lldb] r233943 - Fix warnings generated by clang-cl.

Zachary Turner zturner at google.com
Thu Apr 2 13:57:39 PDT 2015


Author: zturner
Date: Thu Apr  2 15:57:38 2015
New Revision: 233943

URL: http://llvm.org/viewvc/llvm-project?rev=233943&view=rev
Log:
Fix warnings generated by clang-cl.

There were a couple of real bugs here regarding error checking and
signed/unsigned comparisons, but mostly these were just noise.

There was one class of bugs fixed here which is particularly
annoying, dealing with MSVC's non-standard behavior regarding
the underlying type of enums.  See the comment in
lldb-enumerations.h for details.  In short, from now on please use
FLAGS_ENUM and FLAGS_ANONYMOUS_ENUM when defining enums which
contain values larger than can fit into a signed integer.

Modified:
    lldb/trunk/cmake/LLDBDependencies.cmake
    lldb/trunk/include/lldb/API/SBCommunication.h
    lldb/trunk/include/lldb/API/SBProcess.h
    lldb/trunk/include/lldb/API/SBValue.h
    lldb/trunk/include/lldb/Core/Communication.h
    lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h
    lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
    lldb/trunk/include/lldb/Symbol/Type.h
    lldb/trunk/include/lldb/Target/SectionLoadHistory.h
    lldb/trunk/include/lldb/lldb-enumerations.h
    lldb/trunk/source/Host/common/File.cpp
    lldb/trunk/source/Host/common/Socket.cpp
    lldb/trunk/source/Host/common/Terminal.cpp
    lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp
    lldb/trunk/source/Host/windows/EditLineWin.cpp
    lldb/trunk/source/Host/windows/HostProcessWindows.cpp
    lldb/trunk/source/Host/windows/ThisThread.cpp
    lldb/trunk/source/Host/windows/getopt/GetOptInc.cpp
    lldb/trunk/source/Interpreter/CommandObject.cpp
    lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
    lldb/trunk/source/Plugins/Process/Windows/DebuggerThread.cpp
    lldb/trunk/source/Plugins/Process/Windows/LocalDebugDelegate.h
    lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp
    lldb/trunk/source/Plugins/Process/Windows/TargetThreadWindows.cpp
    lldb/trunk/source/Plugins/Process/Windows/x86/RegisterContextWindows_x86.cpp
    lldb/trunk/source/Symbol/CompactUnwindInfo.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Utility/PseudoTerminal.cpp

Modified: lldb/trunk/cmake/LLDBDependencies.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/LLDBDependencies.cmake?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/cmake/LLDBDependencies.cmake (original)
+++ lldb/trunk/cmake/LLDBDependencies.cmake Thu Apr  2 15:57:38 2015
@@ -173,6 +173,9 @@ if ( NOT LLDB_DISABLE_PYTHON )
   set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
 
   set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1)
+  if (CLANG_CL)
+    set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES COMPILE_FLAGS -Wno-unused-function)
+  endif()
   if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
       NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
     set_property(SOURCE ${LLDB_WRAP_PYTHON}

Modified: lldb/trunk/include/lldb/API/SBCommunication.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommunication.h?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCommunication.h (original)
+++ lldb/trunk/include/lldb/API/SBCommunication.h Thu Apr  2 15:57:38 2015
@@ -18,7 +18,8 @@ namespace lldb {
 class LLDB_API SBCommunication
 {
 public:
-    enum {
+    FLAGS_ANONYMOUS_ENUM()
+    {
         eBroadcastBitDisconnected           = (1 << 0), ///< Sent when the communications connection is lost.
         eBroadcastBitReadThreadGotBytes     = (1 << 1), ///< Sent by the read thread when bytes become available.
         eBroadcastBitReadThreadDidExit      = (1 << 2), ///< Sent by the read thread when it exits to inform clients.

Modified: lldb/trunk/include/lldb/API/SBProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBProcess.h?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBProcess.h (original)
+++ lldb/trunk/include/lldb/API/SBProcess.h Thu Apr  2 15:57:38 2015
@@ -26,7 +26,7 @@ public:
     //------------------------------------------------------------------
     /// Broadcaster event bits definitions.
     //------------------------------------------------------------------
-    enum
+    FLAGS_ANONYMOUS_ENUM()
     {
         eBroadcastBitStateChanged   = (1 << 0),
         eBroadcastBitInterrupt      = (1 << 1),

Modified: lldb/trunk/include/lldb/API/SBValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Thu Apr  2 15:57:38 2015
@@ -21,8 +21,6 @@ namespace lldb {
 
 class LLDB_API SBValue
 {
-friend class ValueLocker;
-
 public:
     SBValue ();
 

Modified: lldb/trunk/include/lldb/Core/Communication.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Communication.h?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Communication.h (original)
+++ lldb/trunk/include/lldb/Core/Communication.h Thu Apr  2 15:57:38 2015
@@ -85,15 +85,16 @@ namespace lldb_private {
 class Communication : public Broadcaster
 {
 public:
-    enum {
-        eBroadcastBitDisconnected           = (1 << 0), ///< Sent when the communications connection is lost.
-        eBroadcastBitReadThreadGotBytes     = (1 << 1), ///< Sent by the read thread when bytes become available.
-        eBroadcastBitReadThreadDidExit      = (1 << 2), ///< Sent by the read thread when it exits to inform clients.
-        eBroadcastBitReadThreadShouldExit   = (1 << 3), ///< Sent by clients that need to cancel the read thread.
-        eBroadcastBitPacketAvailable        = (1 << 4), ///< Sent when data received makes a complete packet.
-        eBroadcastBitNoMorePendingInput     = (1 << 5), ///< Sent by the read thread to indicate all pending input has been processed.
-        kLoUserBroadcastBit                 = (1 << 16),///< Subclasses can used bits 31:16 for any needed events.
-        kHiUserBroadcastBit                 = (1 << 31),
+    FLAGS_ANONYMOUS_ENUM()
+    {
+        eBroadcastBitDisconnected           = (1u << 0), ///< Sent when the communications connection is lost.
+        eBroadcastBitReadThreadGotBytes     = (1u << 1), ///< Sent by the read thread when bytes become available.
+        eBroadcastBitReadThreadDidExit      = (1u << 2), ///< Sent by the read thread when it exits to inform clients.
+        eBroadcastBitReadThreadShouldExit   = (1u << 3), ///< Sent by clients that need to cancel the read thread.
+        eBroadcastBitPacketAvailable        = (1u << 4), ///< Sent when data received makes a complete packet.
+        eBroadcastBitNoMorePendingInput     = (1u << 5), ///< Sent by the read thread to indicate all pending input has been processed.
+        kLoUserBroadcastBit                 = (1u << 16),///< Subclasses can used bits 31:16 for any needed events.
+        kHiUserBroadcastBit                 = (1u << 31),
         eAllEventBits                       = 0xffffffff
     };
 

Modified: lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h Thu Apr  2 15:57:38 2015
@@ -26,19 +26,19 @@ class ConnectionGenericFile : public lld
 
     ConnectionGenericFile(lldb::file_t file, bool owns_file);
 
-    virtual ~ConnectionGenericFile();
+    ~ConnectionGenericFile() override;
 
-    virtual bool IsConnected() const;
+    bool IsConnected() const override;
 
-    virtual lldb::ConnectionStatus Connect(const char *s, Error *error_ptr);
+    lldb::ConnectionStatus Connect(const char *s, Error *error_ptr) override;
 
-    virtual lldb::ConnectionStatus Disconnect(Error *error_ptr);
+    lldb::ConnectionStatus Disconnect(Error *error_ptr) override;
 
-    virtual size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec, lldb::ConnectionStatus &status, Error *error_ptr);
+    size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec, lldb::ConnectionStatus &status, Error *error_ptr) override;
 
-    virtual size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr);
+    size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr) override;
 
-    virtual std::string GetURI();
+    std::string GetURI() override;
 
     bool InterruptRead() override;
 

Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h Thu Apr  2 15:57:38 2015
@@ -125,7 +125,7 @@ public:
                                                                  const char* setting,
                                                                  const lldb::TargetSP& target_sp);
 
-    friend class IOHandlerPythonInterpreter;
+    friend class ::IOHandlerPythonInterpreter;
 
     ScriptInterpreterPython (CommandInterpreter &interpreter);
 

Modified: lldb/trunk/include/lldb/Symbol/Type.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Type.h?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Type.h (original)
+++ lldb/trunk/include/lldb/Symbol/Type.h Thu Apr  2 15:57:38 2015
@@ -71,7 +71,12 @@ public:
         eEncodingIsSyntheticUID
     } EncodingDataType;
 
-    typedef enum ResolveStateTag
+    // We must force the underlying type of the enum to be unsigned here.  Not all compilers
+    // behave the same with regards to the default underlying type of an enum, but because
+    // this enum is used in an enum bitfield and integer comparisons are done with the value
+    // we need to guarantee that it's always unsigned so that, for example, eResolveStateFull
+    // doesn't compare less than eResolveStateUnresolved when used in a 2-bit bitfield.
+    typedef enum ResolveStateTag : unsigned
     {
         eResolveStateUnresolved = 0,
         eResolveStateForward    = 1,

Modified: lldb/trunk/include/lldb/Target/SectionLoadHistory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/SectionLoadHistory.h?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/SectionLoadHistory.h (original)
+++ lldb/trunk/include/lldb/Target/SectionLoadHistory.h Thu Apr  2 15:57:38 2015
@@ -23,7 +23,7 @@ namespace lldb_private {
 class SectionLoadHistory
 {
 public:
-    enum {
+    enum : unsigned {
         // Pass eStopIDNow to any function that takes a stop ID to get
         // the current value.
         eStopIDNow = UINT32_MAX

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Thu Apr  2 15:57:38 2015
@@ -10,12 +10,34 @@
 #ifndef LLDB_lldb_enumerations_h_
 #define LLDB_lldb_enumerations_h_
 
+#ifndef SWIG
+// With MSVC, the default type of an enum is always signed, even if one of the
+// enumerator values is too large to fit into a signed integer but would
+// otherwise fit into an unsigned integer.  As a result of this, all of LLDB's
+// flag-style enumerations that specify something like eValueFoo = 1u << 31
+// result in negative values.  This usually just results in a benign warning,
+// but in a few places we actually do comparisons on the enum values, which
+// would cause a real bug.  Furthermore, there's no way to silence only this
+// warning, as it's part of -Wmicrosoft which also catches a whole slew of
+// other useful issues.
+//
+// To make matters worse, early versions of SWIG don't recognize the syntax
+// of specifying the underlying type of an enum (and Python doesn't care anyway)
+// so we need a way to specify the underlying type when the enum is being used
+// from C++ code, but just use a regular enum when swig is pre-processing.
+#define FLAGS_ENUM(Name) enum Name : unsigned
+#define FLAGS_ANONYMOUS_ENUM() enum : unsigned
+#else
+#define FLAGS_ENUM(Name) enum Name
+#define FLAGS_ANONYMOUS_ENUM() enum
+#endif
+
 namespace lldb {
 
     //----------------------------------------------------------------------
     // Process and Thread States
     //----------------------------------------------------------------------
-    typedef enum StateType
+    enum StateType
     {
         eStateInvalid = 0,
         eStateUnloaded,     ///< Process is object is valid, but not currently loaded
@@ -31,12 +53,12 @@ namespace lldb {
         eStateSuspended     ///< Process or thread is in a suspended state as far
                             ///< as the debugger is concerned while other processes
                             ///< or threads get the chance to run.
-    } StateType;
+    };
 
     //----------------------------------------------------------------------
     // Launch Flags
     //----------------------------------------------------------------------
-    typedef enum LaunchFlags
+    FLAGS_ENUM(LaunchFlags)
     {
         eLaunchFlagNone         = 0u,
         eLaunchFlagExec         = (1u << 0),       ///< Exec when launching and turn the calling process into a new process
@@ -53,44 +75,45 @@ namespace lldb {
                                                    ///< if it loses connection with lldb.
         eLaunchFlagShellExpandArguments  = (1u << 10),       ///< Perform shell-style argument expansion
         eLaunchFlagCloseTTYOnExit = (1u << 11),    ///< Close the open TTY on exit
-    } LaunchFlags;
+    };
         
     //----------------------------------------------------------------------
     // Thread Run Modes
     //----------------------------------------------------------------------
-    typedef enum RunMode {
+    enum RunMode
+    {
         eOnlyThisThread,
         eAllThreads,
         eOnlyDuringStepping
-    } RunMode;
+    };
 
     //----------------------------------------------------------------------
     // Byte ordering definitions
     //----------------------------------------------------------------------
-    typedef enum ByteOrder
+    enum ByteOrder
     {
         eByteOrderInvalid   = 0,
         eByteOrderBig       = 1,
         eByteOrderPDP       = 2,
         eByteOrderLittle    = 4
-    } ByteOrder;
+    };
 
     //----------------------------------------------------------------------
     // Register encoding definitions
     //----------------------------------------------------------------------
-    typedef enum Encoding
+    enum Encoding
     {
         eEncodingInvalid = 0,
         eEncodingUint,               // unsigned integer
         eEncodingSint,               // signed integer
         eEncodingIEEE754,            // float
         eEncodingVector              // vector registers
-    } Encoding;
+    };
 
     //----------------------------------------------------------------------
     // Display format definitions
     //----------------------------------------------------------------------
-    typedef enum Format
+    enum Format
     {
         eFormatDefault = 0,
         eFormatInvalid = 0,
@@ -133,29 +156,29 @@ namespace lldb {
         eFormatInstruction,         // Disassemble an opcode
         eFormatVoid,                // Do not print this
         kNumFormats
-    } Format;
+    };
 
     //----------------------------------------------------------------------
     // Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls
     //----------------------------------------------------------------------
-    typedef enum DescriptionLevel
+    enum DescriptionLevel
     {
         eDescriptionLevelBrief = 0,
         eDescriptionLevelFull,
         eDescriptionLevelVerbose,
         eDescriptionLevelInitial,
         kNumDescriptionLevels
-    } DescriptionLevel;
+    };
 
     //----------------------------------------------------------------------
     // Script interpreter types
     //----------------------------------------------------------------------
-    typedef enum ScriptLanguage
+    enum ScriptLanguage
     {
         eScriptLanguageNone,
         eScriptLanguagePython,
         eScriptLanguageDefault = eScriptLanguagePython
-    } ScriptLanguage;
+    };
 
     //----------------------------------------------------------------------
     // Register numbering types
@@ -163,7 +186,7 @@ namespace lldb {
     // any of these to the lldb internal register numbering scheme 
     // (eRegisterKindLLDB).
     //----------------------------------------------------------------------
-    typedef enum RegisterKind
+    enum RegisterKind
     {
         eRegisterKindGCC = 0,    // the register numbers seen in eh_frame
         eRegisterKindDWARF,      // the register numbers seen DWARF
@@ -171,12 +194,12 @@ namespace lldb {
         eRegisterKindGDB,        // the register numbers gdb uses (matches stabs numbers)
         eRegisterKindLLDB,       // lldb's internal register numbers
         kNumRegisterKinds
-    } RegisterKind;
+    };
 
     //----------------------------------------------------------------------
     // Thread stop reasons
     //----------------------------------------------------------------------
-    typedef enum StopReason
+    enum StopReason
     {
         eStopReasonInvalid = 0,
         eStopReasonNone,
@@ -189,12 +212,12 @@ namespace lldb {
         eStopReasonPlanComplete,
         eStopReasonThreadExiting,
         eStopReasonInstrumentation
-    } StopReason;
+    };
 
     //----------------------------------------------------------------------
     // Command Return Status Types
     //----------------------------------------------------------------------
-    typedef enum ReturnStatus
+    enum ReturnStatus
     {
         eReturnStatusInvalid,
         eReturnStatusSuccessFinishNoResult,
@@ -204,13 +227,13 @@ namespace lldb {
         eReturnStatusStarted,
         eReturnStatusFailed,
         eReturnStatusQuit
-    } ReturnStatus;
+    };
 
 
     //----------------------------------------------------------------------
     // The results of expression evaluation:
     //----------------------------------------------------------------------
-    typedef enum ExpressionResults
+    enum ExpressionResults
     {
         eExpressionCompleted = 0,
         eExpressionSetupError,
@@ -221,12 +244,12 @@ namespace lldb {
         eExpressionTimedOut,
         eExpressionResultUnavailable,
         eExpressionStoppedForDebug
-    } ExpressionResults;
+    };
 
     //----------------------------------------------------------------------
     // Connection Status Types
     //----------------------------------------------------------------------
-    typedef enum ConnectionStatus
+    enum ConnectionStatus
     {
         eConnectionStatusSuccess,         // Success
         eConnectionStatusEndOfFile,       // End-of-file encountered
@@ -235,9 +258,9 @@ namespace lldb {
         eConnectionStatusNoConnection,    // No connection
         eConnectionStatusLostConnection,  // Lost connection while connected to a valid connection
         eConnectionStatusInterrupted      // Interrupted read
-    } ConnectionStatus;
+    };
 
-    typedef enum ErrorType
+    enum ErrorType
     {
         eErrorTypeInvalid,
         eErrorTypeGeneric,      ///< Generic errors that can be any value.
@@ -245,10 +268,10 @@ namespace lldb {
         eErrorTypePOSIX,        ///< POSIX error codes.
         eErrorTypeExpression,   ///< These are from the ExpressionResults enum.
         eErrorTypeWin32         ///< Standard Win32 error codes.
-    } ErrorType;
+    };
 
 
-    typedef enum ValueType
+    enum ValueType
     {
         eValueTypeInvalid           = 0,
         eValueTypeVariableGlobal    = 1,    // globals variable
@@ -258,20 +281,20 @@ namespace lldb {
         eValueTypeRegister          = 5,    // stack frame register value
         eValueTypeRegisterSet       = 6,    // A collection of stack frame register values
         eValueTypeConstResult       = 7     // constant result variables
-    } ValueType;
+    };
 
     //----------------------------------------------------------------------
     // Token size/granularities for Input Readers
     //----------------------------------------------------------------------
 
-    typedef enum InputReaderGranularity
+    enum InputReaderGranularity
     {
         eInputReaderGranularityInvalid = 0,
         eInputReaderGranularityByte,
         eInputReaderGranularityWord,
         eInputReaderGranularityLine,
         eInputReaderGranularityAll
-    } InputReaderGranularity;
+    };
 
     //------------------------------------------------------------------
     /// These mask bits allow a common interface for queries that can
@@ -283,7 +306,7 @@ namespace lldb {
     /// in this class, and requests that that item be resolved, or
     /// indicates that the member did get resolved.
     //------------------------------------------------------------------
-    typedef enum SymbolContextItem
+    FLAGS_ENUM(SymbolContextItem)
     {
         eSymbolContextTarget     = (1u << 0), ///< Set when \a target is requested from a query, or was located in query results
         eSymbolContextModule     = (1u << 1), ///< Set when \a module is requested from a query, or was located in query results
@@ -297,16 +320,16 @@ namespace lldb {
                                               ///< eSymbolContextVariable is potentially expensive to lookup so it isn't included in
                                               ///< eSymbolContextEverything which stops it from being used during frame PC lookups and
                                               ///< many other potential address to symbol context lookups.
-    } SymbolContextItem;
+    };
 
-    typedef enum Permissions
+    FLAGS_ENUM(Permissions)
     {
         ePermissionsWritable    = (1u << 0),
         ePermissionsReadable    = (1u << 1),
         ePermissionsExecutable  = (1u << 2)
-    } Permissions;
+    };
 
-    typedef enum InputReaderAction
+    enum InputReaderAction
     {
         eInputReaderActivate,   // reader is newly pushed onto the reader stack 
         eInputReaderAsynchronousOutputWritten, // an async output event occurred; the reader may want to do something
@@ -316,9 +339,9 @@ namespace lldb {
         eInputReaderInterrupt,  // reader received an interrupt signal (probably from a control-c)
         eInputReaderEndOfFile,  // reader received an EOF char (probably from a control-d)
         eInputReaderDone        // reader was just popped off the stack and is done
-    } InputReaderAction;
+    };
 
-    typedef enum BreakpointEventType
+    FLAGS_ENUM(BreakpointEventType)
     {
         eBreakpointEventTypeInvalidType         = (1u << 0),
         eBreakpointEventTypeAdded               = (1u << 1),
@@ -332,9 +355,9 @@ namespace lldb {
         eBreakpointEventTypeConditionChanged    = (1u << 9),
         eBreakpointEventTypeIgnoreChanged       = (1u << 10),
         eBreakpointEventTypeThreadChanged       = (1u << 11)
-    } BreakpointEventType;
+    };
 
-    typedef enum WatchpointEventType
+    FLAGS_ENUM(WatchpointEventType)
     {
         eWatchpointEventTypeInvalidType         = (1u << 0),
         eWatchpointEventTypeAdded               = (1u << 1),
@@ -346,7 +369,7 @@ namespace lldb {
         eWatchpointEventTypeIgnoreChanged       = (1u << 10),
         eWatchpointEventTypeThreadChanged       = (1u << 11),
         eWatchpointEventTypeTypeChanged         = (1u << 12)
-    } WatchpointEventType;
+    };
 
 
     //----------------------------------------------------------------------
@@ -357,7 +380,7 @@ namespace lldb {
     /// The enum -> string code is in LanguageRuntime.cpp, don't change this
     /// table without updating that code as well.
     //----------------------------------------------------------------------
-    typedef enum LanguageType
+    enum LanguageType
     {
         eLanguageTypeUnknown         = 0x0000,   ///< Unknown or invalid language value.
         eLanguageTypeC89             = 0x0001,   ///< ISO C:1989.
@@ -398,30 +421,31 @@ namespace lldb {
         eLanguageTypeFortran03       = 0x0022,   ///< ISO Fortran 2003.
         eLanguageTypeFortran08       = 0x0023,   ///< ISO Fortran 2008.
         eNumLanguageTypes
-    } LanguageType;
+    };
     
-    typedef enum InstrumentationRuntimeType {
+    enum InstrumentationRuntimeType
+    {
         eInstrumentationRuntimeTypeAddressSanitizer = 0x0000,
         eNumInstrumentationRuntimeTypes
-    } InstrumentationRuntimeType;
+    };
 
-    typedef enum DynamicValueType
+    enum DynamicValueType
     {
         eNoDynamicValues = 0,
         eDynamicCanRunTarget    = 1,
         eDynamicDontRunTarget   = 2
-    } DynamicValueType;
+    };
     
-    typedef enum AccessType
+    enum AccessType
     {
         eAccessNone,
         eAccessPublic,
         eAccessPrivate,
         eAccessProtected,
         eAccessPackage
-    } AccessType;
+    };
 
-    typedef enum CommandArgumentType
+   enum CommandArgumentType
     {
         eArgTypeAddress = 0,
         eArgTypeAddressOrExpression,
@@ -506,12 +530,12 @@ namespace lldb {
         eArgTypeWatchpointIDRange,
         eArgTypeWatchType,
         eArgTypeLastArg  // Always keep this entry as the last entry in this enumeration!!
-    } CommandArgumentType;
+    };
 
     //----------------------------------------------------------------------
     // Symbol types
     //----------------------------------------------------------------------
-    typedef enum SymbolType
+    enum SymbolType
     {
         eSymbolTypeAny = 0,
         eSymbolTypeInvalid = 0,
@@ -543,9 +567,9 @@ namespace lldb {
         eSymbolTypeObjCMetaClass,
         eSymbolTypeObjCIVar,
         eSymbolTypeReExported
-    } SymbolType;
+    };
     
-    typedef enum SectionType
+    enum SectionType
     {
         eSectionTypeInvalid,
         eSectionTypeCode,
@@ -584,17 +608,16 @@ namespace lldb {
         eSectionTypeEHFrame,
         eSectionTypeCompactUnwind,        // compact unwind section in Mach-O, __TEXT,__unwind_info
         eSectionTypeOther
-        
-    } SectionType;
+    };
 
-    typedef enum EmulateInstructionOptions
+    FLAGS_ENUM(EmulateInstructionOptions)
     {
         eEmulateInstructionOptionNone               = (0u),
         eEmulateInstructionOptionAutoAdvancePC      = (1u << 0),
         eEmulateInstructionOptionIgnoreConditions   = (1u << 1)
-    } EmulateInstructionOptions;
+    };
 
-    typedef enum FunctionNameType 
+    FLAGS_ENUM(FunctionNameType)
     {
         eFunctionNameTypeNone       = 0u,
         eFunctionNameTypeAuto       = (1u << 1),    // Automatically figure out which FunctionNameType
@@ -609,13 +632,13 @@ namespace lldb {
         eFunctionNameTypeMethod     = (1u << 4),    // Find function by method name (C++) with no namespace or arguments
         eFunctionNameTypeSelector   = (1u << 5),    // Find function by selector name (ObjC) names
         eFunctionNameTypeAny        = eFunctionNameTypeAuto // DEPRECATED: use eFunctionNameTypeAuto
-    } FunctionNameType;
+    };
     
     
     //----------------------------------------------------------------------
     // Basic types enumeration for the public API SBType::GetBasicType()
     //----------------------------------------------------------------------
-    typedef enum BasicType
+    enum BasicType
     {
 		eBasicTypeInvalid = 0,
         eBasicTypeVoid = 1,
@@ -650,9 +673,9 @@ namespace lldb {
         eBasicTypeObjCSel,
         eBasicTypeNullPtr,
         eBasicTypeOther
-    } BasicType;
+    };
 
-    typedef enum TypeClass
+    FLAGS_ENUM(TypeClass)
     {
         eTypeClassInvalid           = (0u),
         eTypeClassArray             = (1u << 0),
@@ -677,9 +700,9 @@ namespace lldb {
         eTypeClassOther             = (1u << 31),
         // Define a mask that can be used for any type when finding types
         eTypeClassAny               = (0xffffffffu)
-    } TypeClass;
+    };
 
-    typedef enum TemplateArgumentKind
+    enum TemplateArgumentKind
     {
         eTemplateArgumentKindNull = 0,
         eTemplateArgumentKindType,
@@ -690,13 +713,13 @@ namespace lldb {
         eTemplateArgumentKindExpression,
         eTemplateArgumentKindPack
 
-    } TemplateArgumentKind;
+    };
 
     //----------------------------------------------------------------------
     // Options that can be set for a formatter to alter its behavior
     // Not all of these are applicable to all formatter types
     //----------------------------------------------------------------------
-    typedef enum TypeOptions
+    FLAGS_ENUM(TypeOptions)
     {
         eTypeOptionNone            = (0u),
         eTypeOptionCascade         = (1u << 0),
@@ -706,7 +729,7 @@ namespace lldb {
         eTypeOptionHideValue       = (1u << 4),
         eTypeOptionShowOneLiner    = (1u << 5),
         eTypeOptionHideNames       = (1u << 6)
-    } TypeOptions;
+    };
 
    //----------------------------------------------------------------------
    // This is the return value for frame comparisons.  If you are comparing frame A to frame B
@@ -719,7 +742,7 @@ namespace lldb {
    // 5) If the two frames are on different threads or processes the comparision is Invalid
    // 6) If for some reason we can't figure out what went on, we return Unknown.
    //----------------------------------------------------------------------
-   typedef enum FrameComparison
+   enum FrameComparison
    {
        eFrameCompareInvalid,
        eFrameCompareUnknown,
@@ -727,7 +750,7 @@ namespace lldb {
        eFrameCompareSameParent,
        eFrameCompareYounger,
        eFrameCompareOlder
-   } FrameComparison;
+   };
    
     //----------------------------------------------------------------------
     // Address Class
@@ -739,7 +762,7 @@ namespace lldb {
     // might contain PC relative data and the object file might be able to
     // tell us that an address in code is data.
     //----------------------------------------------------------------------
-    typedef enum AddressClass
+    enum AddressClass
     {
         eAddressClassInvalid,
         eAddressClassUnknown,
@@ -748,7 +771,7 @@ namespace lldb {
         eAddressClassData,
         eAddressClassDebug,
         eAddressClassRuntime
-    } AddressClass;
+    };
 
     //----------------------------------------------------------------------
     // File Permissions
@@ -757,7 +780,7 @@ namespace lldb {
     // used with functions that set 'mode_t' to certain values for
     // permissions.
     //----------------------------------------------------------------------
-    typedef enum FilePermissions
+    FLAGS_ENUM(FilePermissions)
     {
         eFilePermissionsUserRead        = (1u << 8),
         eFilePermissionsUserWrite       = (1u << 7),
@@ -790,7 +813,7 @@ namespace lldb {
         eFilePermissionsEveryoneRWX = (eFilePermissionsEveryoneR   | eFilePermissionsEveryoneW      | eFilePermissionsEveryoneX     ),
         eFilePermissionsFileDefault = eFilePermissionsUserRW,
         eFilePermissionsDirectoryDefault = eFilePermissionsUserRWX,
-    } FilePermissions;
+    };
 
     //----------------------------------------------------------------------
     // Queue work item types
@@ -798,24 +821,24 @@ namespace lldb {
     // The different types of work that can be enqueued on a libdispatch
     // aka Grand Central Dispatch (GCD) queue.
     //----------------------------------------------------------------------
-    typedef enum QueueItemKind
+    enum QueueItemKind
     {
         eQueueItemKindUnknown = 0,
         eQueueItemKindFunction,
         eQueueItemKindBlock
-    } QueueItemKind;
+    };
 
     //----------------------------------------------------------------------
     // Queue type
     // libdispatch aka Grand Central Dispatch (GCD) queues can be either serial
     // (executing on one thread) or concurrent (executing on multiple threads).
     //----------------------------------------------------------------------
-    typedef enum QueueKind
+    enum QueueKind
     {
         eQueueKindUnknown = 0,
         eQueueKindSerial,
         eQueueKindConcurrent
-    } QueueKind;
+    };
     
     //----------------------------------------------------------------------
     // Expression Evaluation Stages
@@ -823,13 +846,13 @@ namespace lldb {
     // expression evaluation callback, so that you can interrupt expression
     // evaluation at the various points in its lifecycle.
     //----------------------------------------------------------------------
-    typedef enum ExpressionEvaluationPhase
+    enum ExpressionEvaluationPhase
     {
         eExpressionEvaluationParse = 0,
         eExpressionEvaluationIRGen,
         eExpressionEvaluationExecution,
         eExpressionEvaluationComplete
-    } ExpressionEvaluationPhase;
+    };
     
 
     //----------------------------------------------------------------------
@@ -837,13 +860,13 @@ namespace lldb {
     // Indicates what types of events cause the watchpoint to fire.
     // Used by Native*Protocol-related classes.
     //----------------------------------------------------------------------
-    typedef enum WatchpointKind
+    FLAGS_ENUM(WatchpointKind)
     {
         eWatchpointKindRead = (1u << 0),
         eWatchpointKindWrite = (1u << 1)
-    } WatchpointKind;
+    };
 
-    typedef enum GdbSignal
+    enum GdbSignal
     {
         eGdbSignalBadAccess      = 0x91,
         eGdbSignalBadInstruction = 0x92,
@@ -851,14 +874,14 @@ namespace lldb {
         eGdbSignalEmulation      = 0x94,
         eGdbSignalSoftware       = 0x95,
         eGdbSignalBreakpoint     = 0x96
-    } GdbRemoteSignal;
+    };
 
     //----------------------------------------------------------------------
     // Used with SBHost::GetPath (lldb::PathType) to find files that are
     // related to LLDB on the current host machine. Most files are relative
     // to LLDB or are in known locations.
     //----------------------------------------------------------------------
-    typedef enum PathType
+    enum PathType
     {
         ePathTypeLLDBShlibDir,            // The directory where the lldb.so (unix) or LLDB mach-o file in LLDB.framework (MacOSX) exists
         ePathTypeSupportExecutableDir,    // Find LLDB support executable directory (debugserver, etc)
@@ -869,35 +892,37 @@ namespace lldb {
         ePathTypeLLDBTempSystemDir,       // The LLDB temp directory for this system that will be cleaned up on exit
         ePathTypeGlobalLLDBTempSystemDir, // The LLDB temp directory for this system, NOT cleaned up on a process exit.
         ePathTypeClangDir                 // Find path to Clang builtin headers
-    } PathType;
+    };
     
     //----------------------------------------------------------------------
     // Kind of member function
     // Used by the type system
     //----------------------------------------------------------------------
-    typedef enum MemberFunctionKind
+    enum MemberFunctionKind
     {
         eMemberFunctionKindUnknown = 0,     // Not sure what the type of this is
         eMemberFunctionKindConstructor,     // A function used to create instances
         eMemberFunctionKindDestructor,      // A function used to tear down existing instances
         eMemberFunctionKindInstanceMethod,  // A function that applies to a specific instance
         eMemberFunctionKindStaticMethod     // A function that applies to a type rather than any instance
-    } MemberFunctionKind;
+    };
 
 
     //----------------------------------------------------------------------
     // String matching algorithm used by SBTarget
     //----------------------------------------------------------------------
-    typedef enum MatchType {
+    enum MatchType
+    {
         eMatchTypeNormal,
         eMatchTypeRegex,
         eMatchTypeStartsWith
-    } MatchType;
+    };
     
     //----------------------------------------------------------------------
     // Bitmask that describes details about a type
     //----------------------------------------------------------------------
-    typedef enum TypeFlags {
+    FLAGS_ENUM(TypeFlags)
+    {
         eTypeHasChildren        = (1u <<  0),
         eTypeHasValue           = (1u <<  1),
         eTypeIsArray            = (1u <<  2),
@@ -920,17 +945,17 @@ namespace lldb {
         eTypeIsFloat            = (1u << 19),
         eTypeIsComplex          = (1u << 20),
         eTypeIsSigned           = (1u << 21)
-    } TypeFlags;
+    };
     
     //----------------------------------------------------------------------
     // Whether a summary should cap how much data it returns to users or not
     //----------------------------------------------------------------------
-    typedef enum TypeSummaryCapping {
+    enum TypeSummaryCapping
+    {
         eTypeSummaryCapped = true,
         eTypeSummaryUncapped = false
-    } TypeSummaryCapping;
+    };
 
 } // namespace lldb
 
-
 #endif  // LLDB_lldb_enumerations_h_

Modified: lldb/trunk/source/Host/common/File.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/File.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/File.cpp (original)
+++ lldb/trunk/source/Host/common/File.cpp Thu Apr  2 15:57:38 2015
@@ -811,7 +811,6 @@ File::Write (const void *buf, size_t &nu
         if (!error.Fail())
             SeekFromStart(cur);
 
-        ssize_t bytes_written = after - cur;
         offset = after;
 #endif
     }

Modified: lldb/trunk/source/Host/common/Socket.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Socket.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Socket.cpp (original)
+++ lldb/trunk/source/Host/common/Socket.cpp Thu Apr  2 15:57:38 2015
@@ -704,7 +704,7 @@ int Socket::SetOption(int level, int opt
 uint16_t Socket::GetLocalPortNumber(const NativeSocket& socket)
 {
     // We bound to port zero, so we need to figure out which port we actually bound to
-    if (socket >= 0)
+    if (socket != kInvalidSocketValue)
     {
         SocketAddress sock_addr;
         socklen_t sock_addr_len = sock_addr.GetMaxLength ();
@@ -723,7 +723,7 @@ uint16_t Socket::GetLocalPortNumber() co
 std::string  Socket::GetLocalIPAddress () const
 {
     // We bound to port zero, so we need to figure out which port we actually bound to
-    if (m_socket >= 0)
+    if (m_socket != kInvalidSocketValue)
     {
         SocketAddress sock_addr;
         socklen_t sock_addr_len = sock_addr.GetMaxLength ();
@@ -735,7 +735,7 @@ std::string  Socket::GetLocalIPAddress (
 
 uint16_t Socket::GetRemotePortNumber () const
 {
-    if (m_socket >= 0)
+    if (m_socket != kInvalidSocketValue)
     {
         SocketAddress sock_addr;
         socklen_t sock_addr_len = sock_addr.GetMaxLength ();
@@ -748,7 +748,7 @@ uint16_t Socket::GetRemotePortNumber ()
 std::string Socket::GetRemoteIPAddress () const
 {
     // We bound to port zero, so we need to figure out which port we actually bound to
-    if (m_socket >= 0)
+    if (m_socket != kInvalidSocketValue)
     {
         SocketAddress sock_addr;
         socklen_t sock_addr_len = sock_addr.GetMaxLength ();

Modified: lldb/trunk/source/Host/common/Terminal.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Terminal.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Terminal.cpp (original)
+++ lldb/trunk/source/Host/common/Terminal.cpp Thu Apr  2 15:57:38 2015
@@ -180,20 +180,18 @@ TerminalState::Save (int fd, bool save_p
 bool
 TerminalState::Restore () const
 {
+#ifndef LLDB_DISABLE_POSIX
     if (IsValid())
     {
         const int fd = m_tty.GetFileDescriptor();
-#ifndef LLDB_DISABLE_POSIX
         if (TFlagsIsValid())
             fcntl (fd, F_SETFL, m_tflags);
-#endif
 
 #ifdef LLDB_CONFIG_TERMIOS_SUPPORTED
         if (TTYStateIsValid())
             tcsetattr (fd, TCSANOW, m_termios_ap.get());
 #endif // #ifdef LLDB_CONFIG_TERMIOS_SUPPORTED
 
-#ifndef LLDB_DISABLE_POSIX
         if (ProcessGroupIsValid())
         {
             // Save the original signal handler.
@@ -204,9 +202,9 @@ TerminalState::Restore () const
             // Restore the original signal handler.
             signal (SIGTTOU, saved_sigttou_callback);
         }
-#endif
         return true;
     }
+#endif
     return false;
 }
 

Modified: lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp Thu Apr  2 15:57:38 2015
@@ -208,9 +208,9 @@ ConnectionGenericFile::Read(void *dst, s
             TimeValue time_value;
             time_value.OffsetWithMicroSeconds(timeout_usec);
             DWORD milliseconds = time_value.milliseconds();
-            result = ::WaitForMultipleObjects(llvm::array_lengthof(m_event_handles), m_event_handles, FALSE, milliseconds);
+            DWORD wait_result = ::WaitForMultipleObjects(llvm::array_lengthof(m_event_handles), m_event_handles, FALSE, milliseconds);
             // All of the events are manual reset events, so make sure we reset them to non-signalled.
-            switch (result)
+            switch (wait_result)
             {
                 case WAIT_OBJECT_0 + kBytesAvailableEvent:
                     break;

Modified: lldb/trunk/source/Host/windows/EditLineWin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/EditLineWin.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/EditLineWin.cpp (original)
+++ lldb/trunk/source/Host/windows/EditLineWin.cpp Thu Apr  2 15:57:38 2015
@@ -194,7 +194,7 @@ el_gets (EditLine *el, int *length)
 {
     // print the prompt if we have one
     if ( _prompt != NULL )
-        printf( _prompt );
+        printf("%s", _prompt);
     // create a buffer for the user input
     char *buffer = new char[ MAX_PATH ];
     // try to get user input string
@@ -247,10 +247,10 @@ el_set (EditLine *el, int code, ...)
 
             // get the function pointer from the arg list
             void *func_vp = (void*)va_arg(vl, el_prompt_func);
-            char  escape = (char)va_arg(vl, int);
+            va_arg(vl, int);
             // call to get the prompt as a string
             el_prompt_func func_fp = (el_prompt_func)func_vp;
-            const char *newPrompt = func_fp(el);
+            _prompt = func_fp(el);
         }
         break;
 

Modified: lldb/trunk/source/Host/windows/HostProcessWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostProcessWindows.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/HostProcessWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/HostProcessWindows.cpp Thu Apr  2 15:57:38 2015
@@ -120,7 +120,7 @@ HostProcessWindows::MonitorThread(void *
     MonitorInfo *info = static_cast<MonitorInfo *>(thread_arg);
     if (info)
     {
-        DWORD wait_result = ::WaitForSingleObject(info->process_handle, INFINITE);
+        ::WaitForSingleObject(info->process_handle, INFINITE);
         ::GetExitCodeProcess(info->process_handle, &exit_code);
         info->callback(info->baton, ::GetProcessId(info->process_handle), true, 0, exit_code);
         ::CloseHandle(info->process_handle);

Modified: lldb/trunk/source/Host/windows/ThisThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/ThisThread.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/ThisThread.cpp (original)
+++ lldb/trunk/source/Host/windows/ThisThread.cpp Thu Apr  2 15:57:38 2015
@@ -18,6 +18,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
+#if defined(_MSC_VER) && !defined(__clang__)
+
 namespace
 {
 static const DWORD MS_VC_EXCEPTION = 0x406D1388;
@@ -33,19 +35,23 @@ struct THREADNAME_INFO
 #pragma pack(pop)
 }
 
+#endif
+
 void
 ThisThread::SetName(llvm::StringRef name)
 {
 // Other compilers don't yet support SEH, so we can only set the thread if compiling with MSVC.
 // TODO(zturner): Once clang-cl supports SEH, relax this conditional.
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && !defined(__clang__)
     THREADNAME_INFO info;
     info.dwType = 0x1000;
     info.szName = name.data();
     info.dwThreadId = ::GetCurrentThreadId();
     info.dwFlags = 0;
 
-    __try { ::RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR *)&info); }
+    __try {
+        ::RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR *)&info);
+    }
     __except(EXCEPTION_EXECUTE_HANDLER) {}
 #endif
 }

Modified: lldb/trunk/source/Host/windows/getopt/GetOptInc.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/getopt/GetOptInc.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/getopt/GetOptInc.cpp (original)
+++ lldb/trunk/source/Host/windows/getopt/GetOptInc.cpp Thu Apr  2 15:57:38 2015
@@ -5,6 +5,11 @@
 #include <stdlib.h>
 #include <string.h>
 
+#if defined(__clang__) && defined(_MSC_VER)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wwritable-strings"
+#endif
+
 int opterr = 1;     /* if error message should be printed */
 int optind = 1;     /* index into parent argv vector */
 int optopt = '?';   /* character checked for validity */
@@ -37,14 +42,6 @@ static char *place = EMSG; /* option let
 static int nonopt_start = -1; /* first non option argument (for permute) */
 static int nonopt_end = -1;   /* first option after non options (for permute) */
 
-/* Error messages */
-static const char recargchar[] = "option requires an argument -- %c";
-static const char recargstring[] = "option requires an argument -- %s";
-static const char ambig[] = "ambiguous option -- %.*s";
-static const char noarg[] = "option doesn't take an argument -- %.*s";
-static const char illoptchar[] = "unknown option -- %c";
-static const char illoptstring[] = "unknown option -- %s";
-
 /*
 * Compute the greatest common divisor of a and b.
 */
@@ -467,3 +464,7 @@ const struct option *long_options, int *
     return (getopt_internal(nargc, nargv, options, long_options, idx,
         FLAG_PERMUTE | FLAG_LONGONLY));
 }
+
+#if defined(__clang__) && defined(_MSC_VER)
+#pragma clang diagnostic pop
+#endif
\ No newline at end of file

Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Thu Apr  2 15:57:38 2015
@@ -1027,18 +1027,15 @@ CommandObject::AddIDsArgumentData(Comman
 const char * 
 CommandObject::GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type)
 {
-    if (arg_type >=0 && arg_type < eArgTypeLastArg)
-        return g_arguments_data[arg_type].arg_name;
-    return nullptr;
-
+    assert(arg_type < eArgTypeLastArg && "Invalid argument type passed to GetArgumentTypeAsCString");
+    return g_arguments_data[arg_type].arg_name;
 }
 
 const char * 
 CommandObject::GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type)
 {
-    if (arg_type >=0 && arg_type < eArgTypeLastArg)
-        return g_arguments_data[arg_type].help_text;
-    return nullptr;
+    assert(arg_type < eArgTypeLastArg && "Invalid argument type passed to GetArgumentDescriptionAsCString");
+    return g_arguments_data[arg_type].help_text;
 }
 
 Target *

Modified: lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp Thu Apr  2 15:57:38 2015
@@ -269,7 +269,7 @@ ABISysV_hexagon::PrepareTrivialCall ( Th
 
 #if HEX_ABI_DEBUG
     // print the original stack pointer
-    printf( "sp : %04lx \n", sp );
+    printf( "sp : %04" PRIx64 " \n", sp );
 #endif
 
     // make sure number of parameters matches prototype
@@ -337,7 +337,7 @@ ABISysV_hexagon::PrepareTrivialCall ( Th
         uint32_t data = 0;
         lldb::addr_t addr = sp + i * 4;
         proc->ReadMemory( addr, (void*)&data, sizeof( data ), error );
-        printf( "\n0x%04lx 0x%08x ", addr, data );
+        printf( "\n0x%04" PRIx64 " 0x%08x ", addr, data );
         if ( i == 0 ) printf( "<<-- sp" );
     }
     printf( "\n" );

Modified: lldb/trunk/source/Plugins/Process/Windows/DebuggerThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/DebuggerThread.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/DebuggerThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/DebuggerThread.cpp Thu Apr  2 15:57:38 2015
@@ -79,7 +79,6 @@ DebuggerThread::DebuggerThreadRoutine(co
     // Grab a shared_ptr reference to this so that we know it won't get deleted until after the
     // thread routine has exited.
     std::shared_ptr<DebuggerThread> this_ref(shared_from_this());
-    Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
 
     Error error;
     ProcessLauncherWindows launcher;

Modified: lldb/trunk/source/Plugins/Process/Windows/LocalDebugDelegate.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/LocalDebugDelegate.h?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/LocalDebugDelegate.h (original)
+++ lldb/trunk/source/Plugins/Process/Windows/LocalDebugDelegate.h Thu Apr  2 15:57:38 2015
@@ -40,7 +40,7 @@ namespace lldb_private
 class LocalDebugDelegate : public IDebugDelegate
 {
   public:
-    explicit LocalDebugDelegate::LocalDebugDelegate(lldb::ProcessSP process);
+    explicit LocalDebugDelegate(lldb::ProcessSP process);
 
     virtual void OnExitProcess(uint32_t exit_code) override;
     virtual void OnDebuggerConnected(lldb::addr_t image_base) override;

Modified: lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp Thu Apr  2 15:57:38 2015
@@ -56,8 +56,8 @@ class ProcessWindowsData
 {
   public:
     ProcessWindowsData(const ProcessLaunchInfo &launch_info)
-        : m_initial_stop_event(nullptr)
-        , m_launch_info(launch_info)
+        : m_launch_info(launch_info)
+        , m_initial_stop_event(nullptr)
         , m_initial_stop_received(false)
     {
         m_initial_stop_event = ::CreateEvent(nullptr, TRUE, FALSE, nullptr);
@@ -335,7 +335,6 @@ ProcessWindows::RefreshStateAfterStop()
         BreakpointSiteSP site(GetBreakpointSiteList().FindByAddress(pc - 1));
         if (site && site->ValidForThisThread(stop_thread.get()))
         {
-            lldb::break_id_t break_id = LLDB_INVALID_BREAK_ID;
             stop_info = StopInfo::CreateStopReasonWithBreakpointSiteID(*stop_thread, site->GetID());
             register_context->SetPC(pc - 1);
         }
@@ -394,7 +393,6 @@ void ProcessWindows::DidLaunch()
 {
     llvm::sys::ScopedLock lock(m_mutex);
 
-    StateType state = GetPrivateState();
     // The initial stop won't broadcast the state change event, so account for that here.
     if (m_session_data && GetPrivateState() == eStateStopped &&
             m_session_data->m_launch_info.GetFlags().Test(eLaunchFlagStopAtEntry))
@@ -558,7 +556,6 @@ ProcessWindows::OnDebugException(bool fi
     }
 
     ExceptionResult result = ExceptionResult::SendToApplication;
-    lldb::StateType state = GetPrivateState();
     switch (record.GetExceptionCode())
     {
         case EXCEPTION_BREAKPOINT:

Modified: lldb/trunk/source/Plugins/Process/Windows/TargetThreadWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/TargetThreadWindows.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/TargetThreadWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/TargetThreadWindows.cpp Thu Apr  2 15:57:38 2015
@@ -38,7 +38,7 @@ TargetThreadWindows::~TargetThreadWindow
 void
 TargetThreadWindows::RefreshStateAfterStop()
 {
-    DWORD old_suspend_count = ::SuspendThread(m_host_thread.GetNativeThread().GetSystemHandle());
+    ::SuspendThread(m_host_thread.GetNativeThread().GetSystemHandle());
 
     GetRegisterContext()->InvalidateIfNeeded(false);
 }

Modified: lldb/trunk/source/Plugins/Process/Windows/x86/RegisterContextWindows_x86.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/x86/RegisterContextWindows_x86.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/x86/RegisterContextWindows_x86.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/x86/RegisterContextWindows_x86.cpp Thu Apr  2 15:57:38 2015
@@ -93,8 +93,8 @@ RegisterSet g_register_sets[] = {
 //------------------------------------------------------------------
 RegisterContextWindows_x86::RegisterContextWindows_x86(Thread &thread, uint32_t concrete_frame_idx)
     : RegisterContext(thread, concrete_frame_idx)
-    , m_context_stale(true)
     , m_context()
+    , m_context_stale(true)
 {
 }
 

Modified: lldb/trunk/source/Symbol/CompactUnwindInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompactUnwindInfo.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompactUnwindInfo.cpp (original)
+++ lldb/trunk/source/Symbol/CompactUnwindInfo.cpp Thu Apr  2 15:57:38 2015
@@ -35,13 +35,15 @@ namespace lldb_private {
 
     // Constants from <mach-o/compact_unwind_encoding.h>
 
-    enum {
+    FLAGS_ANONYMOUS_ENUM()
+    {
         UNWIND_IS_NOT_FUNCTION_START           = 0x80000000,
         UNWIND_HAS_LSDA                        = 0x40000000,
         UNWIND_PERSONALITY_MASK                = 0x30000000,
     };
 
-    enum {
+    FLAGS_ANONYMOUS_ENUM()
+    {
         UNWIND_X86_MODE_MASK                         = 0x0F000000,
         UNWIND_X86_MODE_EBP_FRAME                    = 0x01000000,
         UNWIND_X86_MODE_STACK_IMMD                   = 0x02000000,
@@ -59,7 +61,8 @@ namespace lldb_private {
         UNWIND_X86_DWARF_SECTION_OFFSET              = 0x00FFFFFF,
     };
 
-    enum {
+    enum
+    {
         UNWIND_X86_REG_NONE     = 0,
         UNWIND_X86_REG_EBX      = 1,
         UNWIND_X86_REG_ECX      = 2,
@@ -68,7 +71,9 @@ namespace lldb_private {
         UNWIND_X86_REG_ESI      = 5,
         UNWIND_X86_REG_EBP      = 6,
     };
-    enum {
+
+    FLAGS_ANONYMOUS_ENUM()
+    {
         UNWIND_X86_64_MODE_MASK                         = 0x0F000000,
         UNWIND_X86_64_MODE_RBP_FRAME                    = 0x01000000,
         UNWIND_X86_64_MODE_STACK_IMMD                   = 0x02000000,
@@ -86,7 +91,8 @@ namespace lldb_private {
         UNWIND_X86_64_DWARF_SECTION_OFFSET              = 0x00FFFFFF,
     };
 
-    enum {
+    enum
+    {
         UNWIND_X86_64_REG_NONE       = 0,
         UNWIND_X86_64_REG_RBX        = 1,
         UNWIND_X86_64_REG_R12        = 2,

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu Apr  2 15:57:38 2015
@@ -5091,7 +5091,6 @@ public:
             if (OpenPipes())
             {
                 const int read_fd = m_read_file.GetDescriptor();
-                const int pipe_read_fd = m_pipe.GetReadFileDescriptor();
                 TerminalState terminal_state;
                 terminal_state.Save (read_fd, false);
                 Terminal terminal(read_fd);
@@ -5099,6 +5098,7 @@ public:
                 terminal.SetEcho(false);
 // FD_ZERO, FD_SET are not supported on windows
 #ifndef _WIN32
+                const int pipe_read_fd = m_pipe.GetReadFileDescriptor();
                 while (!GetIsDone())
                 {
                     fd_set read_fdset;

Modified: lldb/trunk/source/Utility/PseudoTerminal.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/PseudoTerminal.cpp?rev=233943&r1=233942&r2=233943&view=diff
==============================================================================
--- lldb/trunk/source/Utility/PseudoTerminal.cpp (original)
+++ lldb/trunk/source/Utility/PseudoTerminal.cpp Thu Apr  2 15:57:38 2015
@@ -7,6 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "lldb/Host/Config.h"
 #include "lldb/Utility/PseudoTerminal.h"
 
 #include <errno.h>
@@ -237,12 +238,10 @@ PseudoTerminal::Fork (char *error_str, s
 {
     if (error_str)
         error_str[0] = '\0';
-
     pid_t pid = LLDB_INVALID_PROCESS_ID;
+#if !defined(LLDB_DISABLE_POSIX)
     int flags = O_RDWR;
-#if !defined(_MSC_VER)
     flags |= O_CLOEXEC;
-#endif
     if (OpenFirstAvailableMaster (flags, error_str, error_len))
     {
         // Successfully opened our master pseudo terminal
@@ -300,6 +299,7 @@ PseudoTerminal::Fork (char *error_str, s
             // Do nothing and let the pid get returned!
         }
     }
+#endif
     return pid;
 }
 





More information about the lldb-commits mailing list