From 237b76d7404db808720d6fd27fa4b85474eebedc Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Fri, 26 Jun 2015 20:44:16 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240826 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/DataLayout.h | 4 +++- include/llvm/IR/Module.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/llvm/IR/DataLayout.h b/include/llvm/IR/DataLayout.h index 3e1f9744f9e..892d6c9936c 100644 --- a/include/llvm/IR/DataLayout.h +++ b/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/include/llvm/IR/Module.h b/include/llvm/IR/Module.h index 4bc03fb574f..1668b95c8bd 100644 --- a/include/llvm/IR/Module.h +++ b/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(); } -- 2.34.1