[llvm-commits] [llvm] r135164 - /llvm/trunk/lib/VMCore/Globals.cpp

Chris Lattner sabre at nondot.org
Thu Jul 14 11:12:44 PDT 2011


Author: lattner
Date: Thu Jul 14 13:12:44 2011
New Revision: 135164

URL: http://llvm.org/viewvc/llvm-project?rev=135164&view=rev
Log:
add comments.

Modified:
    llvm/trunk/lib/VMCore/Globals.cpp

Modified: llvm/trunk/lib/VMCore/Globals.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Globals.cpp?rev=135164&r1=135163&r2=135164&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Globals.cpp (original)
+++ llvm/trunk/lib/VMCore/Globals.cpp Thu Jul 14 13:12:44 2011
@@ -63,12 +63,14 @@
 }
 
 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();





More information about the llvm-commits mailing list