[Lldb-commits] [lldb] r300377 - [Interpreter] Make a static func a lambda and remove always_inline.

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 14 15:36:08 PDT 2017


Author: davide
Date: Fri Apr 14 17:36:08 2017
New Revision: 300377

URL: http://llvm.org/viewvc/llvm-project?rev=300377&view=rev
Log:
[Interpreter] Make a static func a lambda and remove always_inline.

The attribute was fairly dubious as: a) we shouldn't tell the compiler
when to inline functions, b) GCC complains that the function may be
not always inlinable.

Modified:
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=300377&r1=300376&r2=300377&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Fri Apr 14 17:36:08 2017
@@ -2542,14 +2542,6 @@ void CommandInterpreter::OutputFormatted
   OutputFormattedHelpText(strm, prefix_stream.GetString(), help_text);
 }
 
-LLVM_ATTRIBUTE_ALWAYS_INLINE
-static size_t nextWordLength(llvm::StringRef S) {
-  size_t pos = S.find_first_of(' ');
-  if (pos == llvm::StringRef::npos)
-    return S.size();
-  return pos;
-}
-
 void CommandInterpreter::OutputHelpText(Stream &strm, llvm::StringRef word_text,
                                         llvm::StringRef separator,
                                         llvm::StringRef help_text,
@@ -2568,6 +2560,11 @@ void CommandInterpreter::OutputHelpText(
 
   uint32_t chars_left = max_columns;
 
+  auto nextWordLength = [](llvm::StringRef S) {
+    size_t pos = S.find_first_of(' ');
+    return pos == llvm::StringRef::npos ? S.size() : pos;
+  };
+
   while (!text.empty()) {
     if (text.front() == '\n' ||
         (text.front() == ' ' && nextWordLength(text.ltrim(' ')) < chars_left)) {




More information about the lldb-commits mailing list