[Lldb-commits] [lldb] r180067 - Daniel Malea reported seeing warnings for the use of anonymous namespaces in our public API.
Enrico Granata
egranata at apple.com
Mon Apr 22 15:57:56 PDT 2013
Author: enrico
Date: Mon Apr 22 17:57:56 2013
New Revision: 180067
URL: http://llvm.org/viewvc/llvm-project?rev=180067&view=rev
Log:
Daniel Malea reported seeing warnings for the use of anonymous namespaces in our public API.
Removing these namespace { ... } declarations (but still keeping the helper *Impl objects outside of namespace lldb proper)
Modified:
lldb/trunk/include/lldb/API/SBValue.h
lldb/trunk/include/lldb/API/SBValueList.h
lldb/trunk/source/API/SBValue.cpp
lldb/trunk/source/API/SBValueList.cpp
Modified: lldb/trunk/include/lldb/API/SBValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=180067&r1=180066&r2=180067&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Mon Apr 22 17:57:56 2013
@@ -14,9 +14,7 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBType.h"
-namespace {
- class ValueImpl;
-}
+class ValueImpl;
namespace lldb {
Modified: lldb/trunk/include/lldb/API/SBValueList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValueList.h?rev=180067&r1=180066&r2=180067&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValueList.h (original)
+++ lldb/trunk/include/lldb/API/SBValueList.h Mon Apr 22 17:57:56 2013
@@ -12,9 +12,7 @@
#include "lldb/API/SBDefines.h"
-namespace {
- class ValueListImpl;
-}
+class ValueListImpl;
namespace lldb {
Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=180067&r1=180066&r2=180067&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Mon Apr 22 17:57:56 2013
@@ -52,103 +52,101 @@
using namespace lldb;
using namespace lldb_private;
-namespace {
- class ValueImpl
+class ValueImpl
+{
+public:
+ ValueImpl ()
{
- public:
- ValueImpl ()
- {
- }
-
- ValueImpl (lldb::ValueObjectSP opaque_sp,
- lldb::DynamicValueType use_dynamic,
- bool use_synthetic) :
- m_opaque_sp(opaque_sp),
- m_use_dynamic(use_dynamic),
- m_use_synthetic(use_synthetic)
- {
- }
-
- ValueImpl (const ValueImpl& rhs) :
- m_opaque_sp(rhs.m_opaque_sp),
- m_use_dynamic(rhs.m_use_dynamic),
- m_use_synthetic(rhs.m_use_synthetic)
- {
- }
-
- ValueImpl &
- operator = (const ValueImpl &rhs)
- {
- if (this != &rhs)
- {
- m_opaque_sp = rhs.m_opaque_sp;
- m_use_dynamic = rhs.m_use_dynamic;
- m_use_synthetic = rhs.m_use_synthetic;
- }
- return *this;
- }
-
- bool
- IsValid ()
- {
- return m_opaque_sp.get() != NULL;
- }
-
- lldb::ValueObjectSP
- GetRootSP ()
+ }
+
+ ValueImpl (lldb::ValueObjectSP opaque_sp,
+ lldb::DynamicValueType use_dynamic,
+ bool use_synthetic) :
+ m_opaque_sp(opaque_sp),
+ m_use_dynamic(use_dynamic),
+ m_use_synthetic(use_synthetic)
+ {
+ }
+
+ ValueImpl (const ValueImpl& rhs) :
+ m_opaque_sp(rhs.m_opaque_sp),
+ m_use_dynamic(rhs.m_use_dynamic),
+ m_use_synthetic(rhs.m_use_synthetic)
+ {
+ }
+
+ ValueImpl &
+ operator = (const ValueImpl &rhs)
+ {
+ if (this != &rhs)
{
+ m_opaque_sp = rhs.m_opaque_sp;
+ m_use_dynamic = rhs.m_use_dynamic;
+ m_use_synthetic = rhs.m_use_synthetic;
+ }
+ return *this;
+ }
+
+ bool
+ IsValid ()
+ {
+ return m_opaque_sp.get() != NULL;
+ }
+
+ lldb::ValueObjectSP
+ GetRootSP ()
+ {
+ return m_opaque_sp;
+ }
+
+ lldb::ValueObjectSP
+ GetSP ()
+ {
+ if (!m_opaque_sp)
return m_opaque_sp;
- }
-
- lldb::ValueObjectSP
- GetSP ()
- {
- if (!m_opaque_sp)
- return m_opaque_sp;
- lldb::ValueObjectSP value_sp = m_opaque_sp;
-
- Mutex::Locker api_lock;
- Target *target = value_sp->GetTargetSP().get();
- if (target)
- api_lock.Lock(target->GetAPIMutex());
-
- if (value_sp->GetDynamicValue(m_use_dynamic))
- value_sp = value_sp->GetDynamicValue(m_use_dynamic);
- if (value_sp->GetSyntheticValue(m_use_synthetic))
- value_sp = value_sp->GetSyntheticValue(m_use_synthetic);
- return value_sp;
- }
-
- void
- SetUseDynamic (lldb::DynamicValueType use_dynamic)
- {
- m_use_dynamic = use_dynamic;
- }
-
- void
- SetUseSynthetic (bool use_synthetic)
- {
- m_use_synthetic = use_synthetic;
- }
+ lldb::ValueObjectSP value_sp = m_opaque_sp;
- lldb::DynamicValueType
- GetUseDynamic ()
- {
- return m_use_dynamic;
- }
-
- bool
- GetUseSynthetic ()
- {
- return m_use_synthetic;
- }
-
- private:
- lldb::ValueObjectSP m_opaque_sp;
- lldb::DynamicValueType m_use_dynamic;
- bool m_use_synthetic;
- };
-}
+ Mutex::Locker api_lock;
+ Target *target = value_sp->GetTargetSP().get();
+ if (target)
+ api_lock.Lock(target->GetAPIMutex());
+
+ if (value_sp->GetDynamicValue(m_use_dynamic))
+ value_sp = value_sp->GetDynamicValue(m_use_dynamic);
+ if (value_sp->GetSyntheticValue(m_use_synthetic))
+ value_sp = value_sp->GetSyntheticValue(m_use_synthetic);
+ return value_sp;
+ }
+
+ void
+ SetUseDynamic (lldb::DynamicValueType use_dynamic)
+ {
+ m_use_dynamic = use_dynamic;
+ }
+
+ void
+ SetUseSynthetic (bool use_synthetic)
+ {
+ m_use_synthetic = use_synthetic;
+ }
+
+ lldb::DynamicValueType
+ GetUseDynamic ()
+ {
+ return m_use_dynamic;
+ }
+
+ bool
+ GetUseSynthetic ()
+ {
+ return m_use_synthetic;
+ }
+
+private:
+ lldb::ValueObjectSP m_opaque_sp;
+ lldb::DynamicValueType m_use_dynamic;
+ bool m_use_synthetic;
+};
SBValue::SBValue () :
m_opaque_sp ()
Modified: lldb/trunk/source/API/SBValueList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValueList.cpp?rev=180067&r1=180066&r2=180067&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValueList.cpp (original)
+++ lldb/trunk/source/API/SBValueList.cpp Mon Apr 22 17:57:56 2013
@@ -19,72 +19,69 @@
using namespace lldb;
using namespace lldb_private;
-namespace {
- class ValueListImpl
+class ValueListImpl
+{
+public:
+ ValueListImpl () :
+ m_values()
{
- public:
- ValueListImpl () :
- m_values()
- {
- }
-
- ValueListImpl (const ValueListImpl& rhs) :
- m_values(rhs.m_values)
- {
- }
-
- ValueListImpl&
- operator = (const ValueListImpl& rhs)
- {
- if (this == &rhs)
- return *this;
- m_values = rhs.m_values;
+ }
+
+ ValueListImpl (const ValueListImpl& rhs) :
+ m_values(rhs.m_values)
+ {
+ }
+
+ ValueListImpl&
+ operator = (const ValueListImpl& rhs)
+ {
+ if (this == &rhs)
return *this;
- };
-
- uint32_t
- GetSize ()
- {
- return m_values.size();
- }
-
- void
- Append (const lldb::SBValue& sb_value)
- {
- m_values.push_back(sb_value);
- }
-
- void
- Append (const ValueListImpl& list)
- {
- for (auto val : list.m_values)
- Append (val);
- }
-
- lldb::SBValue
- GetValueAtIndex (uint32_t index)
- {
- if (index >= GetSize())
- return lldb::SBValue();
- return m_values[index];
- }
-
- lldb::SBValue
- FindValueByUID (lldb::user_id_t uid)
- {
- for (auto val : m_values)
- {
- if (val.IsValid() && val.GetID() == uid)
- return val;
- }
+ m_values = rhs.m_values;
+ return *this;
+ };
+
+ uint32_t
+ GetSize ()
+ {
+ return m_values.size();
+ }
+
+ void
+ Append (const lldb::SBValue& sb_value)
+ {
+ m_values.push_back(sb_value);
+ }
+
+ void
+ Append (const ValueListImpl& list)
+ {
+ for (auto val : list.m_values)
+ Append (val);
+ }
+
+ lldb::SBValue
+ GetValueAtIndex (uint32_t index)
+ {
+ if (index >= GetSize())
return lldb::SBValue();
+ return m_values[index];
+ }
+
+ lldb::SBValue
+ FindValueByUID (lldb::user_id_t uid)
+ {
+ for (auto val : m_values)
+ {
+ if (val.IsValid() && val.GetID() == uid)
+ return val;
}
+ return lldb::SBValue();
+ }
- private:
- std::vector<lldb::SBValue> m_values;
- };
-}
-
+private:
+ std::vector<lldb::SBValue> m_values;
+};
SBValueList::SBValueList () :
m_opaque_ap ()
More information about the lldb-commits
mailing list