[llvm] [llvm] Implement S_INLINEES debug symbol (PR #67490)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 14:26:43 PDT 2023


github-actions[bot] wrote:


<!--LLVM CODE FORMAT COMMENT: {clang-format}-->

:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 1a5d3b6cda2c56a39bbe2a529db4d3ac3d5ffa0f 134c307be38b2a0757e5d1d3dd60af95a110c96c -- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index 411f7343f27b..00d1910e5b56 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -3593,17 +3593,21 @@ void CodeViewDebug::emitDebugInfoForJumpTables(const FunctionInfo &FI) {
   }
 }
 
-void CodeViewDebug::emitInlinees(const SmallSet<codeview::TypeIndex, 1> &Inlinees) {
-  // Divide the list of inlinees into chunks such that each chunk fits within one record.
-  constexpr auto ChunkSize = (MaxRecordLength - sizeof(SymbolKind) - sizeof(int)) / sizeof(int);
-
-  SmallVector<TypeIndex> SortedInlinees{ Inlinees.begin(), Inlinees.end() };
+void CodeViewDebug::emitInlinees(
+    const SmallSet<codeview::TypeIndex, 1> &Inlinees) {
+  // Divide the list of inlinees into chunks such that each chunk fits within
+  // one record.
+  constexpr auto ChunkSize =
+      (MaxRecordLength - sizeof(SymbolKind) - sizeof(int)) / sizeof(int);
+
+  SmallVector<TypeIndex> SortedInlinees{Inlinees.begin(), Inlinees.end()};
   llvm::sort(SortedInlinees);
 
   uint64_t CurrentIndex = 0;
   while (CurrentIndex < SortedInlinees.size()) {
     auto Symbol = beginSymbolRecord(SymbolKind::S_INLINEES);
-    auto CurrentChunkSize = std::min(ChunkSize, SortedInlinees.size() - CurrentIndex);
+    auto CurrentChunkSize =
+        std::min(ChunkSize, SortedInlinees.size() - CurrentIndex);
     OS.AddComment("Count");
     OS.emitInt32(CurrentChunkSize);
 
diff --git a/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp b/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
index 197001c1bdca..f56739db7c75 100644
--- a/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
+++ b/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
@@ -591,18 +591,18 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
 Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, CallerSym &Caller) {
   llvm::StringRef ScopeName;
   switch (CVR.kind()) {
-    case S_CALLEES:
-      ScopeName = "Callees";
-      break;
-    case S_CALLERS:
-      ScopeName = "Callers";
-      break;
-    case S_INLINEES:
-      ScopeName = "Inlinees";
-      break;
-    default:
-      return llvm::make_error<CodeViewError>(
-          "Unknown CV Record type for a CallerSym object!");
+  case S_CALLEES:
+    ScopeName = "Callees";
+    break;
+  case S_CALLERS:
+    ScopeName = "Callers";
+    break;
+  case S_INLINEES:
+    ScopeName = "Inlinees";
+    break;
+  default:
+    return llvm::make_error<CodeViewError>(
+        "Unknown CV Record type for a CallerSym object!");
   }
   ListScope S(W, ScopeName);
   for (auto FuncID : Caller.Indices)
diff --git a/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp b/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
index 111a7d0500ad..1beb2d282744 100644
--- a/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
+++ b/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
@@ -877,18 +877,18 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
 Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, CallerSym &Caller) {
   const char *Format;
   switch (CVR.kind()) {
-    case S_CALLEES:
-      Format = "callee: {0}";
-      break;
-    case S_CALLERS:
-      Format = "caller: {0}";
-      break;
-    case S_INLINEES:
-      Format = "inlinee: {0}";
-      break;
-    default:
-      return llvm::make_error<CodeViewError>(
-          "Unknown CV Record type for a CallerSym object!");
+  case S_CALLEES:
+    Format = "callee: {0}";
+    break;
+  case S_CALLERS:
+    Format = "caller: {0}";
+    break;
+  case S_INLINEES:
+    Format = "inlinee: {0}";
+    break;
+  default:
+    return llvm::make_error<CodeViewError>(
+        "Unknown CV Record type for a CallerSym object!");
   }
   AutoIndent Indent(P, 7);
   for (const auto &I : Caller.Indices) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/67490


More information about the llvm-commits mailing list