[Lldb-commits] [PATCH] D44055: [lldb] Fix "requires global constructor" warning in g_range_specifiers

2018-03-03 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

BTW, to appease older versions of gcc you will need to write the initializer as 
`= {{"-"}, {"to"}, ...}` (i.e. add extra {} around the strings).


https://reviews.llvm.org/D44055



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44055: [lldb] Fix "requires global constructor" warning in g_range_specifiers

2018-03-03 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

LGTM with Pavel's suggestion implemented.


https://reviews.llvm.org/D44055



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44055: [lldb] Fix "requires global constructor" warning in g_range_specifiers

2018-03-02 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: source/Breakpoint/BreakpointID.cpp:49
 llvm::ArrayRef BreakpointID::GetRangeSpecifiers() {
+  static llvm::StringRef g_range_specifiers[] = {"-", "to", "To", "TO"};
   return llvm::makeArrayRef(g_range_specifiers);

You can probably make this `static constexpr llvm::StringLiteral` and avoid 
constructors altogether..


https://reviews.llvm.org/D44055



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44055: [lldb] Fix "requires global constructor" warning in g_range_specifiers

2018-03-02 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubamracek created this revision.
kubamracek added reviewers: jingham, davide, jasonmolenda, aprantl.

https://reviews.llvm.org/D44055

Files:
  source/Breakpoint/BreakpointID.cpp


Index: source/Breakpoint/BreakpointID.cpp
===
--- source/Breakpoint/BreakpointID.cpp
+++ source/Breakpoint/BreakpointID.cpp
@@ -26,16 +26,14 @@
 
 BreakpointID::~BreakpointID() = default;
 
-static llvm::StringRef g_range_specifiers[] = {"-", "to", "To", "TO"};
-
 // 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(llvm::StringRef str) {
-  for (auto spec : g_range_specifiers) {
+  for (auto spec : GetRangeSpecifiers()) {
 if (spec == str)
   return true;
   }
@@ -48,6 +46,7 @@
 }
 
 llvm::ArrayRef BreakpointID::GetRangeSpecifiers() {
+  static llvm::StringRef g_range_specifiers[] = {"-", "to", "To", "TO"};
   return llvm::makeArrayRef(g_range_specifiers);
 }
 


Index: source/Breakpoint/BreakpointID.cpp
===
--- source/Breakpoint/BreakpointID.cpp
+++ source/Breakpoint/BreakpointID.cpp
@@ -26,16 +26,14 @@
 
 BreakpointID::~BreakpointID() = default;
 
-static llvm::StringRef g_range_specifiers[] = {"-", "to", "To", "TO"};
-
 // 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(llvm::StringRef str) {
-  for (auto spec : g_range_specifiers) {
+  for (auto spec : GetRangeSpecifiers()) {
 if (spec == str)
   return true;
   }
@@ -48,6 +46,7 @@
 }
 
 llvm::ArrayRef BreakpointID::GetRangeSpecifiers() {
+  static llvm::StringRef g_range_specifiers[] = {"-", "to", "To", "TO"};
   return llvm::makeArrayRef(g_range_specifiers);
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits