Don't reach into the middle of TargetMachine and cache one of its ivars.

Not only does this break encapsulation, it's gross.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182876 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling
2013-05-29 20:37:19 +00:00
parent aae0fa998a
commit cc5a882c96
6 changed files with 13 additions and 11 deletions

View File

@@ -17,12 +17,13 @@
#include "llvm/ADT/DenseMap.h"
namespace llvm {
class Twine;
class GlobalValue;
template <typename T> class SmallVectorImpl;
class MCContext;
class MCSymbol;
class DataLayout;
template <typename T> class SmallVectorImpl;
class TargetMachine;
class Twine;
class Mangler {
public:
@@ -34,7 +35,7 @@ public:
private:
MCContext &Context;
const DataLayout &TD;
const TargetMachine *TM;
/// AnonGlobalIDs - We need to give global values the same name every time
/// they are mangled. This keeps track of the number we give to anonymous
@@ -47,8 +48,8 @@ private:
unsigned NextAnonGlobalID;
public:
Mangler(MCContext &context, const DataLayout &td)
: Context(context), TD(td), NextAnonGlobalID(1) {}
Mangler(MCContext &Context, const TargetMachine *TM)
: Context(Context), TM(TM), NextAnonGlobalID(1) {}
/// getSymbol - Return the MCSymbol for the specified global value. This
/// symbol is the main label that is the address of the global.