[LLDB] Remove cases of using namespace std

We had using namespace std; sprinkled around several source files and tests.

Differential Revision: https://reviews.llvm.org/D120966
This commit is contained in:
Shafik Yaghmour 2022-03-04 12:50:25 -08:00
parent bde13a8102
commit 9bd72b5c25
11 changed files with 15 additions and 29 deletions

View File

@ -16,7 +16,6 @@
#include <cstdint>
using namespace lldb_private;
using namespace std;
FileSpecList::FileSpecList() : m_files() {}

View File

@ -12,7 +12,6 @@
using namespace lldb;
using namespace lldb_private;
using namespace std;
// DWARFAbbreviationDeclarationSet::Clear()
void DWARFAbbreviationDeclarationSet::Clear() {

View File

@ -27,7 +27,6 @@
using namespace lldb;
using namespace lldb_private;
using namespace std;
// Constructor
DWARFDebugInfo::DWARFDebugInfo(SymbolFileDWARF &dwarf,

View File

@ -32,7 +32,6 @@
using namespace lldb_private;
using namespace lldb_private::dwarf;
using namespace std;
extern int g_verbose;
// Extract a debug info entry for a given DWARFUnit from the data

View File

@ -26,7 +26,6 @@
using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::dwarf;
using namespace std;
extern int g_verbose;
@ -449,7 +448,7 @@ ParseListTableHeader(const llvm::DWARFDataExtractor &data, uint64_t offset,
uint64_t HeaderSize = llvm::DWARFListTableHeader::getHeaderSize(format);
if (offset < HeaderSize)
return llvm::createStringError(errc::invalid_argument,
return llvm::createStringError(std::errc::invalid_argument,
"did not detect a valid"
" list table with base = 0x%" PRIx64 "\n",
offset);
@ -559,10 +558,10 @@ DWARFUnit::GetRnglistTable() {
// This function is called only for DW_FORM_rnglistx.
llvm::Expected<uint64_t> DWARFUnit::GetRnglistOffset(uint32_t Index) {
if (!GetRnglistTable())
return llvm::createStringError(errc::invalid_argument,
return llvm::createStringError(std::errc::invalid_argument,
"missing or invalid range list table");
if (!m_ranges_base)
return llvm::createStringError(errc::invalid_argument,
return llvm::createStringError(std::errc::invalid_argument,
"DW_FORM_rnglistx cannot be used without "
"DW_AT_rnglists_base for CU at 0x%8.8x",
GetOffset());
@ -570,7 +569,7 @@ llvm::Expected<uint64_t> DWARFUnit::GetRnglistOffset(uint32_t Index) {
GetRnglistData().GetAsLLVM(), Index))
return *off + m_ranges_base;
return llvm::createStringError(
errc::invalid_argument,
std::errc::invalid_argument,
"invalid range list table index %u; OffsetEntryCount is %u, "
"DW_AT_rnglists_base is %" PRIu64,
Index, GetRnglistTable()->getOffsetEntryCount(), m_ranges_base);
@ -999,7 +998,7 @@ DWARFUnit::FindRnglistFromOffset(dw_offset_t offset) {
}
if (!GetRnglistTable())
return llvm::createStringError(errc::invalid_argument,
return llvm::createStringError(std::errc::invalid_argument,
"missing or invalid range list table");
llvm::DWARFDataExtractor data = GetRnglistData().GetAsLLVM();

View File

@ -1,11 +1,11 @@
#include <iostream>
using namespace std;
int next() {
static int i = 0;
cout << "incrementing " << i << endl;
std::cout << "incrementing " << i << std::endl;
return ++i;
}

View File

@ -1,11 +1,9 @@
#include <queue>
#include <vector>
using namespace std;
int main() {
queue<int> q1{{1,2,3,4,5}};
queue<int, std::vector<int>> q2{{1,2,3,4,5}};
std::queue<int> q1{{1,2,3,4,5}};
std::queue<int, std::vector<int>> q2{{1,2,3,4,5}};
int ret = q1.size() + q2.size(); // break here
return ret;
}

View File

@ -1,11 +1,9 @@
#include <tuple>
#include <string>
using namespace std;
int main() {
tuple<> empty;
tuple<int> one_elt{47};
tuple<int, long, string> three_elts{1, 47l, "foo"};
std::tuple<> empty;
std::tuple<int> one_elt{47};
std::tuple<int, long, std::string> three_elts{1, 47l, "foo"};
return 0; // break here
}

View File

@ -2,8 +2,6 @@
#include <iostream>
#include <thread>
using namespace std;
void g() { assert(false); }
void f() { g(); }
@ -19,12 +17,12 @@ size_t h() {
}
int main() {
thread t1(f);
std::thread t1(f);
size_t x = h();
t1.join();
cout << "X is " << x << "\n";
std::cout << "X is " << x << "\n";
return 0;
}
}

View File

@ -6,7 +6,6 @@
#include "pseudo_barrier.h"
#include <vector>
using namespace std;
#include <pthread.h>

View File

@ -2,8 +2,6 @@
// Link with "link test-pdb-types.obj /debug /nodefaultlib /entry:main
// /out:test-pdb-types.exe"
using namespace std;
// Sizes of builtin types
static const int sizeof_char = sizeof(char);
static const int sizeof_uchar = sizeof(unsigned char);