diff options
Diffstat (limited to 'contrib/llvm/include/llvm/IR/GlobalVariable.h')
-rw-r--r-- | contrib/llvm/include/llvm/IR/GlobalVariable.h | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/contrib/llvm/include/llvm/IR/GlobalVariable.h b/contrib/llvm/include/llvm/IR/GlobalVariable.h index a015983..342bdc0 100644 --- a/contrib/llvm/include/llvm/IR/GlobalVariable.h +++ b/contrib/llvm/include/llvm/IR/GlobalVariable.h @@ -29,11 +29,10 @@ namespace llvm { class Module; class Constant; -template<typename ValueSubClass, typename ItemParentClass> - class SymbolTableListTraits; +template <typename ValueSubClass> class SymbolTableListTraits; class GlobalVariable : public GlobalObject, public ilist_node<GlobalVariable> { - friend class SymbolTableListTraits<GlobalVariable, Module>; + friend class SymbolTableListTraits<GlobalVariable>; void *operator new(size_t, unsigned) = delete; void operator=(const GlobalVariable &) = delete; GlobalVariable(const GlobalVariable &) = delete; @@ -106,18 +105,13 @@ public: /// hasUniqueInitializer - Whether the global variable has an initializer, and /// any changes made to the initializer will turn up in the final executable. inline bool hasUniqueInitializer() const { - return hasInitializer() && - // It's not safe to modify initializers of global variables with weak - // linkage, because the linker might choose to discard the initializer and - // use the initializer from another instance of the global variable - // instead. It is wrong to modify the initializer of a global variable - // with *_odr linkage because then different instances of the global may - // have different initializers, breaking the One Definition Rule. - !isWeakForLinker() && - // It is not safe to modify initializers of global variables with the - // external_initializer marker since the value may be changed at runtime - // before C++ initializers are evaluated. - !isExternallyInitialized(); + return + // We need to be sure this is the definition that will actually be used + isStrongDefinitionForLinker() && + // It is not safe to modify initializers of global variables with the + // external_initializer marker since the value may be changed at runtime + // before C++ initializers are evaluated. + !isExternallyInitialized(); } /// getInitializer - Return the initializer for this global variable. It is |