add comments.
authorChris Lattner <sabre@nondot.org>
Thu, 14 Jul 2011 18:12:44 +0000 (18:12 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 14 Jul 2011 18:12:44 +0000 (18:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135164 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Globals.cpp

index 0e0d667392bef5bd59e87a6318843e0a0cf4fc32..76fc5a9492352690a193742f7a1604ceef60d8f9 100644 (file)
@@ -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();