diff options
author | River Riddle <riverriddle@google.com> | 2019-06-18 13:56:54 -0700 |
---|---|---|
committer | Mehdi Amini <joker.eph@gmail.com> | 2019-06-19 23:07:15 -0700 |
commit | 34cb51743d906e8475b44bc603a8f164b5f11f3a (patch) | |
tree | b9901022420f9c822b23d9e0a9eac60173df905f | |
parent | dee282c7da0dab85d2034fb74488affae0b6acb7 (diff) | |
download | bcm5719-llvm-34cb51743d906e8475b44bc603a8f164b5f11f3a.tar.gz bcm5719-llvm-34cb51743d906e8475b44bc603a8f164b5f11f3a.zip |
NFC: Append 'Location' to the end of each the location kinds. This is in preparation for making the location classes attributes instead of separate IR types.
PiperOrigin-RevId: 253860058
-rw-r--r-- | mlir/include/mlir/IR/Location.h | 16 | ||||
-rw-r--r-- | mlir/lib/IR/AsmPrinter.cpp | 8 | ||||
-rw-r--r-- | mlir/lib/IR/Diagnostics.cpp | 6 | ||||
-rw-r--r-- | mlir/lib/IR/LocationDetail.h | 11 |
4 files changed, 21 insertions, 20 deletions
diff --git a/mlir/include/mlir/IR/Location.h b/mlir/include/mlir/IR/Location.h index d04c98e37bf..8859b4403be 100644 --- a/mlir/include/mlir/IR/Location.h +++ b/mlir/include/mlir/IR/Location.h @@ -48,16 +48,16 @@ class Location { public: enum class Kind : uint8_t { /// This represents an unknown location. - Unknown, + UnknownLocation, /// This represents a file/line/column location. - FileLineCol, + FileLineColLocation, /// This represents an identity name attached to a child location. - Name, + NameLocation, /// This represents a location as a call site. - CallSite, + CallSiteLocation, // Represents a location as a 'void*' pointer to a front-end's opaque // location information, which must live longer than the MLIR objects that @@ -129,7 +129,7 @@ public: static UnknownLoc get(MLIRContext *context); /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool kindof(Kind kind) { return kind == Kind::Unknown; } + static bool kindof(Kind kind) { return kind == Kind::UnknownLocation; } }; /// Represents a location derived from a file/line/column location. The column @@ -152,7 +152,7 @@ public: unsigned getColumn() const; /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool kindof(Kind kind) { return kind == Kind::FileLineCol; } + static bool kindof(Kind kind) { return kind == Kind::FileLineColLocation; } }; /// Represents an identity name attached to a child location. @@ -175,7 +175,7 @@ public: Location getChildLoc() const; /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool kindof(Kind kind) { return kind == Kind::Name; } + static bool kindof(Kind kind) { return kind == Kind::NameLocation; } }; /// Represents a location as call site. "callee" is the concrete location @@ -204,7 +204,7 @@ public: Location getCaller() const; /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool kindof(Kind kind) { return kind == Kind::CallSite; } + static bool kindof(Kind kind) { return kind == Kind::CallSiteLocation; } }; /// Represents a value composed of multiple source constructs, with an optional diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp index 545fd63a175..f93852da0d1 100644 --- a/mlir/lib/IR/AsmPrinter.cpp +++ b/mlir/lib/IR/AsmPrinter.cpp @@ -385,20 +385,20 @@ void ModulePrinter::printTrailingLocation(Location loc) { void ModulePrinter::printLocationInternal(Location loc, bool pretty) { switch (loc.getKind()) { - case Location::Kind::Unknown: + case Location::Kind::UnknownLocation: if (pretty) os << "[unknown]"; else os << "unknown"; break; - case Location::Kind::FileLineCol: { + case Location::Kind::FileLineColLocation: { auto fileLoc = loc.cast<FileLineColLoc>(); auto mayQuote = pretty ? "" : "\""; os << mayQuote << fileLoc.getFilename() << mayQuote << ':' << fileLoc.getLine() << ':' << fileLoc.getColumn(); break; } - case Location::Kind::Name: { + case Location::Kind::NameLocation: { auto nameLoc = loc.cast<NameLoc>(); os << '\"' << nameLoc.getName() << '\"'; @@ -411,7 +411,7 @@ void ModulePrinter::printLocationInternal(Location loc, bool pretty) { } break; } - case Location::Kind::CallSite: { + case Location::Kind::CallSiteLocation: { auto callLocation = loc.cast<CallSiteLoc>(); auto caller = callLocation.getCaller(); auto callee = callLocation.getCallee(); diff --git a/mlir/lib/IR/Diagnostics.cpp b/mlir/lib/IR/Diagnostics.cpp index 9fbf9c52576..f7195cc9fd2 100644 --- a/mlir/lib/IR/Diagnostics.cpp +++ b/mlir/lib/IR/Diagnostics.cpp @@ -314,11 +314,11 @@ struct SourceMgrDiagnosticHandlerImpl { /// Return a processable FileLineColLoc from the given location. static llvm::Optional<FileLineColLoc> getFileLineColLoc(Location loc) { switch (loc.getKind()) { - case Location::Kind::Name: + case Location::Kind::NameLocation: return getFileLineColLoc(loc.cast<NameLoc>().getChildLoc()); - case Location::Kind::FileLineCol: + case Location::Kind::FileLineColLocation: return loc.cast<FileLineColLoc>(); - case Location::Kind::CallSite: + case Location::Kind::CallSiteLocation: // Process the callee of a callsite location. return getFileLineColLoc(loc.cast<CallSiteLoc>().getCallee()); default: diff --git a/mlir/lib/IR/LocationDetail.h b/mlir/lib/IR/LocationDetail.h index 034175e6459..9a7209c1347 100644 --- a/mlir/lib/IR/LocationDetail.h +++ b/mlir/lib/IR/LocationDetail.h @@ -42,14 +42,14 @@ struct alignas(8) LocationStorage { }; struct UnknownLocationStorage : public LocationStorage { - UnknownLocationStorage() : LocationStorage(Location::Kind::Unknown) {} + UnknownLocationStorage() : LocationStorage(Location::Kind::UnknownLocation) {} }; struct FileLineColLocationStorage : public LocationStorage { FileLineColLocationStorage(Identifier filename, unsigned line, unsigned column) - : LocationStorage(Location::Kind::FileLineCol), filename(filename), - line(line), column(column) {} + : LocationStorage(Location::Kind::FileLineColLocation), + filename(filename), line(line), column(column) {} Identifier filename; unsigned line, column; @@ -57,7 +57,8 @@ struct FileLineColLocationStorage : public LocationStorage { struct NameLocationStorage : public LocationStorage { NameLocationStorage(Identifier name, Location child) - : LocationStorage(Location::Kind::Name), name(name), child(child) {} + : LocationStorage(Location::Kind::NameLocation), name(name), + child(child) {} Identifier name; Location child; @@ -65,7 +66,7 @@ struct NameLocationStorage : public LocationStorage { struct CallSiteLocationStorage : public LocationStorage { CallSiteLocationStorage(Location callee, Location caller) - : LocationStorage(Location::Kind::CallSite), callee(callee), + : LocationStorage(Location::Kind::CallSiteLocation), callee(callee), caller(caller) {} Location callee, caller; |