summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2015-06-26 20:44:16 +0000
committerMehdi Amini <mehdi.amini@apple.com>2015-06-26 20:44:16 +0000
commitc83ac464e68825d16de2b0768506c5f85c284bab (patch)
tree74a77bb9bf1939cd9e8920ee68d8bb2c26760b68 /llvm
parent609af9098c01c670bdf05b7a1d67c4acc09f9d2f (diff)
downloadbcm5719-llvm-c83ac464e68825d16de2b0768506c5f85c284bab.tar.gz
bcm5719-llvm-c83ac464e68825d16de2b0768506c5f85c284bab.zip
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
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/IR/DataLayout.h4
-rw-r--r--llvm/include/llvm/IR/Module.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/llvm/include/llvm/IR/DataLayout.h b/llvm/include/llvm/IR/DataLayout.h
index 3e1f9744f9e..892d6c9936c 100644
--- a/llvm/include/llvm/IR/DataLayout.h
+++ b/llvm/include/llvm/IR/DataLayout.h
@@ -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(); }
diff --git a/llvm/include/llvm/IR/Module.h b/llvm/include/llvm/IR/Module.h
index 4bc03fb574f..1668b95c8bd 100644
--- a/llvm/include/llvm/IR/Module.h
+++ b/llvm/include/llvm/IR/Module.h
@@ -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();
}
OpenPOWER on IntegriCloud