Repository: llvm/llvm-project
Pull request #131598: [LLVM][PDB] Use IsUnsigned flag for APInt correctly
Author: login: AlexK0
Labels: name: debuginfo
Created: 2025-03-17T10:27:32Z | Merged: 2025-03-18T14:57:00Z

Hello.

This patch fixes an assertion that occurs in `APInt`.

The assertion can be reproduced with LLDB test `python_api/thread/TestThreadAPI.py` (it fails).

Here is a stack trace:

```
Exception Code: 0x80000003
  #0 0x00007ffb3b5c3f8b HandleAbort D:\Projects\github\llvm-project-fork\llvm\lib\Support\Windows\Signals.inc:429:0
  #1 0x00007ffc08df1ae9 (C:\WINDOWS\System32\ucrtbase.dll+0xc1ae9)
  #2 0x00007ffc08dd4c11 (C:\WINDOWS\System32\ucrtbase.dll+0xa4c11)
  #3 0x00007ffc08df2ae6 (C:\WINDOWS\System32\ucrtbase.dll+0xc2ae6)
  #4 0x00007ffc08df2cc1 (C:\WINDOWS\System32\ucrtbase.dll+0xc2cc1)
  #5 0x00007ffb3a5e1201 llvm::APInt::APInt(unsigned int, unsigned __int64, bool, bool) D:\Projects\github\llvm-project-fork\llvm\include\llvm\ADT\APInt.h:127:0
  #6 0x00007ffb3b4b9a55 llvm::pdb::Variant::toAPSInt(void) const D:\Projects\github\llvm-project-fork\llvm\include\llvm\DebugInfo\PDB\PDBTypes.h:518:0
  #7 0x00007ffb3b4a4d84 PDBASTParser::AddRecordMembers(class lldb_private::SymbolFile &, class lldb_private::CompilerType &, class llvm::pdb::ConcreteSymbolEnumerator<class llvm::pdb::PDBSymbolData> &, struct lldb_private::ClangASTImporter::LayoutInfo &) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp:1316:0
  #8 0x00007ffb3b4a4380 PDBASTParser::CompleteTypeFromUDT(class lldb_private::SymbolFile &, class lldb_private::CompilerType &, class llvm::pdb::PDBSymbolTypeUDT &) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp:1222:0
  #9 0x00007ffb3b4a1dd3 PDBASTParser::CompleteTypeFromPDB(class lldb_private::CompilerType &) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp:827:0
 #10 0x00007ffb3b47b401 SymbolFilePDB::CompleteType(class lldb_private::CompilerType &) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\SymbolFilePDB.cpp:610:0
 #11 0x00007ffb3a7f77f4 lldb_private::Type::ResolveCompilerType(enum lldb_private::Type::ResolveState) D:\Projects\github\llvm-project-fork\lldb\source\Symbol\Type.cpp:739:0
 #12 0x00007ffb3a7f625a lldb_private::Type::GetFullCompilerType(void) D:\Projects\github\llvm-project-fork\lldb\source\Symbol\Type.cpp:773:0
 #13 0x00007ffb3b49fcc3 PDBASTParser::CreateLLDBTypeFromPDBType(class llvm::pdb::PDBSymbol const &) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp:564:0
 #14 0x00007ffb3b47af34 SymbolFilePDB::ResolveTypeUID(unsigned __int64) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\SymbolFilePDB.cpp:577:0
 #15 0x00007ffb3b4a2fbf PDBASTParser::GetDeclContextForSymbol(class llvm::pdb::PDBSymbol const &) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp:1013:0
 #16 0x00007ffb3b4a35e5 PDBASTParser::GetDeclContextContainingSymbol(class llvm::pdb::PDBSymbol const &) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp:1066:0
 #17 0x00007ffb3b4a2377 PDBASTParser::GetDeclForSymbol(class llvm::pdb::PDBSymbol const &) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp:908:0
 #18 0x00007ffb3b4a3a71 PDBASTParser::ParseDeclsForDeclContext(class clang::DeclContext const *) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp:1123:0
 #19 0x00007ffb3b47c596 SymbolFilePDB::ParseDeclsForContext(class lldb_private::CompilerDeclContext) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\SymbolFilePDB.cpp:725:0
 #20 0x00007ffb3b4ed55e lldb_private::TypeSystemClang::DeclContextFindDeclByName(void *, class lldb_private::ConstString, bool) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\TypeSystem\Clang\TypeSystemClang.cpp:9336:0
 #21 0x00007ffb3a883a72 lldb_private::CompilerDeclContext::FindDeclByName(class lldb_private::ConstString, bool) D:\Projects\github\llvm-project-fork\lldb\source\Symbol\CompilerDeclContext.cpp:20:0
 #22 0x00007ffb3d0826e1 lldb_private::ClangExpressionDeclMap::LookupLocalVariable(struct lldb_private::NameSearchContext &, class lldb_private::ConstString, class lldb_private::SymbolContext &, class lldb_private::CompilerDeclContext const &) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangExpressionDeclMap.cpp:1080:0
 #23 0x00007ffb3d08031e lldb_private::ClangExpressionDeclMap::FindExternalVisibleDecls(struct lldb_private::NameSearchContext &, class std::shared_ptr<class lldb_private::Module>, class lldb_private::CompilerDeclContext const &) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangExpressionDeclMap.cpp:1418:0
 #24 0x00007ffb3d07fa4b lldb_private::ClangExpressionDeclMap::FindExternalVisibleDecls(struct lldb_private::NameSearchContext &) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangExpressionDeclMap.cpp:724:0
 #25 0x00007ffb3d00a802 lldb_private::ClangASTSource::FindExternalVisibleDeclsByName(class clang::DeclContext const *, class clang::DeclarationName, class clang::DeclContext const *) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangASTSource.cpp:181:0
 #26 0x00007ffb3b542e73 lldb_private::ClangASTSource::ClangASTSourceProxy::FindExternalVisibleDeclsByName(class clang::DeclContext const *, class clang::DeclarationName, class clang::DeclContext const *) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangASTSource.h:220:0
 #27 0x00007ffb42fb849f clang::DeclContext::lookupImpl(class clang::DeclarationName, class clang::DeclContext const *) const D:\Projects\github\llvm-project-fork\clang\lib\AST\DeclBase.cpp:1916:0
 #28 0x00007ffb42fb7723 clang::DeclContext::lookup(class clang::DeclarationName) const D:\Projects\github\llvm-project-fork\clang\lib\AST\DeclBase.cpp:1876:0
 #29 0x00007ffb411cbd7e LookupDirect D:\Projects\github\llvm-project-fork\clang\lib\Sema\SemaLookup.cpp:1122:0
 #30 0x00007ffb411cc396 CppNamespaceLookup D:\Projects\github\llvm-project-fork\clang\lib\Sema\SemaLookup.cpp:1219:0
 #31 0x00007ffb411999db clang::Sema::CppLookupName(class clang::LookupResult &, class clang::Scope *) D:\Projects\github\llvm-project-fork\clang\lib\Sema\SemaLookup.cpp:1518:0
 #32 0x00007ffb4119287b clang::Sema::LookupName(class clang::LookupResult &, class clang::Scope *, bool, bool) D:\Projects\github\llvm-project-fork\clang\lib\Sema\SemaLookup.cpp:2274:0
 #33 0x00007ffb41193612 clang::Sema::LookupParsedName(class clang::LookupResult &, class clang::Scope *, class clang::CXXScopeSpec *, class clang::QualType, bool, bool) D:\Projects\github\llvm-project-fork\clang\lib\Sema\SemaLookup.cpp:2720:0
 #34 0x00007ffb4122b501 clang::Sema::ClassifyName(class clang::Scope *, class clang::CXXScopeSpec &, class clang::IdentifierInfo *&, class clang::SourceLocation, class clang::Token const &, class clang::CorrectionCandidateCallback *) D:\Projects\github\llvm-project-fork\clang\lib\Sema\SemaDecl.cpp:898:0
 #35 0x00007ffb40b46092 clang::Parser::TryAnnotateName(class clang::CorrectionCandidateCallback *, enum clang::ImplicitTypenameContext) D:\Projects\github\llvm-project-fork\clang\lib\Parse\Parser.cpp:1823:0
 #36 0x00007ffb40c799af clang::Parser::ParseStatementOrDeclarationAfterAttributes(class llvm::SmallVector<class clang::Stmt *, 32> &, enum clang::Parser::ParsedStmtContext, class clang::SourceLocation *, class clang::ParsedAttributes &, class clang::ParsedAttributes &) D:\Projects\github\llvm-project-fork\clang\lib\Parse\ParseStmt.cpp:223:0
 #37 0x00007ffb40c7952d clang::Parser::ParseStatementOrDeclaration(class llvm::SmallVector<class clang::Stmt *, 32> &, enum clang::Parser::ParsedStmtContext, class clang::SourceLocation *) D:\Projects\github\llvm-project-fork\clang\lib\Parse\ParseStmt.cpp:127:0
 #38 0x00007ffb40c7e09a clang::Parser::ParseCompoundStatementBody(bool) D:\Projects\github\llvm-project-fork\clang\lib\Parse\ParseStmt.cpp:1267:0
 #39 0x00007ffb40c86f0c clang::Parser::ParseFunctionStatementBody(class clang::Decl *, class clang::Parser::ParseScope &) D:\Projects\github\llvm-project-fork\clang\lib\Parse\ParseStmt.cpp:2585:0
 #40 0x00007ffb40b4cee9 clang::Parser::ParseFunctionDefinition(class clang::ParsingDeclarator &, struct clang::Parser::ParsedTemplateInfo const &, class clang::Parser::LateParsedAttrList *) D:\Projects\github\llvm-project-fork\clang\lib\Parse\Parser.cpp:1520:0
 #41 0x00007ffb40b9e897 clang::Parser::ParseDeclGroup(class clang::ParsingDeclSpec &, enum clang::DeclaratorContext, class clang::ParsedAttributes &, struct clang::Parser::ParsedTemplateInfo &, class clang::SourceLocation *, struct clang::Parser::ForRangeInit *) D:\Projects\github\llvm-project-fork\clang\lib\Parse\ParseDecl.cpp:2460:0
 #42 0x00007ffb40b4b754 clang::Parser::ParseDeclOrFunctionDefInternal(class clang::ParsedAttributes &, class clang::ParsedAttributes &, class clang::ParsingDeclSpec &, enum clang::AccessSpecifier) D:\Projects\github\llvm-project-fork\clang\lib\Parse\Parser.cpp:1244:0
 #43 0x00007ffb40b4ad56 clang::Parser::ParseDeclarationOrFunctionDefinition(class clang::ParsedAttributes &, class clang::ParsedAttributes &, class clang::ParsingDeclSpec *, enum clang::AccessSpecifier) D:\Projects\github\llvm-project-fork\clang\lib\Parse\Parser.cpp:1266:0
 #44 0x00007ffb40b4a5db clang::Parser::ParseExternalDeclaration(class clang::ParsedAttributes &, class clang::ParsedAttributes &, class clang::ParsingDeclSpec *) D:\Projects\github\llvm-project-fork\clang\lib\Parse\Parser.cpp:1069:0
 #45 0x00007ffb40b43a62 clang::Parser::ParseTopLevelDecl(class clang::OpaquePtr<class clang::DeclGroupRef> &, enum clang::Sema::ModuleImportState &) D:\Projects\github\llvm-project-fork\clang\lib\Parse\Parser.cpp:758:0
 #46 0x00007ffb40b6332a clang::ParseAST(class clang::Sema &, bool, bool) D:\Projects\github\llvm-project-fork\clang\lib\Parse\ParseAST.cpp:171:0
 #47 0x00007ffb3d044da4 lldb_private::ClangExpressionParser::ParseInternal(class lldb_private::DiagnosticManager &, class clang::CodeCompleteConsumer *, unsigned int, unsigned int) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangExpressionParser.cpp:1348:0
 #48 0x00007ffb3d04249b lldb_private::ClangExpressionParser::Parse(class lldb_private::DiagnosticManager &) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangExpressionParser.cpp:1205:0
 #49 0x00007ffb3d02d7ac lldb_private::ClangUserExpression::TryParse(class lldb_private::DiagnosticManager &, class lldb_private::ExecutionContext &, enum lldb_private::ExecutionPolicy, bool, bool) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangUserExpression.cpp:579:0
 #50 0x00007ffb3d02cb70 lldb_private::ClangUserExpression::Parse(class lldb_private::DiagnosticManager &, class lldb_private::ExecutionContext &, enum lldb_private::ExecutionPolicy, bool, bool) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangUserExpression.cpp:673:0
 #51 0x00007ffb3a6b5cdb lldb_private::UserExpression::Evaluate(class lldb_private::ExecutionContext &, class lldb_private::EvaluateExpressionOptions const &, class llvm::StringRef, class llvm::StringRef, class std::shared_ptr<class lldb_private::ValueObject> &, class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> *, class lldb_private::ValueObject *) D:\Projects\github\llvm-project-fork\lldb\source\Expression\UserExpression.cpp:279:0
 #52 0x00007ffb3a8e7aab lldb_private::Target::EvaluateExpression(class llvm::StringRef, class lldb_private::ExecutionContextScope *, class std::shared_ptr<class lldb_private::ValueObject> &, class lldb_private::EvaluateExpressionOptions const &, class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> *, class lldb_private::ValueObject *) D:\Projects\github\llvm-project-fork\lldb\source\Target\Target.cpp:2853:0
 #53 0x00007ffb3ce06c2d lldb_private::CommandObjectExpression::EvaluateExpression(class llvm::StringRef, class lldb_private::Stream &, class lldb_private::Stream &, class lldb_private::CommandReturnObject &) D:\Projects\github\llvm-project-fork\lldb\source\Commands\CommandObjectExpression.cpp:428:0
 #54 0x00007ffb3ce0683a lldb_private::CommandObjectExpression::DoExecute(class llvm::StringRef, class lldb_private::CommandReturnObject &) D:\Projects\github\llvm-project-fork\lldb\source\Commands\CommandObjectExpression.cpp:668:0
 #55 0x00007ffb3a71dcd4 lldb_private::CommandObjectRaw::Execute(char const *, class lldb_private::CommandReturnObject &) D:\Projects\github\llvm-project-fork\lldb\source\Interpreter\CommandObject.cpp:855:0
 #56 0x00007ffb3a72a489 lldb_private::CommandInterpreter::HandleCommand(char const *, enum lldb_private::LazyBool, class lldb_private::CommandReturnObject &, bool) D:\Projects\github\llvm-project-fork\lldb\source\Interpreter\CommandInterpreter.cpp:2128:0
 #57 0x00007ffb3a140354 lldb::SBCommandInterpreter::HandleCommand(char const *, class lldb::SBExecutionContext &, class lldb::SBCommandReturnObject &, bool) D:\Projects\github\llvm-project-fork\lldb\source\API\SBCommandInterpreter.cpp:196:0
 #58 0x00007ffb3a140093 lldb::SBCommandInterpreter::HandleCommand(char const *, class lldb::SBCommandReturnObject &, bool) D:\Projects\github\llvm-project-fork\lldb\source\API\SBCommandInterpreter.cpp:176:0
 #59 0x00007ffb3a33387f _wrap_SBCommandInterpreter_HandleCommand__SWIG_0 D:\Projects\github\llvm-project-fork\llvm\cmake-build-relwithdebinfo\tools\lldb\bindings\python\LLDBWrapPython.cpp:16709:0
 #60 0x00007ffb3a334957 _wrap_SBCommandInterpreter_HandleCommand D:\Projects\github\llvm-project-fork\llvm\cmake-build-relwithdebinfo\tools\lldb\bindings\python\LLDBWrapPython.cpp:16939:0
```


