Fix right shift by 64 bits detected on CXX/lex/lex.literal/lex.ext/p4.cpp
[oota-llvm.git] / lib / Object / MachOObjectFile.cpp
index 2daa4a81ea8eb10e48f05367b78c2a404a6b6f07..c6815ea27d24cfd02f8289a5a872cfc10c6cf2b5 100644 (file)
@@ -1532,7 +1532,7 @@ bool ExportEntry::operator==(const ExportEntry &Other) const {
   if (Stack.size() != Other.Stack.size())
     return false;
   // Not equal if different cumulative strings.
-  if (!CumulativeString.str().equals(CumulativeString.str()))
+  if (!CumulativeString.str().equals(Other.CumulativeString.str()))
     return false;
   // Equal if all nodes in both stacks match.
   for (unsigned i=0; i < Stack.size(); ++i) {
@@ -1542,15 +1542,15 @@ bool ExportEntry::operator==(const ExportEntry &Other) const {
   return true;  
 }
 
-uint64_t ExportEntry::readULEB128(const uint8_t *&p) {
-  unsigned count;
-  uint64_t result = decodeULEB128(p, &count);
-  p += count;
-  if (p > Trie.end()) {
-    p = Trie.end();
+uint64_t ExportEntry::readULEB128(const uint8_t *&Ptr) {
+  unsigned Count;
+  uint64_t Result = decodeULEB128(Ptr, &Count);
+  Ptr += Count;
+  if (Ptr > Trie.end()) {
+    Ptr = Trie.end();
     Malformed = true;
   }
-  return result;
+  return Result;
 }
 
 StringRef ExportEntry::name() const {
@@ -1600,8 +1600,8 @@ void ExportEntry::pushNode(uint64_t offset) {
       State.ImportName = reinterpret_cast<const char*>(State.Current);
     } else {
       State.Address = readULEB128(State.Current);
-                       if (State.Flags &  MachO::EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER)
-                               State.Other = readULEB128(State.Current); 
+      if (State.Flags & MachO::EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER)
+        State.Other = readULEB128(State.Current); 
     }
   }
   State.ChildCount = *Children;
@@ -1616,8 +1616,8 @@ void ExportEntry::pushDownUntilBottom() {
     NodeState &Top = Stack.back();
     CumulativeString.resize(Top.ParentStringLength);
     for (;*Top.Current != 0; Top.Current++) {
-      char c = *Top.Current;
-      CumulativeString.push_back(c);
+      char C = *Top.Current;
+      CumulativeString.push_back(C);
     }
     Top.Current += 1;
     uint64_t childNodeIndex = readULEB128(Top.Current);
@@ -1861,6 +1861,31 @@ MachOObjectFile::getDylibIDLoadCommand(const LoadCommandInfo &L) const {
   return getStruct<MachO::dylib_command>(this, L.Ptr);
 }
 
+MachO::dyld_info_command
+MachOObjectFile::getDyldInfoLoadCommand(const LoadCommandInfo &L) const {
+  return getStruct<MachO::dyld_info_command>(this, L.Ptr);
+}
+
+MachO::dylinker_command
+MachOObjectFile::getDylinkerCommand(const LoadCommandInfo &L) const {
+  return getStruct<MachO::dylinker_command>(this, L.Ptr);
+}
+
+MachO::uuid_command
+MachOObjectFile::getUuidCommand(const LoadCommandInfo &L) const {
+  return getStruct<MachO::uuid_command>(this, L.Ptr);
+}
+
+MachO::source_version_command
+MachOObjectFile::getSourceVersionCommand(const LoadCommandInfo &L) const {
+  return getStruct<MachO::source_version_command>(this, L.Ptr);
+}
+
+MachO::entry_point_command
+MachOObjectFile::getEntryPointCommand(const LoadCommandInfo &L) const {
+  return getStruct<MachO::entry_point_command>(this, L.Ptr);
+}
+
 
 MachO::any_relocation_info
 MachOObjectFile::getRelocation(DataRefImpl Rel) const {