DataLayout now returns a const ref to its member string representation

There was no particular reason to return by value in the first place.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 240826
This commit is contained in:
Mehdi Amini 2015-06-26 20:44:16 +00:00
parent 609af9098c
commit c83ac464e6
2 changed files with 4 additions and 2 deletions

View File

@ -222,7 +222,9 @@ public:
/// This representation is in the same format accepted by the string
/// constructor above. This should not be used to compare two DataLayout as
/// different string can represent the same layout.
std::string getStringRepresentation() const { return StringRepresentation; }
const std::string &getStringRepresentation() const {
return StringRepresentation;
}
/// \brief Test if the DataLayout was constructed from an empty string.
bool isDefault() const { return StringRepresentation.empty(); }

View File

@ -249,7 +249,7 @@ public:
/// Get the data layout string for the module's target platform. This is
/// equivalent to getDataLayout()->getStringRepresentation().
const std::string getDataLayoutStr() const {
const std::string &getDataLayoutStr() const {
return DL.getStringRepresentation();
}