[Lldb-commits] [lldb] r294741 - UriParser cleanup
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 10 04:21:23 PST 2017
Author: labath
Date: Fri Feb 10 06:21:22 2017
New Revision: 294741
URL: http://llvm.org/viewvc/llvm-project?rev=294741&view=rev
Log:
UriParser cleanup
- move the header file to the include folder
- enclose the class in the proper namespace
Added:
lldb/trunk/include/lldb/Utility/UriParser.h
- copied, changed from r294739, lldb/trunk/source/Utility/UriParser.h
Removed:
lldb/trunk/source/Utility/UriParser.h
Modified:
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
lldb/trunk/source/Utility/UriParser.cpp
lldb/trunk/tools/lldb-server/Acceptor.cpp
lldb/trunk/unittests/Utility/UriParserTest.cpp
Copied: lldb/trunk/include/lldb/Utility/UriParser.h (from r294739, lldb/trunk/source/Utility/UriParser.h)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/UriParser.h?p2=lldb/trunk/include/lldb/Utility/UriParser.h&p1=lldb/trunk/source/Utility/UriParser.h&r1=294739&r2=294741&rev=294741&view=diff
==============================================================================
--- lldb/trunk/source/Utility/UriParser.h (original)
+++ lldb/trunk/include/lldb/Utility/UriParser.h Fri Feb 10 06:21:22 2017
@@ -10,14 +10,9 @@
#ifndef utility_UriParser_h_
#define utility_UriParser_h_
-// C Includes
-// C++ Includes
-
-// Other libraries and framework includes
#include "llvm/ADT/StringRef.h"
-// Project includes
-
+namespace lldb_private {
class UriParser {
public:
// Parses
@@ -32,5 +27,6 @@ public:
llvm::StringRef &hostname, int &port,
llvm::StringRef &path);
};
+}
#endif // utility_UriParser_h_
Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp?rev=294741&r1=294740&r2=294741&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp Fri Feb 10 06:21:22 2017
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-#include "Utility/UriParser.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
@@ -19,6 +15,7 @@
#include "lldb/Core/ValueObject.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/StringConvert.h"
+#include "lldb/Utility/UriParser.h"
// Project includes
#include "AdbClient.h"
Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp?rev=294741&r1=294740&r2=294741&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp Fri Feb 10 06:21:22 2017
@@ -12,9 +12,9 @@
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/common/TCPSocket.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/UriParser.h"
#include "PlatformAndroidRemoteGDBServer.h"
-#include "Utility/UriParser.h"
#include <sstream>
Modified: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=294741&r1=294740&r2=294741&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Fri Feb 10 06:21:22 2017
@@ -30,8 +30,7 @@
#include "lldb/Target/Target.h"
#include "lldb/Utility/Error.h"
#include "lldb/Utility/StreamString.h"
-
-#include "Utility/UriParser.h"
+#include "lldb/Utility/UriParser.h"
#include "Plugins/Process/Utility/GDBRemoteSignals.h"
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp?rev=294741&r1=294740&r2=294741&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Fri Feb 10 06:21:22 2017
@@ -42,6 +42,7 @@
#include "lldb/Utility/JSON.h"
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/UriParser.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Support/ScopedPrinter.h"
@@ -49,7 +50,6 @@
#include "ProcessGDBRemote.h"
#include "ProcessGDBRemoteLog.h"
#include "Utility/StringExtractorGDBRemote.h"
-#include "Utility/UriParser.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp?rev=294741&r1=294740&r2=294741&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp Fri Feb 10 06:21:22 2017
@@ -36,10 +36,10 @@
#include "lldb/Target/UnixSignals.h"
#include "lldb/Utility/JSON.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/UriParser.h"
// Project includes
#include "Utility/StringExtractorGDBRemote.h"
-#include "Utility/UriParser.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/source/Utility/UriParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/UriParser.cpp?rev=294741&r1=294740&r2=294741&view=diff
==============================================================================
--- lldb/trunk/source/Utility/UriParser.cpp (original)
+++ lldb/trunk/source/Utility/UriParser.cpp Fri Feb 10 06:21:22 2017
@@ -7,16 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include "Utility/UriParser.h"
-
-// C Includes
-
-// C++ Includes
-#include <cstring>
-
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Host/StringConvert.h"
+#include "lldb/Utility/UriParser.h"
using namespace lldb_private;
Removed: lldb/trunk/source/Utility/UriParser.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/UriParser.h?rev=294740&view=auto
==============================================================================
--- lldb/trunk/source/Utility/UriParser.h (original)
+++ lldb/trunk/source/Utility/UriParser.h (removed)
@@ -1,36 +0,0 @@
-//===-- UriParser.h ---------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef utility_UriParser_h_
-#define utility_UriParser_h_
-
-// C Includes
-// C++ Includes
-
-// Other libraries and framework includes
-#include "llvm/ADT/StringRef.h"
-
-// Project includes
-
-class UriParser {
-public:
- // Parses
- // RETURN VALUE
- // if url is valid, function returns true and
- // scheme/hostname/port/path are set to the parsed values
- // port it set to -1 if it is not included in the URL
- //
- // if the url is invalid, function returns false and
- // output parameters remain unchanged
- static bool Parse(llvm::StringRef uri, llvm::StringRef &scheme,
- llvm::StringRef &hostname, int &port,
- llvm::StringRef &path);
-};
-
-#endif // utility_UriParser_h_
Modified: lldb/trunk/tools/lldb-server/Acceptor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/Acceptor.cpp?rev=294741&r1=294740&r2=294741&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/Acceptor.cpp (original)
+++ lldb/trunk/tools/lldb-server/Acceptor.cpp Fri Feb 10 06:21:22 2017
@@ -15,8 +15,7 @@
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/common/TCPSocket.h"
#include "lldb/Utility/StreamString.h"
-
-#include "Utility/UriParser.h"
+#include "lldb/Utility/UriParser.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/unittests/Utility/UriParserTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/UriParserTest.cpp?rev=294741&r1=294740&r2=294741&view=diff
==============================================================================
--- lldb/trunk/unittests/Utility/UriParserTest.cpp (original)
+++ lldb/trunk/unittests/Utility/UriParserTest.cpp Fri Feb 10 06:21:22 2017
@@ -1,9 +1,7 @@
-#include "Utility/UriParser.h"
+#include "lldb/Utility/UriParser.h"
#include "gtest/gtest.h"
-namespace {
-class UriParserTest : public ::testing::Test {};
-}
+using namespace lldb_private;
// result strings (scheme/hostname/port/path) passed into UriParser::Parse
// are initialized to kAsdf so we can verify that they are unmodified if the
@@ -41,12 +39,12 @@ public:
EXPECT_EQ(testCase.m_port, port); \
EXPECT_STREQ(testCase.m_path, path.str().c_str());
-TEST_F(UriParserTest, Minimal) {
+TEST(UriParserTest, Minimal) {
const UriTestCase testCase("x://y", "x", "y", -1, "/");
VALIDATE
}
-TEST_F(UriParserTest, MinimalPort) {
+TEST(UriParserTest, MinimalPort) {
const UriTestCase testCase("x://y:1", "x", "y", 1, "/");
llvm::StringRef scheme(kAsdf);
llvm::StringRef hostname(kAsdf);
@@ -61,28 +59,28 @@ TEST_F(UriParserTest, MinimalPort) {
EXPECT_STREQ(testCase.m_path, path.str().c_str());
}
-TEST_F(UriParserTest, MinimalPath) {
+TEST(UriParserTest, MinimalPath) {
const UriTestCase testCase("x://y/", "x", "y", -1, "/");
VALIDATE
}
-TEST_F(UriParserTest, MinimalPortPath) {
+TEST(UriParserTest, MinimalPortPath) {
const UriTestCase testCase("x://y:1/", "x", "y", 1, "/");
VALIDATE
}
-TEST_F(UriParserTest, LongPath) {
+TEST(UriParserTest, LongPath) {
const UriTestCase testCase("x://y/abc/def/xyz", "x", "y", -1, "/abc/def/xyz");
VALIDATE
}
-TEST_F(UriParserTest, TypicalPortPath) {
+TEST(UriParserTest, TypicalPortPath) {
const UriTestCase testCase("connect://192.168.100.132:5432/", "connect",
"192.168.100.132", 5432, "/");
VALIDATE;
}
-TEST_F(UriParserTest, BracketedHostnamePort) {
+TEST(UriParserTest, BracketedHostnamePort) {
const UriTestCase testCase("connect://[192.168.100.132]:5432/", "connect",
"192.168.100.132", 5432, "/");
llvm::StringRef scheme(kAsdf);
@@ -98,54 +96,54 @@ TEST_F(UriParserTest, BracketedHostnameP
EXPECT_STREQ(testCase.m_path, path.str().c_str());
}
-TEST_F(UriParserTest, BracketedHostname) {
+TEST(UriParserTest, BracketedHostname) {
const UriTestCase testCase("connect://[192.168.100.132]", "connect",
"192.168.100.132", -1, "/");
VALIDATE
}
-TEST_F(UriParserTest, BracketedHostnameWithColon) {
+TEST(UriParserTest, BracketedHostnameWithColon) {
const UriTestCase testCase("connect://[192.168.100.132:5555]:1234", "connect",
"192.168.100.132:5555", 1234, "/");
VALIDATE
}
-TEST_F(UriParserTest, SchemeHostSeparator) {
+TEST(UriParserTest, SchemeHostSeparator) {
const UriTestCase testCase("x:/y");
VALIDATE
}
-TEST_F(UriParserTest, SchemeHostSeparator2) {
+TEST(UriParserTest, SchemeHostSeparator2) {
const UriTestCase testCase("x:y");
VALIDATE
}
-TEST_F(UriParserTest, SchemeHostSeparator3) {
+TEST(UriParserTest, SchemeHostSeparator3) {
const UriTestCase testCase("x//y");
VALIDATE
}
-TEST_F(UriParserTest, SchemeHostSeparator4) {
+TEST(UriParserTest, SchemeHostSeparator4) {
const UriTestCase testCase("x/y");
VALIDATE
}
-TEST_F(UriParserTest, BadPort) {
+TEST(UriParserTest, BadPort) {
const UriTestCase testCase("x://y:a/");
VALIDATE
}
-TEST_F(UriParserTest, BadPort2) {
+TEST(UriParserTest, BadPort2) {
const UriTestCase testCase("x://y:5432a/");
VALIDATE
}
-TEST_F(UriParserTest, Empty) {
+TEST(UriParserTest, Empty) {
const UriTestCase testCase("");
VALIDATE
}
-TEST_F(UriParserTest, PortOverflow) {
+TEST(UriParserTest, PortOverflow) {
const UriTestCase testCase("x://"
"y:"
"0123456789012345678901234567890123456789012345678"
More information about the lldb-commits
mailing list