[cfe-commits] r83948 - /cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Chris Lattner sabre at nondot.org
Mon Oct 12 23:04:30 PDT 2009


Author: lattner
Date: Tue Oct 13 01:04:29 2009
New Revision: 83948

URL: http://llvm.org/viewvc/llvm-project?rev=83948&view=rev
Log:
number address-taken labels from 1.  This allows 0 to be used as a sentinel
for a null pointer.  In other words, "&&foo != NULL" will always work out to
true.

Modified:
    cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=83948&r1=83947&r2=83948&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Tue Oct 13 01:04:29 2009
@@ -444,7 +444,7 @@
 
 unsigned CodeGenFunction::GetIDForAddrOfLabel(const LabelStmt *L) {
   // Use LabelIDs.size() as the new ID if one hasn't been assigned.
-  return LabelIDs.insert(std::make_pair(L, LabelIDs.size())).first->second;
+  return LabelIDs.insert(std::make_pair(L, LabelIDs.size()+1)).first->second;
 }
 
 void CodeGenFunction::EmitMemSetToZero(llvm::Value *DestPtr, QualType Ty) {





More information about the cfe-commits mailing list