Taints the non-acquire RMW's store address with the load part
[oota-llvm.git] / tools / llvm-pdbdump / FunctionDumper.cpp
index aafbbfa64689e4bf30b383cbed5d1dae665d3b37..9584812e81a945af9f4a8c192f0cebc03e30afcb 100644 (file)
@@ -48,10 +48,9 @@ FunctionDumper::FunctionDumper(LinePrinter &P)
     : PDBSymDumper(true), Printer(P) {}
 
 void FunctionDumper::start(const PDBSymbolTypeFunctionSig &Symbol,
-                           const char *Name, PointerType Pointer,
-                           raw_ostream &OS) {
+                           const char *Name, PointerType Pointer) {
   auto ReturnType = Symbol.getReturnType();
-  ReturnType->dump(OS, 0, *this);
+  ReturnType->dump(*this);
   Printer << " ";
   uint32_t ClassParentId = Symbol.getClassParentId();
   auto ClassParent =
@@ -96,7 +95,7 @@ void FunctionDumper::start(const PDBSymbolTypeFunctionSig &Symbol,
   if (auto ChildEnum = Symbol.getArguments()) {
     uint32_t Index = 0;
     while (auto Arg = ChildEnum->getNext()) {
-      Arg->dump(OS, 0, *this);
+      Arg->dump(*this);
       if (++Index < ChildEnum->getChildCount())
         Printer << ", ";
     }
@@ -109,33 +108,32 @@ void FunctionDumper::start(const PDBSymbolTypeFunctionSig &Symbol,
     WithColor(Printer, PDB_ColorItem::Keyword).get() << " volatile";
 }
 
-void FunctionDumper::start(const PDBSymbolFunc &Symbol, PointerType Pointer,
-                           raw_ostream &OS, int Indent) {
-  uint32_t FuncStart = Symbol.getRelativeVirtualAddress();
-  uint32_t FuncEnd = FuncStart + Symbol.getLength();
+void FunctionDumper::start(const PDBSymbolFunc &Symbol, PointerType Pointer) {
+  uint64_t FuncStart = Symbol.getVirtualAddress();
+  uint64_t FuncEnd = FuncStart + Symbol.getLength();
 
-  Printer << "func ";
-  WithColor(Printer, PDB_ColorItem::Address).get() << "["
-                                                   << format_hex(FuncStart, 8);
+  Printer << "func [";
+  WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(FuncStart, 10);
   if (auto DebugStart = Symbol.findOneChild<PDBSymbolFuncDebugStart>()) {
-    uint32_t Prologue = DebugStart->getRelativeVirtualAddress() - FuncStart;
+    uint64_t Prologue = DebugStart->getVirtualAddress() - FuncStart;
     WithColor(Printer, PDB_ColorItem::Offset).get() << "+" << Prologue;
   }
-  WithColor(Printer, PDB_ColorItem::Address).get() << " - "
-                                                   << format_hex(FuncEnd, 8);
+  Printer << " - ";
+  WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(FuncEnd, 10);
   if (auto DebugEnd = Symbol.findOneChild<PDBSymbolFuncDebugEnd>()) {
-    uint32_t Epilogue = FuncEnd - DebugEnd->getRelativeVirtualAddress();
+    uint64_t Epilogue = FuncEnd - DebugEnd->getVirtualAddress();
     WithColor(Printer, PDB_ColorItem::Offset).get() << "-" << Epilogue;
   }
-  WithColor(Printer, PDB_ColorItem::Address).get() << "] ";
+  Printer << "] (";
 
-  if (Symbol.hasFramePointer())
-    WithColor(Printer, PDB_ColorItem::Address).get()
-        << "(" << Symbol.getLocalBasePointerRegisterId() << ")";
-  else
-    WithColor(Printer, PDB_ColorItem::Address).get() << "(FPO)";
+  if (Symbol.hasFramePointer()) {
+    WithColor(Printer, PDB_ColorItem::Register).get()
+        << Symbol.getLocalBasePointerRegisterId();
+  } else {
+    WithColor(Printer, PDB_ColorItem::Register).get() << "FPO";
+  }
+  Printer << ") ";
 
-  Printer << " ";
   if (Symbol.isVirtual() || Symbol.isPureVirtual())
     WithColor(Printer, PDB_ColorItem::Keyword).get() << "virtual ";
 
@@ -150,7 +148,7 @@ void FunctionDumper::start(const PDBSymbolFunc &Symbol, PointerType Pointer,
   }
 
   auto ReturnType = Signature->getReturnType();
-  ReturnType->dump(OS, 0, *this);
+  ReturnType->dump(*this);
   Printer << " ";
 
   auto ClassParent = Symbol.getClassParent();
@@ -177,7 +175,7 @@ void FunctionDumper::start(const PDBSymbolFunc &Symbol, PointerType Pointer,
     uint32_t Index = 0;
     while (auto Arg = Arguments->getNext()) {
       auto ArgType = Arg->getType();
-      ArgType->dump(OS, 0, *this);
+      ArgType->dump(*this);
       WithColor(Printer, PDB_ColorItem::Identifier).get() << " "
                                                           << Arg->getName();
       if (++Index < Arguments->getChildCount())
@@ -193,50 +191,44 @@ void FunctionDumper::start(const PDBSymbolFunc &Symbol, PointerType Pointer,
     Printer << " = 0";
 }
 
-void FunctionDumper::dump(const PDBSymbolTypeArray &Symbol, raw_ostream &OS,
-                          int Indent) {
+void FunctionDumper::dump(const PDBSymbolTypeArray &Symbol) {
   uint32_t ElementTypeId = Symbol.getTypeId();
   auto ElementType = Symbol.getSession().getSymbolById(ElementTypeId);
   if (!ElementType)
     return;
 
-  ElementType->dump(OS, 0, *this);
+  ElementType->dump(*this);
   Printer << "[";
   WithColor(Printer, PDB_ColorItem::LiteralValue).get() << Symbol.getLength();
   Printer << "]";
 }
 
-void FunctionDumper::dump(const PDBSymbolTypeBuiltin &Symbol, raw_ostream &OS,
-                          int Indent) {
+void FunctionDumper::dump(const PDBSymbolTypeBuiltin &Symbol) {
   BuiltinDumper Dumper(Printer);
-  Dumper.start(Symbol, OS);
+  Dumper.start(Symbol);
 }
 
-void FunctionDumper::dump(const PDBSymbolTypeEnum &Symbol, raw_ostream &OS,
-                          int Indent) {
+void FunctionDumper::dump(const PDBSymbolTypeEnum &Symbol) {
   dumpClassParentWithScopeOperator(Symbol, Printer, *this);
   WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
 }
 
-void FunctionDumper::dump(const PDBSymbolTypeFunctionArg &Symbol,
-                          raw_ostream &OS, int Indent) {
+void FunctionDumper::dump(const PDBSymbolTypeFunctionArg &Symbol) {
   // PDBSymbolTypeFunctionArg is just a shim over the real argument.  Just drill
   // through to the real thing and dump it.
   uint32_t TypeId = Symbol.getTypeId();
   auto Type = Symbol.getSession().getSymbolById(TypeId);
   if (!Type)
     return;
-  Type->dump(OS, 0, *this);
+  Type->dump(*this);
 }
 
-void FunctionDumper::dump(const PDBSymbolTypeTypedef &Symbol, raw_ostream &OS,
-                          int Indent) {
+void FunctionDumper::dump(const PDBSymbolTypeTypedef &Symbol) {
   dumpClassParentWithScopeOperator(Symbol, Printer, *this);
   WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
 }
 
-void FunctionDumper::dump(const PDBSymbolTypePointer &Symbol, raw_ostream &OS,
-                          int Indent) {
+void FunctionDumper::dump(const PDBSymbolTypePointer &Symbol) {
   uint32_t PointeeId = Symbol.getTypeId();
   auto PointeeType = Symbol.getSession().getSymbolById(PointeeId);
   if (!PointeeType)
@@ -246,18 +238,17 @@ void FunctionDumper::dump(const PDBSymbolTypePointer &Symbol, raw_ostream &OS,
     FunctionDumper NestedDumper(Printer);
     PointerType Pointer =
         Symbol.isReference() ? PointerType::Reference : PointerType::Pointer;
-    NestedDumper.start(*FuncSig, nullptr, Pointer, OS);
+    NestedDumper.start(*FuncSig, nullptr, Pointer);
   } else {
     if (Symbol.isConstType())
       WithColor(Printer, PDB_ColorItem::Keyword).get() << "const ";
     if (Symbol.isVolatileType())
       WithColor(Printer, PDB_ColorItem::Keyword).get() << "volatile ";
-    PointeeType->dump(OS, Indent, *this);
-    OS << (Symbol.isReference() ? "&" : "*");
+    PointeeType->dump(*this);
+    Printer << (Symbol.isReference() ? "&" : "*");
   }
 }
 
-void FunctionDumper::dump(const PDBSymbolTypeUDT &Symbol, raw_ostream &OS,
-                          int Indent) {
+void FunctionDumper::dump(const PDBSymbolTypeUDT &Symbol) {
   WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
 }