<div>Some random style and coding convention comments that jumped out at me while skimming this.</div><div><br></div><div>There are probably more similar things that would be worth cleaning up in the rest of the patch.</div>
<br><div class="gmail_quote">On Wed, Mar 21, 2012 at 2:06 PM, Danil Malyshev <span dir="ltr"><<a href="mailto:dmalyshev@accesssoftek.com">dmalyshev@accesssoftek.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":36a">+  // FIXME: ObjectFile don't modify MemoryBuffer.<br>
+  //        It should use const MemoryBuffer as parameter.<br>
+  ObjectFile *obj = ObjectFile::<br>
+                      createObjectFile(const_cast<MemoryBuffer*>(InputBuffer));<br></div></blockquote><div><br></div><div>This indentation is pretty hard to read and track. I would really prefer to see line breaks between operators/operands and after '('s rather than inside of qualified names.</div>
<div><br></div><div>Many LLVM files write:</div><div><br></div><div>LongTypeName *foo</div><div>  = reallyBigInitializerFactoryFunction(x, y, z);</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":36a">
+<br>
+  Arch = (Triple::ArchType)obj->getArch();<br>
+<br>
+  LocalSymbolMap LocalSymbols;     // Functions and data symbols from the<br>
+                                   // object file.<br>
+  ObjSectionToIDMap LocalSections; // Used sections from the object file<br>
+<br>
+  error_code err;<br>
+<br>
+<br>
+  // Parse symbols<br>
+  DEBUG(dbgs() << "Parse symbols:\n");<br>
+  for (symbol_iterator it = obj->begin_symbols(), itEnd = obj->end_symbols();<br></div></blockquote><div><br></div><div>Extremely strong convention is to write iterator names as:</div><div><br></div><div>for (foo_iterator I = foo->begin(), E = foo->end()</div>
<div><br></div><div>The 'it' and 'itEnd' don't even follow the conventions for local variables.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":36a">
+       it != itEnd; it.increment(err)) {<br>
+    if (err) break;<br></div></blockquote><div><br></div><div>Please just put this in the loop condition: 'i != E && !err'</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":36a">
+    object::SymbolRef::Type SymType;<br>
+    StringRef Name;<br>
+    if ((bool)(err = it->getType(SymType))) break;<br></div></blockquote><div><br></div><div>Please follow the local variable naming convention even here, and just use a condition variable for this -- it's how error_code was meant to be used</div>
<div><br></div><div>if (error_code Error = it->getType(SymType))</div><div>  report_fatal_error(Error.message());</div><div><br></div><div>Reporting the error directly from the if I think is easier on the reader, because now there is no control flow to understand. (It's also a touch more efficient in some cases...)</div>
</div>