Skip to content

Commit f903491

Browse files
committed
Progressively convert to enum classes
1 parent 9218906 commit f903491

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

mlir/include/mlir/Query/Matcher/Diagnostics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class Diagnostics {
103103

104104
private:
105105
// Parser context types.
106-
enum ContextType { CT_MatcherArg, CT_MatcherConstruct };
106+
enum class ContextType { MatcherArg, MatcherConstruct };
107107

108108
// Context for managing overloaded matcher construction.
109109
struct OverloadContext {

mlir/lib/Query/Matcher/Diagnostics.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ Diagnostics::Context::Context(ConstructMatcherEnum, Diagnostics *error,
2323
llvm::StringRef matcherName,
2424
SourceRange matcherRange)
2525
: error(error) {
26-
error->pushContextFrame(CT_MatcherConstruct, matcherRange) << matcherName;
26+
error->pushContextFrame(ContextType::MatcherConstruct, matcherRange)
27+
<< matcherName;
2728
}
2829

2930
Diagnostics::Context::Context(MatcherArgEnum, Diagnostics *error,
3031
llvm::StringRef matcherName,
3132
SourceRange matcherRange, int argnumber)
3233
: error(error) {
33-
error->pushContextFrame(CT_MatcherArg, matcherRange)
34+
error->pushContextFrame(ContextType::MatcherArg, matcherRange)
3435
<< argnumber << matcherName;
3536
}
3637

@@ -75,9 +76,9 @@ Diagnostics::ArgStream Diagnostics::addError(SourceRange range,
7576
llvm::StringRef
7677
Diagnostics::contextTypeToFormatString(Diagnostics::ContextType type) const {
7778
switch (type) {
78-
case Diagnostics::CT_MatcherConstruct:
79+
case Diagnostics::ContextType::MatcherConstruct:
7980
return "Error building matcher $0.";
80-
case Diagnostics::CT_MatcherArg:
81+
case Diagnostics::ContextType::MatcherArg:
8182
return "Error parsing argument $0 for matcher $1.";
8283
}
8384
llvm_unreachable("Unknown ContextType value.");

0 commit comments

Comments
 (0)