[flang] flang-omp-report replace std::map with llvm::DenseMap
This patch replaces the uses of std::map with llvm::DenseMap in the
flang-omp-report plugin. It also removed the 'constructClauseCount' map
due to no longer being needed after the plugin was stripped down.
This is a one of several patches focusing on switching containers from STL to LLVM's ADT library.
Reviewed By: kiranchandramohan, clementval
Differential Revision: https://reviews.llvm.org/D111977
GitOrigin-RevId: e9fe8ef4b0aa68be782a9139e08e9337ef79a462
diff --git a/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp b/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp
index ca56e83..f49e72f 100644
--- a/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp
+++ b/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp
@@ -252,14 +252,10 @@
if (ci.clause == "nowait") {
assert(curLoopLogRecord &&
"loop Construct should be visited before a nowait clause");
- constructClauseCount[std::make_pair(
- curLoopLogRecord->construct, ci.clause)]++;
curLoopLogRecord->clauses.push_back(ci);
} else {
assert(!ompWrapperStack.empty() &&
"Construct should be visited before clause");
- constructClauseCount[std::make_pair(
- getName(*ompWrapperStack.back()), ci.clause)]++;
clauseStrings[ompWrapperStack.back()].push_back(ci);
}
}
diff --git a/examples/flang-omp-report-plugin/flang-omp-report-visitor.h b/examples/flang-omp-report-plugin/flang-omp-report-visitor.h
index 4aeb719..188e8f9 100644
--- a/examples/flang-omp-report-plugin/flang-omp-report-visitor.h
+++ b/examples/flang-omp-report-plugin/flang-omp-report-visitor.h
@@ -13,11 +13,11 @@
#include "flang/Parser/parse-tree.h"
#include "flang/Parser/parsing.h"
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include <deque>
-#include <map>
#include <string>
namespace Fortran {
@@ -86,7 +86,6 @@
void Post(const DoConstruct &);
std::string clauseDetails{""};
- std::map<std::pair<std::string, std::string>, int> constructClauseCount;
// curLoopLogRecord and loopLogRecordStack store
// pointers to this datastructure's entries. Hence a
@@ -99,7 +98,7 @@
LogRecord *curLoopLogRecord{nullptr};
llvm::SmallVector<LogRecord *> loopLogRecordStack;
llvm::SmallVector<OmpWrapperType *> ompWrapperStack;
- std::map<OmpWrapperType *, llvm::SmallVector<ClauseInfo>> clauseStrings;
+ llvm::DenseMap<OmpWrapperType *, llvm::SmallVector<ClauseInfo>> clauseStrings;
Parsing *parsing{nullptr};
};
} // namespace parser