[Lldb-commits] [lldb] 9bd72b5 - [LLDB] Remove cases of using namespace std

Shafik Yaghmour via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 4 12:51:25 PST 2022


Author: Shafik Yaghmour
Date: 2022-03-04T12:50:25-08:00
New Revision: 9bd72b5c258549b8743557a79c7929de38f05a6d

URL: https://github.com/llvm/llvm-project/commit/9bd72b5c258549b8743557a79c7929de38f05a6d
DIFF: https://github.com/llvm/llvm-project/commit/9bd72b5c258549b8743557a79c7929de38f05a6d.diff

LOG: [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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Core/FileSpecList.cpp b/lldb/source/Core/FileSpecList.cpp
index 1a1cf284ea07c..8eec8f499352c 100644
--- a/lldb/source/Core/FileSpecList.cpp
+++ b/lldb/source/Core/FileSpecList.cpp
@@ -16,7 +16,6 @@
 #include <cstdint>
 
 using namespace lldb_private;
-using namespace std;
 
 FileSpecList::FileSpecList() : m_files() {}
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
index 0f0f50a645db3..d890288cdf567 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
@@ -12,7 +12,6 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using namespace std;
 
 // DWARFAbbreviationDeclarationSet::Clear()
 void DWARFAbbreviationDeclarationSet::Clear() {

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index b72c7406ece13..8933b0804a01c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -27,7 +27,6 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using namespace std;
 
 // Constructor
 DWARFDebugInfo::DWARFDebugInfo(SymbolFileDWARF &dwarf,

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index 01046fb68b9d3..95c0cb6472c59 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -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

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 812a8086f4875..085c9e9ce1a6e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -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();

diff  --git a/lldb/test/API/api/multithreaded/inferior.cpp b/lldb/test/API/api/multithreaded/inferior.cpp
index 9dbb289f98be6..3755bdd04f880 100644
--- a/lldb/test/API/api/multithreaded/inferior.cpp
+++ b/lldb/test/API/api/multithreaded/inferior.cpp
@@ -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;
 }
 

diff  --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/main.cpp
index 449be8d99cf6e..f3b5f32817970 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/main.cpp
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/main.cpp
@@ -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;
 }

diff  --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/main.cpp
index 1c0d0f2ae7744..beb44cd960005 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/main.cpp
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/main.cpp
@@ -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
 }

diff  --git a/lldb/test/API/functionalities/process_save_core_minidump/main.cpp b/lldb/test/API/functionalities/process_save_core_minidump/main.cpp
index 49b471a4cc517..fa34a371f2064 100644
--- a/lldb/test/API/functionalities/process_save_core_minidump/main.cpp
+++ b/lldb/test/API/functionalities/process_save_core_minidump/main.cpp
@@ -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
+}

diff  --git a/lldb/test/API/functionalities/thread/concurrent_events/main.cpp b/lldb/test/API/functionalities/thread/concurrent_events/main.cpp
index 2e7cc3c8885f3..84d8c7015a796 100644
--- a/lldb/test/API/functionalities/thread/concurrent_events/main.cpp
+++ b/lldb/test/API/functionalities/thread/concurrent_events/main.cpp
@@ -6,7 +6,6 @@
 
 #include "pseudo_barrier.h"
 #include <vector>
-using namespace std;
 
 #include <pthread.h>
 

diff  --git a/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp b/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp
index 363be7b3c494d..a6e087fbf7980 100644
--- a/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp
+++ b/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp
@@ -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);


        


More information about the lldb-commits mailing list