From: Chris Lattner Date: Thu, 14 Jul 2011 18:12:44 +0000 (+0000) Subject: add comments. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=97d9730a59fbd4e656d2c34f3b92d2feb4d9d575;p=oota-llvm.git add comments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135164 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/Globals.cpp b/lib/VMCore/Globals.cpp index 0e0d667392b..76fc5a94923 100644 --- a/lib/VMCore/Globals.cpp +++ b/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(this)) return GV->getNumOperands() == 0; + // Functions are definitions if they have a body. if (const Function *F = dyn_cast(this)) return F->empty(); - + const GlobalAlias *GA = cast(this); if (const GlobalValue *AV = GA->getAliasedGlobal()) return AV->isDeclaration();