[llvm] e0094ac - [IR] Move trivial accessor Module::getDataLayout into header

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 7 10:07:38 PDT 2023


Author: Jay Foad
Date: 2023-09-07T18:07:32+01:00
New Revision: e0094ac8a58a210bcb6ed91eab3726e6e6b66f87

URL: https://github.com/llvm/llvm-project/commit/e0094ac8a58a210bcb6ed91eab3726e6e6b66f87
DIFF: https://github.com/llvm/llvm-project/commit/e0094ac8a58a210bcb6ed91eab3726e6e6b66f87.diff

LOG: [IR] Move trivial accessor Module::getDataLayout into header

Added: 
    

Modified: 
    llvm/include/llvm/IR/Module.h
    llvm/lib/IR/Module.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/Module.h b/llvm/include/llvm/IR/Module.h
index 670a40b28eabbea..61b19409a96d0af 100644
--- a/llvm/include/llvm/IR/Module.h
+++ b/llvm/include/llvm/IR/Module.h
@@ -251,7 +251,7 @@ class LLVM_EXTERNAL_VISIBILITY Module {
   }
 
   /// Get the data layout for the module's target platform.
-  const DataLayout &getDataLayout() const;
+  const DataLayout &getDataLayout() const { return DL; }
 
   /// Get the target triple which is a string describing the target host.
   /// @returns a string containing the target triple.

diff  --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp
index 73354a8f36d215b..5861bbd1f293e9b 100644
--- a/llvm/lib/IR/Module.cpp
+++ b/llvm/lib/IR/Module.cpp
@@ -395,8 +395,6 @@ void Module::setDataLayout(StringRef Desc) {
 
 void Module::setDataLayout(const DataLayout &Other) { DL = Other; }
 
-const DataLayout &Module::getDataLayout() const { return DL; }
-
 DICompileUnit *Module::debug_compile_units_iterator::operator*() const {
   return cast<DICompileUnit>(CUs->getOperand(Idx));
 }


        


More information about the llvm-commits mailing list