]> granicus.if.org Git - clang/commitdiff
number address-taken labels from 1. This allows 0 to be used as a sentinel
authorChris Lattner <sabre@nondot.org>
Tue, 13 Oct 2009 06:04:29 +0000 (06:04 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 13 Oct 2009 06:04:29 +0000 (06:04 +0000)
for a null pointer.  In other words, "&&foo != NULL" will always work out to
true.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83948 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenFunction.cpp

index 10c10d9a8a3e3d1299f649c9519aa51cfbeab7fd..2d4dc455f224ea9ecc2e2fbee8ed8bec4a1e67e2 100644 (file)
@@ -444,7 +444,7 @@ void CodeGenFunction::ErrorUnsupported(const Stmt *S, const char *Type,
 
 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) {