[LLDB] Remove cases of using namespace std
authorShafik Yaghmour <syaghmour@apple.com>
Fri, 4 Mar 2022 20:50:25 +0000 (12:50 -0800)
committerShafik Yaghmour <syaghmour@apple.com>
Fri, 4 Mar 2022 20:50:25 +0000 (12:50 -0800)
We had using namespace std; sprinkled around several source files and tests.

Differential Revision: https://reviews.llvm.org/D120966

lldb/source/Core/FileSpecList.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/test/API/api/multithreaded/inferior.cpp
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/main.cpp
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/main.cpp
lldb/test/API/functionalities/process_save_core_minidump/main.cpp
lldb/test/API/functionalities/thread/concurrent_events/main.cpp
lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp

index 1a1cf28..8eec8f4 100644 (file)
@@ -16,7 +16,6 @@
 #include <cstdint>
 
 using namespace lldb_private;
-using namespace std;
 
 FileSpecList::FileSpecList() : m_files() {}
 
index 0f0f50a..d890288 100644 (file)
@@ -12,7 +12,6 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using namespace std;
 
 // DWARFAbbreviationDeclarationSet::Clear()
 void DWARFAbbreviationDeclarationSet::Clear() {
index b72c740..8933b08 100644 (file)
@@ -27,7 +27,6 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using namespace std;
 
 // Constructor
 DWARFDebugInfo::DWARFDebugInfo(SymbolFileDWARF &dwarf,
index 01046fb..95c0cb6 100644 (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
index 812a808..085c9e9 100644 (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();
index 9dbb289..3755bdd 100644 (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;
 }
 
index 449be8d..f3b5f32 100644 (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;
 }
index 1c0d0f2..beb44cd 100644 (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
 }
index 49b471a..fa34a37 100644 (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;
-}
\ No newline at end of file
+}
index 363be7b..a6e087f 100644 (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);