diff options
author | Chris Lattner <sabre@nondot.org> | 2011-07-14 18:12:44 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-07-14 18:12:44 +0000 |
commit | 8561721bcecbab6d97e8a66a1910e182c1f1b5cc (patch) | |
tree | f74d43cad3cb8cc0db5048ffb742c1429015878c | |
parent | 923053a1d66dd8729523913ea02de2bf7f3fbf50 (diff) | |
download | bcm5719-llvm-8561721bcecbab6d97e8a66a1910e182c1f1b5cc.tar.gz bcm5719-llvm-8561721bcecbab6d97e8a66a1910e182c1f1b5cc.zip |
add comments.
llvm-svn: 135164
-rw-r--r-- | llvm/lib/VMCore/Globals.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/Globals.cpp b/llvm/lib/VMCore/Globals.cpp index 0e0d667392b..76fc5a94923 100644 --- a/llvm/lib/VMCore/Globals.cpp +++ b/llvm/lib/VMCore/Globals.cpp @@ -63,12 +63,14 @@ void GlobalValue::setAlignment(unsigned Align) { } bool GlobalValue::isDeclaration() const { + // Globals are definitions if they have an initializer. if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(this)) return GV->getNumOperands() == 0; + // Functions are definitions if they have a body. if (const Function *F = dyn_cast<Function>(this)) return F->empty(); - + const GlobalAlias *GA = cast<GlobalAlias>(this); if (const GlobalValue *AV = GA->getAliasedGlobal()) return AV->isDeclaration(); |