[llvm-commits] [llvm] r44825 - in /llvm/trunk: include/llvm/Target/TargetData.h lib/Target/TargetData.cpp

Chris Lattner sabre at nondot.org
Mon Dec 10 16:28:59 PST 2007


Author: lattner
Date: Mon Dec 10 18:28:59 2007
New Revision: 44825

URL: http://llvm.org/viewvc/llvm-project?rev=44825&view=rev
Log:
Move TargetData::hostIsLittleEndian out of line, which means we 
don't have to #include config.h in it.  #including config.h breaks
other projects that have their own autoconf stuff and try to #include
the llvm headers.  One obscure example is llvm-gcc.

Modified:
    llvm/trunk/include/llvm/Target/TargetData.h
    llvm/trunk/lib/Target/TargetData.cpp

Modified: llvm/trunk/include/llvm/Target/TargetData.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=44825&r1=44824&r2=44825&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetData.h (original)
+++ llvm/trunk/include/llvm/Target/TargetData.h Mon Dec 10 18:28:59 2007
@@ -23,7 +23,6 @@
 #include "llvm/Pass.h"
 #include "llvm/Support/DataTypes.h"
 #include "llvm/ADT/SmallVector.h"
-#include "llvm/Config/config.h"
 #include <string>
 
 namespace llvm {
@@ -143,14 +142,8 @@
   bool          isLittleEndian()       const { return     LittleEndian; }
   bool          isBigEndian()          const { return    !LittleEndian; }
 
-  /// Host endianness...
-  bool hostIsLittleEndian() const {
-#ifdef LSB_FIRST
-    return true;
-#else
-    return false;
-#endif
-  }
+  /// Host endianness.
+  bool hostIsLittleEndian() const;
   bool hostIsBigEndian() const { return !hostIsLittleEndian(); }
 
   /// getStringRepresentation - Return the string representation of the

Modified: llvm/trunk/lib/Target/TargetData.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=44825&r1=44824&r2=44825&view=diff

==============================================================================
--- llvm/trunk/lib/Target/TargetData.cpp (original)
+++ llvm/trunk/lib/Target/TargetData.cpp Mon Dec 10 18:28:59 2007
@@ -25,6 +25,7 @@
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/Config/config.h"
 #include <algorithm>
 #include <cstdlib>
 #include <sstream>
@@ -132,6 +133,14 @@
 //                       TargetData Class Implementation
 //===----------------------------------------------------------------------===//
 
+bool TargetData::hostIsLittleEndian() const {
+#ifdef LSB_FIRST
+  return true;
+#else
+  return false;
+#endif
+}
+
 /*!
  A TargetDescription string consists of a sequence of hyphen-delimited
  specifiers for target endianness, pointer size and alignments, and various





More information about the llvm-commits mailing list