[PATCH] D111980: [Flang][flang-omp-report] Switch from std::string to StringRef (where possible)
Andrzej Warzynski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 20 00:56:38 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG660c511e5b79: [Flang][flang-omp-report] Switch from std::string to StringRef (where possible) (authored by josh.mottley.arm, committed by awarzynski).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111980/new/
https://reviews.llvm.org/D111980
Files:
flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp
flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.h
Index: flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.h
===================================================================
--- flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.h
+++ flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.h
@@ -14,6 +14,7 @@
#include "flang/Parser/parsing.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
#include <deque>
#include <map>
@@ -48,7 +49,7 @@
struct OpenMPCounterVisitor {
std::string normalize_construct_name(std::string s);
- ClauseInfo normalize_clause_name(const std::string &s);
+ ClauseInfo normalize_clause_name(const llvm::StringRef s);
SourcePosition getLocation(const OmpWrapperType &w);
SourcePosition getLocation(const OpenMPDeclarativeConstruct &c);
SourcePosition getLocation(const OpenMPConstruct &c);
Index: flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp
===================================================================
--- flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp
+++ flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "flang-omp-report-visitor.h"
+#include "llvm/ADT/StringExtras.h"
namespace Fortran {
namespace parser {
@@ -26,23 +27,24 @@
std::string OpenMPCounterVisitor::normalize_construct_name(std::string s) {
std::transform(s.begin(), s.end(), s.begin(),
- [](unsigned char c) { return std::tolower(c); });
+ [](unsigned char c) { return llvm::toLower(c); });
return s;
}
-ClauseInfo OpenMPCounterVisitor::normalize_clause_name(const std::string &s) {
+ClauseInfo OpenMPCounterVisitor::normalize_clause_name(
+ const llvm::StringRef s) {
std::size_t start = s.find('(');
std::size_t end = s.find(')');
std::string clauseName;
- if (start != std::string::npos && end != std::string::npos) {
+ if (start != llvm::StringRef::npos && end != llvm::StringRef::npos) {
clauseName = s.substr(0, start);
clauseDetails = s.substr(start + 1, end - start - 1);
} else {
clauseName = s;
}
std::transform(clauseName.begin(), clauseName.end(), clauseName.begin(),
- [](unsigned char c) { return std::tolower(c); });
+ [](unsigned char c) { return llvm::toLower(c); });
std::transform(clauseDetails.begin(), clauseDetails.end(),
- clauseDetails.begin(), [](unsigned char c) { return std::tolower(c); });
+ clauseDetails.begin(), [](unsigned char c) { return llvm::toLower(c); });
return ClauseInfo{clauseName, clauseDetails};
}
SourcePosition OpenMPCounterVisitor::getLocation(const OmpWrapperType &w) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111980.380866.patch
Type: text/x-patch
Size: 2715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211020/d849d924/attachment.bin>
More information about the llvm-commits
mailing list