From 12ddd409535b52a7fa5157ded9a4cedd161fedb6 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 11 Aug 2009 17:45:13 +0000 Subject: Make LLVMContext and LLVMContextImpl classes instead of structs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78690 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/ConstantFolding.h | 2 +- include/llvm/Analysis/DebugInfo.h | 2 +- include/llvm/Analysis/ScalarEvolution.h | 2 +- include/llvm/Analysis/SparsePropagation.h | 2 +- include/llvm/Analysis/ValueTracking.h | 2 +- include/llvm/Assembly/Parser.h | 2 +- include/llvm/BasicBlock.h | 2 +- include/llvm/Bitcode/Archive.h | 2 +- include/llvm/Bitcode/ReaderWriter.h | 2 +- include/llvm/CodeGen/ValueTypes.h | 2 +- include/llvm/Constant.h | 2 +- include/llvm/Constants.h | 2 +- include/llvm/Debugger/Debugger.h | 2 +- include/llvm/DerivedTypes.h | 2 +- include/llvm/Function.h | 2 +- include/llvm/GlobalVariable.h | 2 +- include/llvm/InstrTypes.h | 2 +- include/llvm/Instruction.h | 2 +- include/llvm/Instructions.h | 2 +- include/llvm/Intrinsics.h | 2 +- include/llvm/LLVMContext.h | 5 +++-- include/llvm/Linker.h | 2 +- include/llvm/Metadata.h | 4 ++-- include/llvm/Module.h | 2 +- include/llvm/Support/ConstantFolder.h | 2 +- include/llvm/Support/NoFolder.h | 2 +- include/llvm/Support/TargetFolder.h | 2 +- include/llvm/Transforms/Utils/Cloning.h | 2 +- include/llvm/Transforms/Utils/Local.h | 2 +- include/llvm/Transforms/Utils/PromoteMemToReg.h | 2 +- include/llvm/Transforms/Utils/ValueMapper.h | 2 +- include/llvm/Value.h | 2 +- lib/Archive/ArchiveInternals.h | 2 +- lib/AsmParser/LLLexer.h | 2 +- lib/Bitcode/Reader/BitcodeReader.h | 2 +- lib/VMCore/ConstantFold.h | 2 +- lib/VMCore/LLVMContext.cpp | 2 +- lib/VMCore/LLVMContextImpl.h | 5 +++-- tools/bugpoint/BugDriver.h | 2 +- tools/llvm-db/CLIDebugger.h | 2 +- 40 files changed, 45 insertions(+), 43 deletions(-) diff --git a/include/llvm/Analysis/ConstantFolding.h b/include/llvm/Analysis/ConstantFolding.h index 3293d263a09..3e393ff6917 100644 --- a/include/llvm/Analysis/ConstantFolding.h +++ b/include/llvm/Analysis/ConstantFolding.h @@ -22,7 +22,7 @@ namespace llvm { class TargetData; class Function; class Type; - struct LLVMContext; + class LLVMContext; /// ConstantFoldInstruction - Attempt to constant fold the specified /// instruction. If successful, the constant result is returned, if not, null diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h index 5c8b31ad5e2..79f4a58e42e 100644 --- a/include/llvm/Analysis/DebugInfo.h +++ b/include/llvm/Analysis/DebugInfo.h @@ -40,7 +40,7 @@ namespace llvm { class DebugLoc; struct DebugLocTracker; class Instruction; - struct LLVMContext; + class LLVMContext; class DIDescriptor { protected: diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index c008051d5c9..b98f5352173 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -41,7 +41,7 @@ namespace llvm { class Type; class ScalarEvolution; class TargetData; - struct LLVMContext; + class LLVMContext; class Loop; class LoopInfo; class Operator; diff --git a/include/llvm/Analysis/SparsePropagation.h b/include/llvm/Analysis/SparsePropagation.h index 877823303fd..638008d78cd 100644 --- a/include/llvm/Analysis/SparsePropagation.h +++ b/include/llvm/Analysis/SparsePropagation.h @@ -31,7 +31,7 @@ namespace llvm { class BasicBlock; class Function; class SparseSolver; - struct LLVMContext; + class LLVMContext; template class SmallVectorImpl; diff --git a/include/llvm/Analysis/ValueTracking.h b/include/llvm/Analysis/ValueTracking.h index fa46921b593..1ebd9c26c4a 100644 --- a/include/llvm/Analysis/ValueTracking.h +++ b/include/llvm/Analysis/ValueTracking.h @@ -23,7 +23,7 @@ namespace llvm { class Instruction; class APInt; class TargetData; - struct LLVMContext; + class LLVMContext; /// ComputeMaskedBits - Determine which of the bits specified in Mask are /// known to be either zero or one and return them in the KnownZero/KnownOne diff --git a/include/llvm/Assembly/Parser.h b/include/llvm/Assembly/Parser.h index 6ab43825c87..966abaaa206 100644 --- a/include/llvm/Assembly/Parser.h +++ b/include/llvm/Assembly/Parser.h @@ -21,7 +21,7 @@ namespace llvm { class Module; class SMDiagnostic; class raw_ostream; -struct LLVMContext; +class LLVMContext; /// This function is the main interface to the LLVM Assembly Parser. It parses /// an ASCII file that (presumably) contains LLVM Assembly code. It returns a diff --git a/include/llvm/BasicBlock.h b/include/llvm/BasicBlock.h index cc5c8355db0..eabc1a0d2b6 100644 --- a/include/llvm/BasicBlock.h +++ b/include/llvm/BasicBlock.h @@ -22,7 +22,7 @@ namespace llvm { class TerminatorInst; -struct LLVMContext; +class LLVMContext; template<> struct ilist_traits : public SymbolTableListTraits { diff --git a/include/llvm/Bitcode/Archive.h b/include/llvm/Bitcode/Archive.h index 8a1d3125ee0..13583c0d5ec 100644 --- a/include/llvm/Bitcode/Archive.h +++ b/include/llvm/Bitcode/Archive.h @@ -32,7 +32,7 @@ class ModuleProvider; // From VMCore class Module; // From VMCore class Archive; // Declared below class ArchiveMemberHeader; // Internal implementation class -struct LLVMContext; // Global data +class LLVMContext; // Global data /// This class is the main class manipulated by users of the Archive class. It /// holds information about one member of the Archive. It is also the element diff --git a/include/llvm/Bitcode/ReaderWriter.h b/include/llvm/Bitcode/ReaderWriter.h index 9890f29307d..3d33d75a06a 100644 --- a/include/llvm/Bitcode/ReaderWriter.h +++ b/include/llvm/Bitcode/ReaderWriter.h @@ -23,7 +23,7 @@ namespace llvm { class MemoryBuffer; class ModulePass; class BitstreamWriter; - struct LLVMContext; + class LLVMContext; class raw_ostream; /// getBitcodeModuleProvider - Read the header of the specified bitcode buffer diff --git a/include/llvm/CodeGen/ValueTypes.h b/include/llvm/CodeGen/ValueTypes.h index b32bda9c792..2427f99b971 100644 --- a/include/llvm/CodeGen/ValueTypes.h +++ b/include/llvm/CodeGen/ValueTypes.h @@ -23,7 +23,7 @@ namespace llvm { class Type; - struct LLVMContext; + class LLVMContext; struct EVT { // EVT = Machine Value Type public: diff --git a/include/llvm/Constant.h b/include/llvm/Constant.h index 9c4365febe2..a42c7d43717 100644 --- a/include/llvm/Constant.h +++ b/include/llvm/Constant.h @@ -20,7 +20,7 @@ namespace llvm { class APInt; template class SmallVectorImpl; - struct LLVMContext; + class LLVMContext; /// This is an important base class in LLVM. It provides the common facilities /// of all constant values in an LLVM program. A constant is a value that is diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index 1aaef8045a6..3b674cda574 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -231,7 +231,7 @@ class ConstantFP : public Constant { APFloat Val; void *operator new(size_t, unsigned);// DO NOT IMPLEMENT ConstantFP(const ConstantFP &); // DO NOT IMPLEMENT - friend struct LLVMContextImpl; + friend class LLVMContextImpl; protected: ConstantFP(const Type *Ty, const APFloat& V); protected: diff --git a/include/llvm/Debugger/Debugger.h b/include/llvm/Debugger/Debugger.h index 69b13c8a183..42de35660c2 100644 --- a/include/llvm/Debugger/Debugger.h +++ b/include/llvm/Debugger/Debugger.h @@ -20,7 +20,7 @@ namespace llvm { class Module; class InferiorProcess; - struct LLVMContext; + class LLVMContext; /// Debugger class - This class implements the LLVM source-level debugger. /// This allows clients to handle the user IO processing without having to diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h index b50ee5549f6..e7b226be7b5 100644 --- a/include/llvm/DerivedTypes.h +++ b/include/llvm/DerivedTypes.h @@ -31,7 +31,7 @@ class PointerValType; class VectorValType; class IntegerValType; class APInt; -struct LLVMContext; +class LLVMContext; class DerivedType : public Type { friend class Type; diff --git a/include/llvm/Function.h b/include/llvm/Function.h index 7eec336c3b7..90d9b0ee46e 100644 --- a/include/llvm/Function.h +++ b/include/llvm/Function.h @@ -26,7 +26,7 @@ namespace llvm { class FunctionType; -struct LLVMContext; +class LLVMContext; // Traits for intrusive list of basic blocks... template<> struct ilist_traits diff --git a/include/llvm/GlobalVariable.h b/include/llvm/GlobalVariable.h index 7855befb935..f18554d53b5 100644 --- a/include/llvm/GlobalVariable.h +++ b/include/llvm/GlobalVariable.h @@ -28,7 +28,7 @@ namespace llvm { class Module; class Constant; -struct LLVMContext; +class LLVMContext; template class SymbolTableListTraits; diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h index 771e9f799b3..9df99a7c6fa 100644 --- a/include/llvm/InstrTypes.h +++ b/include/llvm/InstrTypes.h @@ -23,7 +23,7 @@ namespace llvm { -struct LLVMContext; +class LLVMContext; //===----------------------------------------------------------------------===// // TerminatorInst Class diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h index 3ce1745d1a4..924b19554a8 100644 --- a/include/llvm/Instruction.h +++ b/include/llvm/Instruction.h @@ -20,7 +20,7 @@ namespace llvm { -struct LLVMContext; +class LLVMContext; template class SymbolTableListTraits; diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index d326141698e..ecfddf2cf9a 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -29,7 +29,7 @@ namespace llvm { class ConstantInt; class ConstantRange; class APInt; -struct LLVMContext; +class LLVMContext; //===----------------------------------------------------------------------===// // AllocationInst Class diff --git a/include/llvm/Intrinsics.h b/include/llvm/Intrinsics.h index 5750a27d732..8f1b1aee1f5 100644 --- a/include/llvm/Intrinsics.h +++ b/include/llvm/Intrinsics.h @@ -23,7 +23,7 @@ namespace llvm { class Type; class FunctionType; class Function; -struct LLVMContext; +class LLVMContext; class Module; class AttrListPtr; diff --git a/include/llvm/LLVMContext.h b/include/llvm/LLVMContext.h index c72b21c12ef..95b4eaa2941 100644 --- a/include/llvm/LLVMContext.h +++ b/include/llvm/LLVMContext.h @@ -17,14 +17,15 @@ namespace llvm { -struct LLVMContextImpl; +class LLVMContextImpl; /// This is an important class for using LLVM in a threaded context. It /// (opaquely) owns and manages the core "global" data of LLVM's core /// infrastructure, including the type and constant uniquing tables. /// LLVMContext itself provides no locking guarantees, so you should be careful /// to have one context per thread. -struct LLVMContext { +class LLVMContext { +public: LLVMContextImpl* pImpl; bool RemoveDeadMetadata(); LLVMContext(); diff --git a/include/llvm/Linker.h b/include/llvm/Linker.h index 43db5961d4d..2f3d3740820 100644 --- a/include/llvm/Linker.h +++ b/include/llvm/Linker.h @@ -21,7 +21,7 @@ namespace llvm { class Module; -struct LLVMContext; +class LLVMContext; /// This class provides the core functionality of linking in LLVM. It retains a /// Module object which is the composite of the modules and libraries linked diff --git a/include/llvm/Metadata.h b/include/llvm/Metadata.h index d5ef7cbb5a1..3803b5a5f57 100644 --- a/include/llvm/Metadata.h +++ b/include/llvm/Metadata.h @@ -26,7 +26,7 @@ namespace llvm { class Constant; -struct LLVMContext; +class LLVMContext; template struct ConstantCreator; @@ -205,7 +205,7 @@ template class NamedMDNode : public MetadataBase, public ilist_node { friend class SymbolTableListTraits; - friend struct LLVMContextImpl; + friend class LLVMContextImpl; NamedMDNode(const NamedMDNode &); // DO NOT IMPLEMENT void *operator new(size_t, unsigned); // DO NOT IMPLEMENT diff --git a/include/llvm/Module.h b/include/llvm/Module.h index 709b122998c..aa91af1a4ab 100644 --- a/include/llvm/Module.h +++ b/include/llvm/Module.h @@ -26,7 +26,7 @@ namespace llvm { class GlobalValueRefMap; // Used by ConstantVals.cpp class FunctionType; -struct LLVMContext; +class LLVMContext; template<> struct ilist_traits : public SymbolTableListTraits { diff --git a/include/llvm/Support/ConstantFolder.h b/include/llvm/Support/ConstantFolder.h index ab9ecc69fc7..422d1ad00d2 100644 --- a/include/llvm/Support/ConstantFolder.h +++ b/include/llvm/Support/ConstantFolder.h @@ -21,7 +21,7 @@ namespace llvm { -struct LLVMContext; +class LLVMContext; /// ConstantFolder - Create constants with minimum, target independent, folding. class ConstantFolder { diff --git a/include/llvm/Support/NoFolder.h b/include/llvm/Support/NoFolder.h index d5198a2ad89..b89c084b586 100644 --- a/include/llvm/Support/NoFolder.h +++ b/include/llvm/Support/NoFolder.h @@ -28,7 +28,7 @@ namespace llvm { -struct LLVMContext; +class LLVMContext; /// NoFolder - Create "constants" (actually, values) with no folding. class NoFolder { diff --git a/include/llvm/Support/TargetFolder.h b/include/llvm/Support/TargetFolder.h index 900c3268859..473b0ab03c9 100644 --- a/include/llvm/Support/TargetFolder.h +++ b/include/llvm/Support/TargetFolder.h @@ -25,7 +25,7 @@ namespace llvm { class TargetData; -struct LLVMContext; +class LLVMContext; /// TargetFolder - Create constants with target dependent folding. class TargetFolder { diff --git a/include/llvm/Transforms/Utils/Cloning.h b/include/llvm/Transforms/Utils/Cloning.h index b709edfac1b..66cac9fea4b 100644 --- a/include/llvm/Transforms/Utils/Cloning.h +++ b/include/llvm/Transforms/Utils/Cloning.h @@ -38,7 +38,7 @@ class CallGraph; class TargetData; class Loop; class LoopInfo; -struct LLVMContext; +class LLVMContext; /// CloneModule - Return an exact copy of the specified module /// diff --git a/include/llvm/Transforms/Utils/Local.h b/include/llvm/Transforms/Utils/Local.h index db5793166c5..32e7ae81b1b 100644 --- a/include/llvm/Transforms/Utils/Local.h +++ b/include/llvm/Transforms/Utils/Local.h @@ -27,7 +27,7 @@ class PHINode; class AllocaInst; class ConstantExpr; class TargetData; -struct LLVMContext; +class LLVMContext; struct DbgInfoIntrinsic; template class SmallVectorImpl; diff --git a/include/llvm/Transforms/Utils/PromoteMemToReg.h b/include/llvm/Transforms/Utils/PromoteMemToReg.h index 3dba38ee264..71a077e8625 100644 --- a/include/llvm/Transforms/Utils/PromoteMemToReg.h +++ b/include/llvm/Transforms/Utils/PromoteMemToReg.h @@ -23,7 +23,7 @@ class AllocaInst; class DominatorTree; class DominanceFrontier; class AliasSetTracker; -struct LLVMContext; +class LLVMContext; /// isAllocaPromotable - Return true if this alloca is legal for promotion. /// This is true if there are only loads and stores to the alloca... diff --git a/include/llvm/Transforms/Utils/ValueMapper.h b/include/llvm/Transforms/Utils/ValueMapper.h index ed3ea2bdc40..d31edab5b55 100644 --- a/include/llvm/Transforms/Utils/ValueMapper.h +++ b/include/llvm/Transforms/Utils/ValueMapper.h @@ -20,7 +20,7 @@ namespace llvm { class Value; class Instruction; - struct LLVMContext; + class LLVMContext; typedef DenseMap ValueMapTy; Value *MapValue(const Value *V, ValueMapTy &VM, LLVMContext &Context); diff --git a/include/llvm/Value.h b/include/llvm/Value.h index 3881e351da5..b1db1ce3e1e 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -42,7 +42,7 @@ typedef StringMapEntry ValueName; class raw_ostream; class AssemblyAnnotationWriter; class ValueHandleBase; -struct LLVMContext; +class LLVMContext; //===----------------------------------------------------------------------===// // Value Class diff --git a/lib/Archive/ArchiveInternals.h b/lib/Archive/ArchiveInternals.h index 98f9c896c59..d187ed91d72 100644 --- a/lib/Archive/ArchiveInternals.h +++ b/lib/Archive/ArchiveInternals.h @@ -31,7 +31,7 @@ namespace llvm { - struct LLVMContext; + class LLVMContext; /// The ArchiveMemberHeader structure is used internally for bitcode /// archives. diff --git a/lib/AsmParser/LLLexer.h b/lib/AsmParser/LLLexer.h index 667ab2c2ede..de39272f45e 100644 --- a/lib/AsmParser/LLLexer.h +++ b/lib/AsmParser/LLLexer.h @@ -24,7 +24,7 @@ namespace llvm { class MemoryBuffer; class Type; class SMDiagnostic; - struct LLVMContext; + class LLVMContext; class LLLexer { const char *CurPtr; diff --git a/lib/Bitcode/Reader/BitcodeReader.h b/lib/Bitcode/Reader/BitcodeReader.h index a1f91133ea1..bd048885a65 100644 --- a/lib/Bitcode/Reader/BitcodeReader.h +++ b/lib/Bitcode/Reader/BitcodeReader.h @@ -26,7 +26,7 @@ namespace llvm { class MemoryBuffer; - struct LLVMContext; + class LLVMContext; //===----------------------------------------------------------------------===// // BitcodeReaderValueList Class diff --git a/lib/VMCore/ConstantFold.h b/lib/VMCore/ConstantFold.h index c70a04b7fc6..afa99787672 100644 --- a/lib/VMCore/ConstantFold.h +++ b/lib/VMCore/ConstantFold.h @@ -23,7 +23,7 @@ namespace llvm { class Value; class Constant; class Type; - struct LLVMContext; + class LLVMContext; // Constant fold various types of instruction... Constant *ConstantFoldCastInstruction( diff --git a/lib/VMCore/LLVMContext.cpp b/lib/VMCore/LLVMContext.cpp index 56a429dd390..aa9dc3671a0 100644 --- a/lib/VMCore/LLVMContext.cpp +++ b/lib/VMCore/LLVMContext.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // // This file implements LLVMContext, as a wrapper around the opaque -// struct LLVMContextImpl. +// class LLVMContextImpl. // //===----------------------------------------------------------------------===// diff --git a/lib/VMCore/LLVMContextImpl.h b/lib/VMCore/LLVMContextImpl.h index 245aa4a7043..30a7fc4af93 100644 --- a/lib/VMCore/LLVMContextImpl.h +++ b/lib/VMCore/LLVMContextImpl.h @@ -34,7 +34,7 @@ class ConstantInt; class ConstantFP; class MDString; class MDNode; -struct LLVMContext; +class LLVMContext; class Type; class Value; @@ -90,7 +90,8 @@ struct DenseMapAPFloatKeyInfo { static bool isPod() { return false; } }; -struct LLVMContextImpl { +class LLVMContextImpl { +public: sys::SmartRWMutex ConstantsLock; typedef DenseMap