aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Breakpoint/BreakpointID.cpp
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/source/Breakpoint/BreakpointID.cpp
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadllvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.bz2
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
Diffstat (limited to 'lldb/source/Breakpoint/BreakpointID.cpp')
-rw-r--r--lldb/source/Breakpoint/BreakpointID.cpp167
1 files changed, 77 insertions, 90 deletions
diff --git a/lldb/source/Breakpoint/BreakpointID.cpp b/lldb/source/Breakpoint/BreakpointID.cpp
index 81a3dfe..9ab7adf 100644
--- a/lldb/source/Breakpoint/BreakpointID.cpp
+++ b/lldb/source/Breakpoint/BreakpointID.cpp
@@ -13,121 +13,108 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Breakpoint/BreakpointID.h"
#include "lldb/Breakpoint/Breakpoint.h"
-#include "lldb/Core/Stream.h"
+#include "lldb/Breakpoint/BreakpointID.h"
#include "lldb/Core/Error.h"
+#include "lldb/Core/Stream.h"
using namespace lldb;
using namespace lldb_private;
-BreakpointID::BreakpointID (break_id_t bp_id, break_id_t loc_id) :
- m_break_id (bp_id),
- m_location_id (loc_id)
-{
-}
+BreakpointID::BreakpointID(break_id_t bp_id, break_id_t loc_id)
+ : m_break_id(bp_id), m_location_id(loc_id) {}
BreakpointID::~BreakpointID() = default;
-const char *BreakpointID::g_range_specifiers[] = { "-", "to", "To", "TO", nullptr };
+const char *BreakpointID::g_range_specifiers[] = {"-", "to", "To", "TO",
+ nullptr};
-// Tells whether or not STR is valid to use between two strings representing breakpoint IDs, to
-// indicate a range of breakpoint IDs. This is broken out into a separate function so that we can
+// Tells whether or not STR is valid to use between two strings representing
+// breakpoint IDs, to
+// indicate a range of breakpoint IDs. This is broken out into a separate
+// function so that we can
// easily change or add to the format for specifying ID ranges at a later date.
-bool
-BreakpointID::IsRangeIdentifier (const char *str)
-{
- int specifier_count = 0;
- for (int i = 0; g_range_specifiers[i] != nullptr; ++i)
- ++specifier_count;
-
- for (int i = 0; i < specifier_count; ++i)
- {
- if (strcmp (g_range_specifiers[i], str) == 0)
- return true;
- }
+bool BreakpointID::IsRangeIdentifier(const char *str) {
+ int specifier_count = 0;
+ for (int i = 0; g_range_specifiers[i] != nullptr; ++i)
+ ++specifier_count;
+
+ for (int i = 0; i < specifier_count; ++i) {
+ if (strcmp(g_range_specifiers[i], str) == 0)
+ return true;
+ }
return false;
}
-bool
-BreakpointID::IsValidIDExpression (const char *str)
-{
- break_id_t bp_id;
- break_id_t loc_id;
- BreakpointID::ParseCanonicalReference (str, &bp_id, &loc_id);
+bool BreakpointID::IsValidIDExpression(const char *str) {
+ break_id_t bp_id;
+ break_id_t loc_id;
+ BreakpointID::ParseCanonicalReference(str, &bp_id, &loc_id);
- return (bp_id != LLDB_INVALID_BREAK_ID);
+ return (bp_id != LLDB_INVALID_BREAK_ID);
}
-void
-BreakpointID::GetDescription (Stream *s, lldb::DescriptionLevel level)
-{
- if (level == eDescriptionLevelVerbose)
- s->Printf("%p BreakpointID:", static_cast<void*>(this));
-
- if (m_break_id == LLDB_INVALID_BREAK_ID)
- s->PutCString ("<invalid>");
- else if (m_location_id == LLDB_INVALID_BREAK_ID)
- s->Printf("%i", m_break_id);
- else
- s->Printf("%i.%i", m_break_id, m_location_id);
+void BreakpointID::GetDescription(Stream *s, lldb::DescriptionLevel level) {
+ if (level == eDescriptionLevelVerbose)
+ s->Printf("%p BreakpointID:", static_cast<void *>(this));
+
+ if (m_break_id == LLDB_INVALID_BREAK_ID)
+ s->PutCString("<invalid>");
+ else if (m_location_id == LLDB_INVALID_BREAK_ID)
+ s->Printf("%i", m_break_id);
+ else
+ s->Printf("%i.%i", m_break_id, m_location_id);
}
-void
-BreakpointID::GetCanonicalReference (Stream *s, break_id_t bp_id, break_id_t loc_id)
-{
- if (bp_id == LLDB_INVALID_BREAK_ID)
- s->PutCString ("<invalid>");
- else if (loc_id == LLDB_INVALID_BREAK_ID)
- s->Printf("%i", bp_id);
- else
- s->Printf("%i.%i", bp_id, loc_id);
+void BreakpointID::GetCanonicalReference(Stream *s, break_id_t bp_id,
+ break_id_t loc_id) {
+ if (bp_id == LLDB_INVALID_BREAK_ID)
+ s->PutCString("<invalid>");
+ else if (loc_id == LLDB_INVALID_BREAK_ID)
+ s->Printf("%i", bp_id);
+ else
+ s->Printf("%i.%i", bp_id, loc_id);
}
-bool
-BreakpointID::ParseCanonicalReference (const char *input, break_id_t *break_id_ptr, break_id_t *break_loc_id_ptr)
-{
- *break_id_ptr = LLDB_INVALID_BREAK_ID;
- *break_loc_id_ptr = LLDB_INVALID_BREAK_ID;
-
- if (input == nullptr || *input == '\0')
- return false;
-
- const char *format = "%i%n.%i%n";
- int chars_consumed_1 = 0;
- int chars_consumed_2 = 0;
- int n_items_parsed = ::sscanf (input,
- format,
- break_id_ptr, // %i parse the breakpoint ID
- &chars_consumed_1, // %n gets the number of characters parsed so far
- break_loc_id_ptr, // %i parse the breakpoint location ID
- &chars_consumed_2); // %n gets the number of characters parsed so far
-
- if ((n_items_parsed == 1 && input[chars_consumed_1] == '\0') ||
- (n_items_parsed == 2 && input[chars_consumed_2] == '\0'))
- return true;
-
- // Badly formatted canonical reference.
- *break_id_ptr = LLDB_INVALID_BREAK_ID;
- *break_loc_id_ptr = LLDB_INVALID_BREAK_ID;
+bool BreakpointID::ParseCanonicalReference(const char *input,
+ break_id_t *break_id_ptr,
+ break_id_t *break_loc_id_ptr) {
+ *break_id_ptr = LLDB_INVALID_BREAK_ID;
+ *break_loc_id_ptr = LLDB_INVALID_BREAK_ID;
+
+ if (input == nullptr || *input == '\0')
return false;
+
+ const char *format = "%i%n.%i%n";
+ int chars_consumed_1 = 0;
+ int chars_consumed_2 = 0;
+ int n_items_parsed = ::sscanf(
+ input, format,
+ break_id_ptr, // %i parse the breakpoint ID
+ &chars_consumed_1, // %n gets the number of characters parsed so far
+ break_loc_id_ptr, // %i parse the breakpoint location ID
+ &chars_consumed_2); // %n gets the number of characters parsed so far
+
+ if ((n_items_parsed == 1 && input[chars_consumed_1] == '\0') ||
+ (n_items_parsed == 2 && input[chars_consumed_2] == '\0'))
+ return true;
+
+ // Badly formatted canonical reference.
+ *break_id_ptr = LLDB_INVALID_BREAK_ID;
+ *break_loc_id_ptr = LLDB_INVALID_BREAK_ID;
+ return false;
}
-bool
-BreakpointID::StringIsBreakpointName(const char *name, Error &error)
-{
- error.Clear();
-
- if (name && (name[0] >= 'A' && name[0] <= 'z'))
- {
- if (strcspn(name, ".- ") != strlen(name))
- {
- error.SetErrorStringWithFormat("invalid breakpoint name: \"%s\"", name);
- }
- return true;
+bool BreakpointID::StringIsBreakpointName(const char *name, Error &error) {
+ error.Clear();
+
+ if (name && (name[0] >= 'A' && name[0] <= 'z')) {
+ if (strcspn(name, ".- ") != strlen(name)) {
+ error.SetErrorStringWithFormat("invalid breakpoint name: \"%s\"", name);
}
- else
- return false;
+ return true;
+ } else
+ return false;
}