[llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp

Nicholas Hildenbrandt hldnbrnd at cs.uiuc.edu
Wed Sep 25 15:30:01 PDT 2002


Changes in directory llvm/lib/CWriter:

Writer.cpp updated: 1.53 -> 1.54

---
Log message:

Strings now handled correctly.


---
Diffs of the changes:

Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.53 llvm/lib/CWriter/Writer.cpp:1.54
--- llvm/lib/CWriter/Writer.cpp:1.53	Mon Sep 23 16:02:50 2002
+++ llvm/lib/CWriter/Writer.cpp	Wed Sep 25 15:29:26 2002
@@ -985,18 +985,23 @@
 
   writeOperandInternal(Ptr);
 
-  if (HasImplicitAddress && (!CI || !CI->isNullValue()))
+  if (HasImplicitAddress && (!CI || !CI->isNullValue())) {
     Out << ")";
+    HasImplicitAddress = false;  // HIA is only true if we haven't addressed yet
+  }
+
+  assert(!HasImplicitAddress || (CI && CI->isNullValue()) &&
+         "Can only have implicit address with direct accessing");
 
-  // Print out the -> operator if possible...
-  if (CI && CI->isNullValue() && I+1 != E) {
+  if (HasImplicitAddress) {
+    ++I;
+  } else if (CI && CI->isNullValue() && I+1 != E) {
+    // Print out the -> operator if possible...
     if ((*(I+1))->getType() == Type::UByteTy) {
       Out << (HasImplicitAddress ? "." : "->");
       Out << "field" << cast<ConstantUInt>(*(I+1))->getValue();
       I += 2;
-    } else {  // First array index of 0: Just skip it
-      ++I;
-    }
+    } 
   }
 
   for (; I != E; ++I)
@@ -1015,14 +1020,14 @@
 }
 
 void CWriter::visitStoreInst(StoreInst &I) {
-  Out << "*";
+  //Out << "*";
   writeOperand(I.getPointerOperand());
   Out << " = ";
   writeOperand(I.getOperand(0));
 }
 
 void CWriter::visitGetElementPtrInst(GetElementPtrInst &I) {
-  Out << "&";
+  //Out << "&";
   printIndexingExpression(I.getPointerOperand(), I.idx_begin(), I.idx_end());
 }
 





More information about the llvm-commits mailing list