Diff:
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h b/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h
index b6a794ad7e760..a64a2e888e9b9 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h
@@ -510,7 +510,9 @@ struct Variant {
 
 #define VARIANT_APSINT(Enum, NumBits, IsUnsigned)                              \
   case PDB_VariantType::Enum:                                                  \
-    return APSInt(APInt(NumBits, Value.Enum), IsUnsigned);
+    return APSInt(                                                             \
+        APInt(NumBits, static_cast<uint64_t>(Value.Enum), !IsUnsigned),        \
+        IsUnsigned);
 
   APSInt toAPSInt() const {
     switch (Type) {
diff --git a/llvm/unittests/DebugInfo/PDB/CMakeLists.txt b/llvm/unittests/DebugInfo/PDB/CMakeLists.txt
index c8c2659277a63..ba2a732848f4d 100644
--- a/llvm/unittests/DebugInfo/PDB/CMakeLists.txt
+++ b/llvm/unittests/DebugInfo/PDB/CMakeLists.txt
@@ -10,6 +10,7 @@ add_llvm_unittest_with_input_files(DebugInfoPDBTests
   NativeSymbolReuseTest.cpp
   StringTableBuilderTest.cpp
   PDBApiTest.cpp
+  PDBVariantTest.cpp
   )
 
 target_link_libraries(DebugInfoPDBTests PRIVATE LLVMTestingSupport)
diff --git a/llvm/unittests/DebugInfo/PDB/PDBVariantTest.cpp b/llvm/unittests/DebugInfo/PDB/PDBVariantTest.cpp
new file mode 100644
index 0000000000000..5dff893e7f13d
--- /dev/null
+++ b/llvm/unittests/DebugInfo/PDB/PDBVariantTest.cpp
@@ -0,0 +1,60 @@
+//===- llvm/unittest/DebugInfo/PDB/PDBVariantTest.cpp ---------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "gtest/gtest.h"
+
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
+
+using namespace llvm;
+using namespace llvm::pdb;
+
+namespace {
+
+template <typename T> class PDBVariantIntegerTest : public testing::Test {
+public:
+  std::vector<T> getTestIntegers() {
+    if constexpr (std::is_same_v<T, bool>) {
+      return {true, false};
+    } else {
+      std::vector<T> Integers{0, 1, 32, std::numeric_limits<T>::min(),
+                              std::numeric_limits<T>::max()};
+      if constexpr (std::is_signed_v<T>) {
+        Integers.emplace_back(-1);
+        Integers.emplace_back(-65);
+      }
+      return Integers;
+    }
+  }
+};
+
+using TestTypes = testing::Types<bool, int8_t, uint8_t, int16_t, uint16_t,
+                                 int32_t, uint32_t, int64_t, uint64_t>;
+
+} // namespace
+
+TYPED_TEST_SUITE(PDBVariantIntegerTest, TestTypes);
+
+TYPED_TEST(PDBVariantIntegerTest, ToAPSInt) {
+  for (TypeParam IntegerValue : this->getTestIntegers()) {
+    const Variant VariantValue(IntegerValue);
+
+    const APSInt APSIntValue = VariantValue.toAPSInt();
+    EXPECT_EQ(APSIntValue.isSigned(), std::is_signed_v<TypeParam>)
+        << "Unexpected 'isSigned()' result for '" << IntegerValue << "'";
+    bool IsNegative = false;
+    if constexpr (!std::is_same_v<TypeParam, bool>) {
+      IsNegative = IntegerValue < 0;
+    }
+    EXPECT_EQ(APSIntValue.isNegative(), IsNegative)
+        << "Unexpected 'isNegative()' result for '" << IntegerValue << "'";
+
+    SmallString<20> String;
+    APSIntValue.toString(String);
+    EXPECT_EQ(String.str().str(), std::to_string(IntegerValue));
+  }
+}


Reviews:
user: login: zmodem
body: LGTM with some nits
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-03-18T10:16:22Z
user: login: AlexK0
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-18T10:29:49Z
user: login: AlexK0
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-18T10:29:53Z

Review comments:
diff_hunk: @@ -0,0 +1,56 @@
+//===- llvm/unittest/DebugInfo/PDB/PDBVariantTest.cpp ---------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "gtest/gtest.h"
+
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
+
+using namespace llvm;
+using namespace llvm::pdb;
+
path: llvm/unittests/DebugInfo/PDB/PDBVariantTest.cpp
user: login: zmodem
body: I'd suggest wrapping the whole thing in an anonymous namespace.
created_at: 2025-03-18T10:12:26Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,56 @@
+//===- llvm/unittest/DebugInfo/PDB/PDBVariantTest.cpp ---------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "gtest/gtest.h"
+
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
+
+using namespace llvm;
+using namespace llvm::pdb;
+
+template <typename T>
path: llvm/unittests/DebugInfo/PDB/PDBVariantTest.cpp
user: login: zmodem
body: It seems clang-format would prefer to not have a line break here.
created_at: 2025-03-18T10:15:58Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,56 @@
+//===- llvm/unittest/DebugInfo/PDB/PDBVariantTest.cpp ---------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "gtest/gtest.h"
+
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
+
+using namespace llvm;
+using namespace llvm::pdb;
+
path: llvm/unittests/DebugInfo/PDB/PDBVariantTest.cpp
user: login: AlexK0
body: Fixed
created_at: 2025-03-18T10:29:49Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,56 @@
+//===- llvm/unittest/DebugInfo/PDB/PDBVariantTest.cpp ---------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "gtest/gtest.h"
+
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
+
+using namespace llvm;
+using namespace llvm::pdb;
+
+template <typename T>
path: llvm/unittests/DebugInfo/PDB/PDBVariantTest.cpp
user: login: AlexK0
body: Fixed
created_at: 2025-03-18T10:29:53Z
author_association: CONTRIBUTOR

PR comments:
user: login: llvmbot
created_at: 2025-03-17T10:28:08Z
body: 
<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-debuginfo

Author: Aleksandr Korepanov (AlexK0)

<details>
<summary>Changes</summary>

Hello.

This patch fixes an assertion that occurs in `APInt`.

The assertion can be reproduced with the test `python_api/thread/TestThreadAPI.py` (it fails).

Here is a stack trace:

```
Exception Code: 0x80000003
  #<!-- -->0 0x00007ffb3b5c3f8b HandleAbort D:\Projects\github\llvm-project-fork\llvm\lib\Support\Windows\Signals.inc:429:0
  #<!-- -->1 0x00007ffc08df1ae9 (C:\WINDOWS\System32\ucrtbase.dll+0xc1ae9)
  #<!-- -->2 0x00007ffc08dd4c11 (C:\WINDOWS\System32\ucrtbase.dll+0xa4c11)
  #<!-- -->3 0x00007ffc08df2ae6 (C:\WINDOWS\System32\ucrtbase.dll+0xc2ae6)
  #<!-- -->4 0x00007ffc08df2cc1 (C:\WINDOWS\System32\ucrtbase.dll+0xc2cc1)
  #<!-- -->5 0x00007ffb3a5e1201 llvm::APInt::APInt(unsigned int, unsigned __int64, bool, bool) D:\Projects\github\llvm-project-fork\llvm\include\llvm\ADT\APInt.h:127:0
  #<!-- -->6 0x00007ffb3b4b9a55 llvm::pdb::Variant::toAPSInt(void) const D:\Projects\github\llvm-project-fork\llvm\include\llvm\DebugInfo\PDB\PDBTypes.h:518:0
  #<!-- -->7 0x00007ffb3b4a4d84 PDBASTParser::AddRecordMembers(class lldb_private::SymbolFile &amp;, class lldb_private::CompilerType &amp;, class llvm::pdb::ConcreteSymbolEnumerator&lt;class llvm::pdb::PDBSymbolData&gt; &amp;, struct lldb_private::ClangASTImporter::LayoutInfo &amp;) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp:1316:0
  #<!-- -->8 0x00007ffb3b4a4380 PDBASTParser::CompleteTypeFromUDT(class lldb_private::SymbolFile &amp;, class lldb_private::CompilerType &amp;, class llvm::pdb::PDBSymbolTypeUDT &amp;) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp:1222:0
  #<!-- -->9 0x00007ffb3b4a1dd3 PDBASTParser::CompleteTypeFromPDB(class lldb_private::CompilerType &amp;) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp:827:0
 #<!-- -->10 0x00007ffb3b47b401 SymbolFilePDB::CompleteType(class lldb_private::CompilerType &amp;) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\SymbolFilePDB.cpp:610:0
 #<!-- -->11 0x00007ffb3a7f77f4 lldb_private::Type::ResolveCompilerType(enum lldb_private::Type::ResolveState) D:\Projects\github\llvm-project-fork\lldb\source\Symbol\Type.cpp:739:0
 #<!-- -->12 0x00007ffb3a7f625a lldb_private::Type::GetFullCompilerType(void) D:\Projects\github\llvm-project-fork\lldb\source\Symbol\Type.cpp:773:0
 #<!-- -->13 0x00007ffb3b49fcc3 PDBASTParser::CreateLLDBTypeFromPDBType(class llvm::pdb::PDBSymbol const &amp;) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp:564:0
 #<!-- -->14 0x00007ffb3b47af34 SymbolFilePDB::ResolveTypeUID(unsigned __int64) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\SymbolFilePDB.cpp:577:0
 #<!-- -->15 0x00007ffb3b4a2fbf PDBASTParser::GetDeclContextForSymbol(class llvm::pdb::PDBSymbol const &amp;) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp:1013:0
 #<!-- -->16 0x00007ffb3b4a35e5 PDBASTParser::GetDeclContextContainingSymbol(class llvm::pdb::PDBSymbol const &amp;) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp:1066:0
 #<!-- -->17 0x00007ffb3b4a2377 PDBASTParser::GetDeclForSymbol(class llvm::pdb::PDBSymbol const &amp;) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp:908:0
 #<!-- -->18 0x00007ffb3b4a3a71 PDBASTParser::ParseDeclsForDeclContext(class clang::DeclContext const *) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp:1123:0
 #<!-- -->19 0x00007ffb3b47c596 SymbolFilePDB::ParseDeclsForContext(class lldb_private::CompilerDeclContext) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\SymbolFile\PDB\SymbolFilePDB.cpp:725:0
 #<!-- -->20 0x00007ffb3b4ed55e lldb_private::TypeSystemClang::DeclContextFindDeclByName(void *, class lldb_private::ConstString, bool) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\TypeSystem\Clang\TypeSystemClang.cpp:9336:0
 #<!-- -->21 0x00007ffb3a883a72 lldb_private::CompilerDeclContext::FindDeclByName(class lldb_private::ConstString, bool) D:\Projects\github\llvm-project-fork\lldb\source\Symbol\CompilerDeclContext.cpp:20:0
 #<!-- -->22 0x00007ffb3d0826e1 lldb_private::ClangExpressionDeclMap::LookupLocalVariable(struct lldb_private::NameSearchContext &amp;, class lldb_private::ConstString, class lldb_private::SymbolContext &amp;, class lldb_private::CompilerDeclContext const &amp;) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangExpressionDeclMap.cpp:1080:0
 #<!-- -->23 0x00007ffb3d08031e lldb_private::ClangExpressionDeclMap::FindExternalVisibleDecls(struct lldb_private::NameSearchContext &amp;, class std::shared_ptr&lt;class lldb_private::Module&gt;, class lldb_private::CompilerDeclContext const &amp;) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangExpressionDeclMap.cpp:1418:0
 #<!-- -->24 0x00007ffb3d07fa4b lldb_private::ClangExpressionDeclMap::FindExternalVisibleDecls(struct lldb_private::NameSearchContext &amp;) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangExpressionDeclMap.cpp:724:0
 #<!-- -->25 0x00007ffb3d00a802 lldb_private::ClangASTSource::FindExternalVisibleDeclsByName(class clang::DeclContext const *, class clang::DeclarationName, class clang::DeclContext const *) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangASTSource.cpp:181:0
 #<!-- -->26 0x00007ffb3b542e73 lldb_private::ClangASTSource::ClangASTSourceProxy::FindExternalVisibleDeclsByName(class clang::DeclContext const *, class clang::DeclarationName, class clang::DeclContext const *) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangASTSource.h:220:0
 #<!-- -->27 0x00007ffb42fb849f clang::DeclContext::lookupImpl(class clang::DeclarationName, class clang::DeclContext const *) const D:\Projects\github\llvm-project-fork\clang\lib\AST\DeclBase.cpp:1916:0
 #<!-- -->28 0x00007ffb42fb7723 clang::DeclContext::lookup(class clang::DeclarationName) const D:\Projects\github\llvm-project-fork\clang\lib\AST\DeclBase.cpp:1876:0
 #<!-- -->29 0x00007ffb411cbd7e LookupDirect D:\Projects\github\llvm-project-fork\clang\lib\Sema\SemaLookup.cpp:1122:0
 #<!-- -->30 0x00007ffb411cc396 CppNamespaceLookup D:\Projects\github\llvm-project-fork\clang\lib\Sema\SemaLookup.cpp:1219:0
 #<!-- -->31 0x00007ffb411999db clang::Sema::CppLookupName(class clang::LookupResult &amp;, class clang::Scope *) D:\Projects\github\llvm-project-fork\clang\lib\Sema\SemaLookup.cpp:1518:0
 #<!-- -->32 0x00007ffb4119287b clang::Sema::LookupName(class clang::LookupResult &amp;, class clang::Scope *, bool, bool) D:\Projects\github\llvm-project-fork\clang\lib\Sema\SemaLookup.cpp:2274:0
 #<!-- -->33 0x00007ffb41193612 clang::Sema::LookupParsedName(class clang::LookupResult &amp;, class clang::Scope *, class clang::CXXScopeSpec *, class clang::QualType, bool, bool) D:\Projects\github\llvm-project-fork\clang\lib\Sema\SemaLookup.cpp:2720:0
 #<!-- -->34 0x00007ffb4122b501 clang::Sema::ClassifyName(class clang::Scope *, class clang::CXXScopeSpec &amp;, class clang::IdentifierInfo *&amp;, class clang::SourceLocation, class clang::Token const &amp;, class clang::CorrectionCandidateCallback *) D:\Projects\github\llvm-project-fork\clang\lib\Sema\SemaDecl.cpp:898:0
 #<!-- -->35 0x00007ffb40b46092 clang::Parser::TryAnnotateName(class clang::CorrectionCandidateCallback *, enum clang::ImplicitTypenameContext) D:\Projects\github\llvm-project-fork\clang\lib\Parse\Parser.cpp:1823:0
 #<!-- -->36 0x00007ffb40c799af clang::Parser::ParseStatementOrDeclarationAfterAttributes(class llvm::SmallVector&lt;class clang::Stmt *, 32&gt; &amp;, enum clang::Parser::ParsedStmtContext, class clang::SourceLocation *, class clang::ParsedAttributes &amp;, class clang::ParsedAttributes &amp;) D:\Projects\github\llvm-project-fork\clang\lib\Parse\ParseStmt.cpp:223:0
 #<!-- -->37 0x00007ffb40c7952d clang::Parser::ParseStatementOrDeclaration(class llvm::SmallVector&lt;class clang::Stmt *, 32&gt; &amp;, enum clang::Parser::ParsedStmtContext, class clang::SourceLocation *) D:\Projects\github\llvm-project-fork\clang\lib\Parse\ParseStmt.cpp:127:0
 #<!-- -->38 0x00007ffb40c7e09a clang::Parser::ParseCompoundStatementBody(bool) D:\Projects\github\llvm-project-fork\clang\lib\Parse\ParseStmt.cpp:1267:0
 #<!-- -->39 0x00007ffb40c86f0c clang::Parser::ParseFunctionStatementBody(class clang::Decl *, class clang::Parser::ParseScope &amp;) D:\Projects\github\llvm-project-fork\clang\lib\Parse\ParseStmt.cpp:2585:0
 #<!-- -->40 0x00007ffb40b4cee9 clang::Parser::ParseFunctionDefinition(class clang::ParsingDeclarator &amp;, struct clang::Parser::ParsedTemplateInfo const &amp;, class clang::Parser::LateParsedAttrList *) D:\Projects\github\llvm-project-fork\clang\lib\Parse\Parser.cpp:1520:0
 #<!-- -->41 0x00007ffb40b9e897 clang::Parser::ParseDeclGroup(class clang::ParsingDeclSpec &amp;, enum clang::DeclaratorContext, class clang::ParsedAttributes &amp;, struct clang::Parser::ParsedTemplateInfo &amp;, class clang::SourceLocation *, struct clang::Parser::ForRangeInit *) D:\Projects\github\llvm-project-fork\clang\lib\Parse\ParseDecl.cpp:2460:0
 #<!-- -->42 0x00007ffb40b4b754 clang::Parser::ParseDeclOrFunctionDefInternal(class clang::ParsedAttributes &amp;, class clang::ParsedAttributes &amp;, class clang::ParsingDeclSpec &amp;, enum clang::AccessSpecifier) D:\Projects\github\llvm-project-fork\clang\lib\Parse\Parser.cpp:1244:0
 #<!-- -->43 0x00007ffb40b4ad56 clang::Parser::ParseDeclarationOrFunctionDefinition(class clang::ParsedAttributes &amp;, class clang::ParsedAttributes &amp;, class clang::ParsingDeclSpec *, enum clang::AccessSpecifier) D:\Projects\github\llvm-project-fork\clang\lib\Parse\Parser.cpp:1266:0
 #<!-- -->44 0x00007ffb40b4a5db clang::Parser::ParseExternalDeclaration(class clang::ParsedAttributes &amp;, class clang::ParsedAttributes &amp;, class clang::ParsingDeclSpec *) D:\Projects\github\llvm-project-fork\clang\lib\Parse\Parser.cpp:1069:0
 #<!-- -->45 0x00007ffb40b43a62 clang::Parser::ParseTopLevelDecl(class clang::OpaquePtr&lt;class clang::DeclGroupRef&gt; &amp;, enum clang::Sema::ModuleImportState &amp;) D:\Projects\github\llvm-project-fork\clang\lib\Parse\Parser.cpp:758:0
 #<!-- -->46 0x00007ffb40b6332a clang::ParseAST(class clang::Sema &amp;, bool, bool) D:\Projects\github\llvm-project-fork\clang\lib\Parse\ParseAST.cpp:171:0
 #<!-- -->47 0x00007ffb3d044da4 lldb_private::ClangExpressionParser::ParseInternal(class lldb_private::DiagnosticManager &amp;, class clang::CodeCompleteConsumer *, unsigned int, unsigned int) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangExpressionParser.cpp:1348:0
 #<!-- -->48 0x00007ffb3d04249b lldb_private::ClangExpressionParser::Parse(class lldb_private::DiagnosticManager &amp;) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangExpressionParser.cpp:1205:0
 #<!-- -->49 0x00007ffb3d02d7ac lldb_private::ClangUserExpression::TryParse(class lldb_private::DiagnosticManager &amp;, class lldb_private::ExecutionContext &amp;, enum lldb_private::ExecutionPolicy, bool, bool) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangUserExpression.cpp:579:0
 #<!-- -->50 0x00007ffb3d02cb70 lldb_private::ClangUserExpression::Parse(class lldb_private::DiagnosticManager &amp;, class lldb_private::ExecutionContext &amp;, enum lldb_private::ExecutionPolicy, bool, bool) D:\Projects\github\llvm-project-fork\lldb\source\Plugins\ExpressionParser\Clang\ClangUserExpression.cpp:673:0
 #<!-- -->51 0x00007ffb3a6b5cdb lldb_private::UserExpression::Evaluate(class lldb_private::ExecutionContext &amp;, class lldb_private::EvaluateExpressionOptions const &amp;, class llvm::StringRef, class llvm::StringRef, class std::shared_ptr&lt;class lldb_private::ValueObject&gt; &amp;, class std::basic_string&lt;char, struct std::char_traits&lt;char&gt;, class std::allocator&lt;char&gt;&gt; *, class lldb_private::ValueObject *) D:\Projects\github\llvm-project-fork\lldb\source\Expression\UserExpression.cpp:279:0
 #<!-- -->52 0x00007ffb3a8e7aab lldb_private::Target::EvaluateExpression(class llvm::StringRef, class lldb_private::ExecutionContextScope *, class std::shared_ptr&lt;class lldb_private::ValueObject&gt; &amp;, class lldb_private::EvaluateExpressionOptions const &amp;, class std::basic_string&lt;char, struct std::char_traits&lt;char&gt;, class std::allocator&lt;char&gt;&gt; *, class lldb_private::ValueObject *) D:\Projects\github\llvm-project-fork\lldb\source\Target\Target.cpp:2853:0
 #<!-- -->53 0x00007ffb3ce06c2d lldb_private::CommandObjectExpression::EvaluateExpression(class llvm::StringRef, class lldb_private::Stream &amp;, class lldb_private::Stream &amp;, class lldb_private::CommandReturnObject &amp;) D:\Projects\github\llvm-project-fork\lldb\source\Commands\CommandObjectExpression.cpp:428:0
 #<!-- -->54 0x00007ffb3ce0683a lldb_private::CommandObjectExpression::DoExecute(class llvm::StringRef, class lldb_private::CommandReturnObject &amp;) D:\Projects\github\llvm-project-fork\lldb\source\Commands\CommandObjectExpression.cpp:668:0
 #<!-- -->55 0x00007ffb3a71dcd4 lldb_private::CommandObjectRaw::Execute(char const *, class lldb_private::CommandReturnObject &amp;) D:\Projects\github\llvm-project-fork\lldb\source\Interpreter\CommandObject.cpp:855:0
 #<!-- -->56 0x00007ffb3a72a489 lldb_private::CommandInterpreter::HandleCommand(char const *, enum lldb_private::LazyBool, class lldb_private::CommandReturnObject &amp;, bool) D:\Projects\github\llvm-project-fork\lldb\source\Interpreter\CommandInterpreter.cpp:2128:0
 #<!-- -->57 0x00007ffb3a140354 lldb::SBCommandInterpreter::HandleCommand(char const *, class lldb::SBExecutionContext &amp;, class lldb::SBCommandReturnObject &amp;, bool) D:\Projects\github\llvm-project-fork\lldb\source\API\SBCommandInterpreter.cpp:196:0
 #<!-- -->58 0x00007ffb3a140093 lldb::SBCommandInterpreter::HandleCommand(char const *, class lldb::SBCommandReturnObject &amp;, bool) D:\Projects\github\llvm-project-fork\lldb\source\API\SBCommandInterpreter.cpp:176:0
 #<!-- -->59 0x00007ffb3a33387f _wrap_SBCommandInterpreter_HandleCommand__SWIG_0 D:\Projects\github\llvm-project-fork\llvm\cmake-build-relwithdebinfo\tools\lldb\bindings\python\LLDBWrapPython.cpp:16709:0
 #<!-- -->60 0x00007ffb3a334957 _wrap_SBCommandInterpreter_HandleCommand D:\Projects\github\llvm-project-fork\llvm\cmake-build-relwithdebinfo\tools\lldb\bindings\python\LLDBWrapPython.cpp:16939:0
```

---
Full diff: https://github.com/llvm/llvm-project/pull/131598.diff


1 Files Affected:

- (modified) llvm/include/llvm/DebugInfo/PDB/PDBTypes.h (+3-1) 


``````````diff
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h b/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h
index b6a794ad7e760..a64a2e888e9b9 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h
@@ -510,7 +510,9 @@ struct Variant {
 
 #define VARIANT_APSINT(Enum, NumBits, IsUnsigned)                              \
   case PDB_VariantType::Enum:                                                  \
-    return APSInt(APInt(NumBits, Value.Enum), IsUnsigned);
+    return APSInt(                                                             \
+        APInt(NumBits, static_cast<uint64_t>(Value.Enum), !IsUnsigned),        \
+        IsUnsigned);
 
   APSInt toAPSInt() const {
     switch (Type) {

``````````

</details>

author_association: MEMBER
user: login: dwblaikie
created_at: 2025-03-17T14:41:32Z
body: A test case should be included - if it's reachable via pdb utilities in LLVM, that'd be ideal. If not, then maybe a unit test in LLVM using the API would be do-able? @zmodem might have pointers for a suitable reviewer for PDB related things
author_association: COLLABORATOR
user: login: AlexK0
created_at: 2025-03-18T09:36:58Z
body: > A test case should be included - if it's reachable via pdb utilities in LLVM, that'd be ideal. If not, then maybe a unit test in LLVM using the API would be do-able? @zmodem might have pointers for a suitable reviewer for PDB related things

I didn't find a way to write a test using `llvm-pdbutil` (it seems it doesn't use this API). Therefore, I added simple C++ unittests.
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-03-18T09:39:00Z
body: <!--LLVM CODE FORMAT COMMENT: {clang-format}-->

:white_check_mark: With the latest revision this PR passed the C/C++ code formatter.
author_association: NONE
user: login: zmodem
created_at: 2025-03-18T11:16:37Z
body: Thanks! Do you have access to the "Squash and merge" button, or would you like me to do it?
author_association: COLLABORATOR
user: login: AlexK0
created_at: 2025-03-18T14:43:07Z
body: > Thanks! Do you have access to the "Squash and merge" button, or would you like me to do it?

@zmodem I don't have access, could you please merge? Thanks!
author_association: CONTRIBUTOR
user: login: llvm-ci
created_at: 2025-03-18T17:26:21Z
body: LLVM Buildbot has detected a new failure on builder `clang-ppc64le-rhel` running on `ppc64le-clang-rhel-test` while building `llvm` at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/145/builds/5745

<details>
<summary>Here is the relevant piece of the build log for the reference</summary>

```
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
...
0.628 [1/3/2] Building CXX object compiler-rt/lib/ubsan/CMakeFiles/RTUbsan_dynamic_version_script_dummy.powerpc64le.dir/dummy.cpp.o
0.930 [0/3/3] Linking CXX shared library /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/lib/clang/21/lib/powerpc64le-unknown-linux-gnu/libclang_rt.ubsan_standalone.so
0.954 [0/2/4] Linking CXX shared library /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/lib/clang/21/lib/powerpc64le-unknown-linux-gnu/libclang_rt.asan.so
1.541 [0/1/5] Generating /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/compile_commands.json
24.361 [5/6/1213] Linking CXX executable unittests/Target/AMDGPU/AMDGPUTests
24.898 [4/5/1214] cd /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/runtimes/runtimes-bins && /home/buildbots/llvm-external-buildbots/cmake-3.31.2/bin/cmake --build /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/runtimes/runtimes-bins/ --target runtimes-test-depends --config Release
ninja: no work to do.
24.962 [3/5/1215] No install step for 'runtimes'
24.984 [2/5/1217] Completed 'runtimes'
25.251 [2/4/1218] Building CXX object unittests/DebugInfo/PDB/CMakeFiles/DebugInfoPDBTests.dir/PDBVariantTest.cpp.o
FAILED: unittests/DebugInfo/PDB/CMakeFiles/DebugInfoPDBTests.dir/PDBVariantTest.cpp.o 
ccache /home/buildbots/llvm-external-buildbots/clang.19.1.7/bin/clang++ --gcc-toolchain=/gcc-toolchain/usr -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/unittests/DebugInfo/PDB -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/unittests/DebugInfo/PDB -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/third-party/unittest/googletest/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/third-party/unittest/googlemock/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT unittests/DebugInfo/PDB/CMakeFiles/DebugInfoPDBTests.dir/PDBVariantTest.cpp.o -MF unittests/DebugInfo/PDB/CMakeFiles/DebugInfoPDBTests.dir/PDBVariantTest.cpp.o.d -o unittests/DebugInfo/PDB/CMakeFiles/DebugInfoPDBTests.dir/PDBVariantTest.cpp.o -c /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/unittests/DebugInfo/PDB/PDBVariantTest.cpp
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/unittests/DebugInfo/PDB/PDBVariantTest.cpp:40:50: error: passing no argument for the '...' parameter of a variadic macro is a C++20 extension [-Werror,-Wc++20-extensions]
   40 | TYPED_TEST_SUITE(PDBVariantIntegerTest, TestTypes);
      |                                                  ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/third-party/unittest/googletest/include/gtest/gtest-typed-test.h:191:9: note: macro 'TYPED_TEST_SUITE' defined here
  191 | #define TYPED_TEST_SUITE(CaseName, Types, ...)                          \
      |         ^
1 error generated.
26.077 [2/3/1219] Building CXX object unittests/DebugInfo/PDB/CMakeFiles/DebugInfoPDBTests.dir/PDBApiTest.cpp.o
26.865 [2/2/1220] Building CXX object unittests/DebugInfo/PDB/CMakeFiles/DebugInfoPDBTests.dir/NativeSessionTest.cpp.o
27.035 [2/1/1221] Building CXX object unittests/DebugInfo/PDB/CMakeFiles/DebugInfoPDBTests.dir/NativeSymbolReuseTest.cpp.o
ninja: build stopped: subcommand failed.

```

</details>
author_association: NONE
user: login: llvm-ci
created_at: 2025-03-18T18:21:00Z
body: LLVM Buildbot has detected a new failure on builder `clang-aarch64-sve-vls` running on `linaro-g3-04` while building `llvm` at step 3 "checkout".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/143/builds/6278

<details>
<summary>Here is the relevant piece of the build log for the reference</summary>

```
Step 3 (checkout) failure: update (failure)
git version 2.34.1
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

```

</details>
author_association: NONE
user: login: llvm-ci
created_at: 2025-03-18T19:00:30Z
body: LLVM Buildbot has detected a new failure on builder `lld-x86_64-win` running on `as-worker-93` while building `llvm` at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/146/builds/2522

<details>
<summary>Here is the relevant piece of the build log for the reference</summary>

```
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests.exe/38/87' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe-LLVM-Unit-19024-38-87.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=87 GTEST_SHARD_INDEX=38 C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe
--

Script:
--
C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe --gtest_filter=ProgramEnvTest.CreateProcessLongPath
--
C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(160): error: Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(163): error: fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied



C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:160
Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:163
fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied




********************


```

</details>
author_association: NONE
user: login: llvm-ci
created_at: 2025-03-18T23:27:10Z
body: LLVM Buildbot has detected a new failure on builder `clang-ppc64-aix` running on `aix-ppc64` while building `llvm` at step 3 "clean-build-dir".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/64/builds/2525

<details>
<summary>Here is the relevant piece of the build log for the reference</summary>

```
Step 3 (clean-build-dir) failure: Delete failed. (failure) (timed out)
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'Clang :: ClangScanDeps/verbose.test' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: rm -rf /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp
+ rm -rf /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp
RUN: at line 2: split-file /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp
+ split-file /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp
RUN: at line 3: sed -e "s|DIR|/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp|g" /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/cdb.json.in > /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/cdb.json
+ sed -e 's|DIR|/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp|g' /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/cdb.json.in
RUN: at line 5: /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/bin/clang-scan-deps -compilation-database /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/cdb.json -v -o /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/result.json 2>&1 | /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/bin/FileCheck /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test
+ /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/bin/clang-scan-deps -compilation-database /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/cdb.json -v -o /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/result.json
+ /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/bin/FileCheck /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test:6:11: error: CHECK: expected string not found in input
// CHECK: *** Virtual File System Stats:
          ^
<stdin>:1:1: note: scanning from here
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
^
<stdin>:1:8: note: possible intended match here
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
       ^

Input file: <stdin>
Check file: /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           1: PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. 
check:6'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:6'1            ?                                                                                                     possible intended match
>>>>>>

--

********************


```

</details>
author_association: NONE