[Lldb-commits] [lldb] r369485 - [NFC] Remove lldb_utility namespace.
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 20 17:50:46 PDT 2019
Author: jdevlieghere
Date: Tue Aug 20 17:50:46 2019
New Revision: 369485
URL: http://llvm.org/viewvc/llvm-project?rev=369485&view=rev
Log:
[NFC] Remove lldb_utility namespace.
While generating the Doxygen I noticed this lone namespace that has one
class and one function in it. This moves them into lldb_private.
Modified:
lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h
lldb/trunk/include/lldb/Utility/AnsiTerminal.h
lldb/trunk/include/lldb/Utility/StringLexer.h
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/Highlighter.cpp
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h
lldb/trunk/source/Utility/StringLexer.cpp
lldb/trunk/unittests/Utility/AnsiTerminalTest.cpp
lldb/trunk/unittests/Utility/StringLexerTest.cpp
Modified: lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h?rev=369485&r1=369484&r2=369485&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h Tue Aug 20 17:50:46 2019
@@ -47,7 +47,7 @@ static inline ConstString GetValidTypeNa
return type;
std::string type_cstr(type.AsCString());
- lldb_utility::StringLexer type_lexer(type_cstr);
+ StringLexer type_lexer(type_cstr);
type_lexer.AdvanceIf("class ");
type_lexer.AdvanceIf("enum ");
Modified: lldb/trunk/include/lldb/Utility/AnsiTerminal.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/AnsiTerminal.h?rev=369485&r1=369484&r2=369485&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/AnsiTerminal.h (original)
+++ lldb/trunk/include/lldb/Utility/AnsiTerminal.h Tue Aug 20 17:50:46 2019
@@ -55,7 +55,7 @@
#include <string>
-namespace lldb_utility {
+namespace lldb_private {
namespace ansi {
@@ -137,4 +137,4 @@ inline std::string FormatAnsiTerminalCod
return fmt;
}
}
-}
+} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Utility/StringLexer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/StringLexer.h?rev=369485&r1=369484&r2=369485&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/StringLexer.h (original)
+++ lldb/trunk/include/lldb/Utility/StringLexer.h Tue Aug 20 17:50:46 2019
@@ -1,4 +1,4 @@
-//===--------------------- StringLexer.h ------------------------*- C++ -*-===//
+//===-- StringLexer.h -------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -13,7 +13,7 @@
#include <string>
#include <utility>
-namespace lldb_utility {
+namespace lldb_private {
class StringLexer {
public:
Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=369485&r1=369484&r2=369485&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Tue Aug 20 17:50:46 2019
@@ -270,7 +270,7 @@ Status Debugger::SetPropertyValue(const
// FIXME it would be nice to have "on-change" callbacks for properties
if (property_path == g_debugger_properties[ePropertyPrompt].name) {
llvm::StringRef new_prompt = GetPrompt();
- std::string str = lldb_utility::ansi::FormatAnsiTerminalCodes(
+ std::string str = lldb_private::ansi::FormatAnsiTerminalCodes(
new_prompt, GetUseColor());
if (str.length())
new_prompt = str;
@@ -345,7 +345,7 @@ void Debugger::SetPrompt(llvm::StringRef
m_collection_sp->SetPropertyAtIndexAsString(nullptr, idx, p);
llvm::StringRef new_prompt = GetPrompt();
std::string str =
- lldb_utility::ansi::FormatAnsiTerminalCodes(new_prompt, GetUseColor());
+ lldb_private::ansi::FormatAnsiTerminalCodes(new_prompt, GetUseColor());
if (str.length())
new_prompt = str;
GetCommandInterpreter().UpdatePrompt(new_prompt);
Modified: lldb/trunk/source/Core/Highlighter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Highlighter.cpp?rev=369485&r1=369484&r2=369485&view=diff
==============================================================================
--- lldb/trunk/source/Core/Highlighter.cpp (original)
+++ lldb/trunk/source/Core/Highlighter.cpp Tue Aug 20 17:50:46 2019
@@ -13,6 +13,7 @@
#include "lldb/Utility/StreamString.h"
using namespace lldb_private;
+using namespace lldb_private::ansi;
void HighlightStyle::ColorStyle::Apply(Stream &s, llvm::StringRef value) const {
s << m_prefix << value << m_suffix;
@@ -20,8 +21,8 @@ void HighlightStyle::ColorStyle::Apply(S
void HighlightStyle::ColorStyle::Set(llvm::StringRef prefix,
llvm::StringRef suffix) {
- m_prefix = lldb_utility::ansi::FormatAnsiTerminalCodes(prefix);
- m_suffix = lldb_utility::ansi::FormatAnsiTerminalCodes(suffix);
+ m_prefix = FormatAnsiTerminalCodes(prefix);
+ m_suffix = FormatAnsiTerminalCodes(suffix);
}
void DefaultHighlighter::Highlight(const HighlightStyle &options,
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=369485&r1=369484&r2=369485&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Tue Aug 20 17:50:46 2019
@@ -73,7 +73,6 @@ class SymbolContextScope;
using namespace lldb;
using namespace lldb_private;
-using namespace lldb_utility;
static user_id_t g_value_obj_uid = 0;
@@ -3301,32 +3300,32 @@ lldb::ValueObjectSP ValueObjectManager::
lldb::ProcessSP process_sp = GetProcessSP();
if (!process_sp)
return lldb::ValueObjectSP();
-
+
const uint32_t current_stop_id = process_sp->GetLastNaturalStopID();
if (current_stop_id == m_stop_id)
return m_user_valobj_sp;
-
+
m_stop_id = current_stop_id;
-
+
if (!m_root_valobj_sp) {
m_user_valobj_sp.reset();
return m_root_valobj_sp;
}
-
+
m_user_valobj_sp = m_root_valobj_sp;
-
+
if (m_use_dynamic != lldb::eNoDynamicValues) {
lldb::ValueObjectSP dynamic_sp = m_user_valobj_sp->GetDynamicValue(m_use_dynamic);
if (dynamic_sp)
m_user_valobj_sp = dynamic_sp;
}
-
+
if (m_use_synthetic) {
lldb::ValueObjectSP synthetic_sp = m_user_valobj_sp->GetSyntheticValue(m_use_synthetic);
if (synthetic_sp)
m_user_valobj_sp = synthetic_sp;
}
-
+
return m_user_valobj_sp;
}
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp?rev=369485&r1=369484&r2=369485&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp Tue Aug 20 17:50:46 2019
@@ -18,7 +18,6 @@
#include <vector>
using namespace lldb_private;
-using namespace lldb_utility;
AppleObjCTypeEncodingParser::AppleObjCTypeEncodingParser(
ObjCLanguageRuntime &runtime)
@@ -32,16 +31,14 @@ AppleObjCTypeEncodingParser::AppleObjCTy
.c_str()));
}
-std::string
-AppleObjCTypeEncodingParser::ReadStructName(lldb_utility::StringLexer &type) {
+std::string AppleObjCTypeEncodingParser::ReadStructName(StringLexer &type) {
StreamString buffer;
while (type.HasAtLeast(1) && type.Peek() != '=')
buffer.Printf("%c", type.Next());
return buffer.GetString();
}
-std::string
-AppleObjCTypeEncodingParser::ReadQuotedString(lldb_utility::StringLexer &type) {
+std::string AppleObjCTypeEncodingParser::ReadQuotedString(StringLexer &type) {
StreamString buffer;
while (type.HasAtLeast(1) && type.Peek() != '"')
buffer.Printf("%c", type.Next());
@@ -51,8 +48,7 @@ AppleObjCTypeEncodingParser::ReadQuotedS
return buffer.GetString();
}
-uint32_t
-AppleObjCTypeEncodingParser::ReadNumber(lldb_utility::StringLexer &type) {
+uint32_t AppleObjCTypeEncodingParser::ReadNumber(StringLexer &type) {
uint32_t total = 0;
while (type.HasAtLeast(1) && isdigit(type.Peek()))
total = 10 * total + (type.Next() - '0');
@@ -68,7 +64,7 @@ AppleObjCTypeEncodingParser::StructEleme
AppleObjCTypeEncodingParser::StructElement
AppleObjCTypeEncodingParser::ReadStructElement(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
+ StringLexer &type,
bool for_expression) {
StructElement retval;
if (type.NextIf('"'))
@@ -81,25 +77,21 @@ AppleObjCTypeEncodingParser::ReadStructE
return retval;
}
-clang::QualType
-AppleObjCTypeEncodingParser::BuildStruct(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
- bool for_expression) {
+clang::QualType AppleObjCTypeEncodingParser::BuildStruct(
+ clang::ASTContext &ast_ctx, StringLexer &type, bool for_expression) {
return BuildAggregate(ast_ctx, type, for_expression, '{', '}',
clang::TTK_Struct);
}
-clang::QualType
-AppleObjCTypeEncodingParser::BuildUnion(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
- bool for_expression) {
+clang::QualType AppleObjCTypeEncodingParser::BuildUnion(
+ clang::ASTContext &ast_ctx, StringLexer &type, bool for_expression) {
return BuildAggregate(ast_ctx, type, for_expression, '(', ')',
clang::TTK_Union);
}
clang::QualType AppleObjCTypeEncodingParser::BuildAggregate(
- clang::ASTContext &ast_ctx, lldb_utility::StringLexer &type,
- bool for_expression, char opener, char closer, uint32_t kind) {
+ clang::ASTContext &ast_ctx, StringLexer &type, bool for_expression,
+ char opener, char closer, uint32_t kind) {
if (!type.NextIf(opener))
return clang::QualType();
std::string name(ReadStructName(type));
@@ -159,10 +151,8 @@ clang::QualType AppleObjCTypeEncodingPar
return ClangUtil::GetQualType(union_type);
}
-clang::QualType
-AppleObjCTypeEncodingParser::BuildArray(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
- bool for_expression) {
+clang::QualType AppleObjCTypeEncodingParser::BuildArray(
+ clang::ASTContext &ast_ctx, StringLexer &type, bool for_expression) {
if (!type.NextIf('['))
return clang::QualType();
uint32_t size = ReadNumber(type);
@@ -185,8 +175,7 @@ AppleObjCTypeEncodingParser::BuildArray(
// consume but ignore the type info and always return an 'id'; if anything,
// dynamic typing will resolve things for us anyway
clang::QualType AppleObjCTypeEncodingParser::BuildObjCObjectPointerType(
- clang::ASTContext &ast_ctx, lldb_utility::StringLexer &type,
- bool for_expression) {
+ clang::ASTContext &ast_ctx, StringLexer &type, bool for_expression) {
if (!type.NextIf('@'))
return clang::QualType();
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h?rev=369485&r1=369484&r2=369485&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h Tue Aug 20 17:50:46 2019
@@ -15,12 +15,8 @@
#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
-namespace lldb_utility {
-class StringLexer;
-}
-
namespace lldb_private {
-
+class StringLexer;
class AppleObjCTypeEncodingParser : public ObjCLanguageRuntime::EncodingToType {
public:
AppleObjCTypeEncodingParser(ObjCLanguageRuntime &runtime);
@@ -39,41 +35,35 @@ private:
~StructElement() = default;
};
- clang::QualType BuildType(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
+ clang::QualType BuildType(clang::ASTContext &ast_ctx, StringLexer &type,
bool for_expression,
uint32_t *bitfield_bit_size = nullptr);
- clang::QualType BuildStruct(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
+ clang::QualType BuildStruct(clang::ASTContext &ast_ctx, StringLexer &type,
bool for_expression);
- clang::QualType BuildAggregate(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
+ clang::QualType BuildAggregate(clang::ASTContext &ast_ctx, StringLexer &type,
bool for_expression, char opener, char closer,
uint32_t kind);
- clang::QualType BuildUnion(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
+ clang::QualType BuildUnion(clang::ASTContext &ast_ctx, StringLexer &type,
bool for_expression);
- clang::QualType BuildArray(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
+ clang::QualType BuildArray(clang::ASTContext &ast_ctx, StringLexer &type,
bool for_expression);
- std::string ReadStructName(lldb_utility::StringLexer &type);
+ std::string ReadStructName(StringLexer &type);
- StructElement ReadStructElement(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
+ StructElement ReadStructElement(clang::ASTContext &ast_ctx, StringLexer &type,
bool for_expression);
clang::QualType BuildObjCObjectPointerType(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
+ StringLexer &type,
bool for_expression);
- uint32_t ReadNumber(lldb_utility::StringLexer &type);
+ uint32_t ReadNumber(StringLexer &type);
- std::string ReadQuotedString(lldb_utility::StringLexer &type);
+ std::string ReadQuotedString(StringLexer &type);
ObjCLanguageRuntime &m_runtime;
};
Modified: lldb/trunk/source/Utility/StringLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringLexer.cpp?rev=369485&r1=369484&r2=369485&view=diff
==============================================================================
--- lldb/trunk/source/Utility/StringLexer.cpp (original)
+++ lldb/trunk/source/Utility/StringLexer.cpp Tue Aug 20 17:50:46 2019
@@ -11,7 +11,7 @@
#include <algorithm>
#include <assert.h>
-using namespace lldb_utility;
+using namespace lldb_private;
StringLexer::StringLexer(std::string s) : m_data(s), m_position(0) {}
Modified: lldb/trunk/unittests/Utility/AnsiTerminalTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/AnsiTerminalTest.cpp?rev=369485&r1=369484&r2=369485&view=diff
==============================================================================
--- lldb/trunk/unittests/Utility/AnsiTerminalTest.cpp (original)
+++ lldb/trunk/unittests/Utility/AnsiTerminalTest.cpp Tue Aug 20 17:50:46 2019
@@ -10,7 +10,7 @@
#include "lldb/Utility/AnsiTerminal.h"
-using namespace lldb_utility;
+using namespace lldb_private;
TEST(AnsiTerminal, Empty) { EXPECT_EQ("", ansi::FormatAnsiTerminalCodes("")); }
Modified: lldb/trunk/unittests/Utility/StringLexerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/StringLexerTest.cpp?rev=369485&r1=369484&r2=369485&view=diff
==============================================================================
--- lldb/trunk/unittests/Utility/StringLexerTest.cpp (original)
+++ lldb/trunk/unittests/Utility/StringLexerTest.cpp Tue Aug 20 17:50:46 2019
@@ -9,7 +9,7 @@
#include "lldb/Utility/StringLexer.h"
#include "gtest/gtest.h"
-using namespace lldb_utility;
+using namespace lldb_private;
TEST(StringLexerTest, GetUnlexed) {
StringLexer l("foo");
More information about the lldb-commits
mailing list