OSDN Git Service

clean ArgTypeListI production: free the PATypeHolder
authorNuno Lopes <nunoplopes@sapo.pt>
Sun, 5 Oct 2008 16:49:03 +0000 (16:49 +0000)
committerNuno Lopes <nunoplopes@sapo.pt>
Sun, 5 Oct 2008 16:49:03 +0000 (16:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57113 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/llvmAsmParser.y

index 608ed72..e43c285 100644 (file)
@@ -1422,9 +1422,15 @@ Types
     CHECK_FOR_ERROR
 
     FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
-    delete $3;   // Delete the argument list
     delete $1;   // Delete the return type handle
     $$ = new PATypeHolder(HandleUpRefs(FT));
+
+    // Delete the argument list
+    for (I = $3->begin() ; I != E; ++I ) {
+      delete I->Ty;
+    }
+    delete $3;
+
     CHECK_FOR_ERROR
   }
   | VOID '(' ArgTypeListI ')' OptFuncAttrs {
@@ -1447,8 +1453,14 @@ Types
     CHECK_FOR_ERROR
 
     FunctionType *FT = FunctionType::get($1, Params, isVarArg);
-    delete $3;      // Delete the argument list
     $$ = new PATypeHolder(HandleUpRefs(FT));
+
+    // Delete the argument list
+    for (I = $3->begin() ; I != E; ++I ) {
+      delete I->Ty;
+    }
+    delete $3;
+
     CHECK_FOR_ERROR
   }