[llvm] r240826 - DataLayout now returns a const ref to its member string representation
Mehdi Amini
mehdi.amini at apple.com
Fri Jun 26 13:44:16 PDT 2015
Author: mehdi_amini
Date: Fri Jun 26 15:44:16 2015
New Revision: 240826
URL: http://llvm.org/viewvc/llvm-project?rev=240826&view=rev
Log:
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 at apple.com>
Modified:
llvm/trunk/include/llvm/IR/DataLayout.h
llvm/trunk/include/llvm/IR/Module.h
Modified: llvm/trunk/include/llvm/IR/DataLayout.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DataLayout.h?rev=240826&r1=240825&r2=240826&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DataLayout.h (original)
+++ llvm/trunk/include/llvm/IR/DataLayout.h Fri Jun 26 15:44:16 2015
@@ -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(); }
Modified: llvm/trunk/include/llvm/IR/Module.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Module.h?rev=240826&r1=240825&r2=240826&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Module.h (original)
+++ llvm/trunk/include/llvm/IR/Module.h Fri Jun 26 15:44:16 2015
@@ -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();
}
More information about the llvm-commits
mailing list