diff options
author | Duncan Sands <baldrick@free.fr> | 2009-03-21 21:27:31 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2009-03-21 21:27:31 +0000 |
commit | 64da9409cb27f43825a8ab0a3b49c2a73cae36ba (patch) | |
tree | d48b371a0d016e01b8ad9274e1f9ad381f58c61d /include | |
parent | 802cd84eb46b3fd2aa754b884debbedfbaf99e36 (diff) | |
download | external_llvm-64da9409cb27f43825a8ab0a3b49c2a73cae36ba.zip external_llvm-64da9409cb27f43825a8ab0a3b49c2a73cae36ba.tar.gz external_llvm-64da9409cb27f43825a8ab0a3b49c2a73cae36ba.tar.bz2 |
Factorize out a concept - no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/GlobalVariable.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/GlobalVariable.h b/include/llvm/GlobalVariable.h index bcbf321..ae64ccf 100644 --- a/include/llvm/GlobalVariable.h +++ b/include/llvm/GlobalVariable.h @@ -78,6 +78,15 @@ public: /// inline bool hasInitializer() const { return !isDeclaration(); } + /// hasDefinitiveInitializer - Whether the global variable has an initializer, + /// and this is the initializer that will be used in the final executable. + inline bool hasDefinitiveInitializer() const { + return hasInitializer() && + // The initializer of a global variable with weak linkage may change at + // link time. + !mayBeOverridden(); + } + /// getInitializer - Return the initializer for this global variable. It is /// illegal to call this method if the global is external, because we cannot /// tell what the value is initialized to! |