forked from OSchip/llvm-project
[fir][NFC] Fix couple of clang-tidy warnings
Fix some clang-tidy wrning in flang/Optimizer/Support and remove explicit number of inlined elements for SmallVector. This is mostly to sync with the changes from fir-dev. This patch is part of the upstreaming effort from fir-dev branch. Reviewed By: schweitz Differential Revision: https://reviews.llvm.org/D111044
This commit is contained in:
parent
e8477045f6
commit
1e96c4b508
|
@ -22,7 +22,7 @@
|
|||
|
||||
namespace mlir {
|
||||
class ModuleOp;
|
||||
}
|
||||
} // namespace mlir
|
||||
|
||||
namespace fir {
|
||||
class KindMapping;
|
||||
|
|
|
@ -54,10 +54,10 @@ struct NameUniquer {
|
|||
: modules{modules.begin(), modules.end()}, host{host}, name{name},
|
||||
kinds{kinds.begin(), kinds.end()} {}
|
||||
|
||||
llvm::SmallVector<std::string, 2> modules;
|
||||
llvm::SmallVector<std::string> modules;
|
||||
llvm::Optional<std::string> host;
|
||||
std::string name;
|
||||
llvm::SmallVector<std::int64_t, 4> kinds;
|
||||
llvm::SmallVector<std::int64_t> kinds;
|
||||
};
|
||||
|
||||
/// Unique a common block name
|
||||
|
|
|
@ -33,14 +33,14 @@ static constexpr const char *kindMapName = "fir.kindmap";
|
|||
static constexpr const char *defKindName = "fir.defaultkind";
|
||||
|
||||
void fir::setKindMapping(mlir::ModuleOp mod, fir::KindMapping &kindMap) {
|
||||
auto ctx = mod.getContext();
|
||||
auto *ctx = mod.getContext();
|
||||
mod->setAttr(kindMapName, mlir::StringAttr::get(ctx, kindMap.mapToString()));
|
||||
auto defs = kindMap.defaultsToString();
|
||||
mod->setAttr(defKindName, mlir::StringAttr::get(ctx, defs));
|
||||
}
|
||||
|
||||
fir::KindMapping fir::getKindMapping(mlir::ModuleOp mod) {
|
||||
auto ctx = mod.getContext();
|
||||
auto *ctx = mod.getContext();
|
||||
if (auto defs = mod->getAttrOfType<mlir::StringAttr>(defKindName)) {
|
||||
auto defVals = fir::KindMapping::toDefaultKinds(defs.getValue());
|
||||
if (auto maps = mod->getAttrOfType<mlir::StringAttr>(kindMapName))
|
||||
|
|
|
@ -21,7 +21,7 @@ static llvm::cl::opt<std::string> mainEntryName(
|
|||
llvm::cl::desc("override the name of the default PROGRAM entry (may be "
|
||||
"helpful for using other runtimes)"));
|
||||
|
||||
constexpr std::int64_t BAD_VALUE = -1;
|
||||
constexpr std::int64_t badValue = -1;
|
||||
|
||||
inline std::string prefix() { return "_Q"; }
|
||||
|
||||
|
@ -69,9 +69,9 @@ static std::int64_t readInt(llvm::StringRef uniq, std::size_t &i,
|
|||
for (i = init; i < end && uniq[i] >= '0' && uniq[i] <= '9'; ++i) {
|
||||
// do nothing
|
||||
}
|
||||
std::int64_t result = BAD_VALUE;
|
||||
std::int64_t result = badValue;
|
||||
if (uniq.substr(init, i - init).getAsInteger(10, result))
|
||||
return BAD_VALUE;
|
||||
return badValue;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -223,10 +223,10 @@ llvm::StringRef fir::NameUniquer::doProgramEntry() {
|
|||
std::pair<fir::NameUniquer::NameKind, fir::NameUniquer::DeconstructedName>
|
||||
fir::NameUniquer::deconstruct(llvm::StringRef uniq) {
|
||||
if (uniq.startswith("_Q")) {
|
||||
llvm::SmallVector<std::string, 4> modules;
|
||||
llvm::SmallVector<std::string> modules;
|
||||
llvm::Optional<std::string> host;
|
||||
std::string name;
|
||||
llvm::SmallVector<std::int64_t, 8> kinds;
|
||||
llvm::SmallVector<std::int64_t> kinds;
|
||||
NameKind nk = NameKind::NOT_UNIQUED;
|
||||
for (std::size_t i = 2, end{uniq.size()}; i != end;) {
|
||||
switch (uniq[i]) {
|
||||
|
|
|
@ -49,8 +49,8 @@ static constexpr const char *kwPPCFP128 = "PPC_FP128";
|
|||
/// Integral types default to the kind value being the size of the value in
|
||||
/// bytes. The default is to scale from bytes to bits.
|
||||
static Bitsize defaultScalingKind(KindTy kind) {
|
||||
const unsigned BITS_IN_BYTE = 8;
|
||||
return kind * BITS_IN_BYTE;
|
||||
const unsigned bitsInByte = 8;
|
||||
return kind * bitsInByte;
|
||||
}
|
||||
|
||||
/// Floating-point types default to the kind value being the size of the value
|
||||
|
|
Loading…
Reference in New Issue