[PATCH] Special handling for STT_FILE symbols

Shankar Kalpathi Easwaran shankarke at gmail.com
Mon Oct 28 17:21:42 PDT 2013



================
Comment at: include/llvm/MC/MCAssembler.h:1170-1174
@@ +1169,7 @@
+  void addFileName(StringRef FileName) {
+    const_file_name_iterator ii = file_names_begin(), ie = file_names_end();
+    for (; ii != ie; ++ii) {
+      if ((*ii) == FileName)
+        return;
+    }
+    FileNames.push_back(FileName);
----------------
We could use std::find here. 

================
Comment at: lib/MC/ELFObjectWriter.cpp:891-892
@@ +890,4 @@
+                                            ++it) {
+    StringRef Name = *it;
+    uint64_t &Entry = StringIndexMap[Name];
+    if (!Entry) {
----------------
could use the iterator as (*it) directly ?

================
Comment at: test/MC/ELF/file.s:17-18
@@ -16,4 +16,4 @@
 // CHECK-NEXT:   }
-// CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: foa (5)
+// CHECK:        Symbol {
+// CHECK:        Name: foa (5)
 // CHECK-NEXT:     Value: 0x0
----------------
Why was CHECK-NEXT removed ?

================
Comment at: lib/MC/ELFObjectWriter.cpp:1094
@@ -1075,3 +1093,3 @@
     else
-      entry.Index += LocalSymbolData.size();
+      entry.Index += LocalSymbolData.size() + FileSymbolData.size();
     if (is64Bit()) {
----------------
Could this be set in the reverse way. 

FileSymbolData.size() + LocalSymbolData.size().

This would follow how it appears in the output file ?

================
Comment at: include/llvm/MC/MCAssembler.h:819
@@ -818,1 +818,3 @@
 
+  typedef std::vector<std::string> FileNameListType;
+  typedef FileNameListType::const_iterator const_file_name_iterator;
----------------
std::vector<StringRef> ? Also FileNameVectorType; ?


http://llvm-reviews.chandlerc.com/D2043



More information about the llvm-commits mailing list