[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.

llvm-svn: 369485
This commit is contained in:
Jonas Devlieghere 2019-08-21 00:50:46 +00:00
parent 1ecc507e2a
commit 4b3c0fd5da
11 changed files with 44 additions and 65 deletions

View File

@ -47,7 +47,7 @@ static inline ConstString GetValidTypeName_Impl(ConstString type) {
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 ");

View File

@ -55,7 +55,7 @@
#include <string>
namespace lldb_utility {
namespace lldb_private {
namespace ansi {
@ -137,4 +137,4 @@ inline std::string FormatAnsiTerminalCodes(llvm::StringRef format,
return fmt;
}
}
}
} // namespace lldb_private

View File

@ -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:

View File

@ -270,7 +270,7 @@ Status Debugger::SetPropertyValue(const ExecutionContext *exe_ctx,
// 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 p) {
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);

View File

@ -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(Stream &s, llvm::StringRef value) const {
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,

View File

@ -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::GetSP() {
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;
}

View File

@ -18,7 +18,6 @@
#include <vector>
using namespace lldb_private;
using namespace lldb_utility;
AppleObjCTypeEncodingParser::AppleObjCTypeEncodingParser(
ObjCLanguageRuntime &runtime)
@ -32,16 +31,14 @@ AppleObjCTypeEncodingParser::AppleObjCTypeEncodingParser(
.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::ReadQuotedString(lldb_utility::StringLexer &type) {
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::StructElement::StructElement()
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::ReadStructElement(clang::ASTContext &ast_ctx,
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 AppleObjCTypeEncodingParser::BuildAggregate(
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(clang::ASTContext &ast_ctx,
// 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();

View File

@ -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;
};

View File

@ -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) {}

View File

@ -10,7 +10,7 @@
#include "lldb/Utility/AnsiTerminal.h"
using namespace lldb_utility;
using namespace lldb_private;
TEST(AnsiTerminal, Empty) { EXPECT_EQ("", ansi::FormatAnsiTerminalCodes("")); }

View File

@ -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");