[PATCH] D101236: [ASTImporter] Import definitions required for layout of [[no_unique_address]] from LLDB

Jan Kratochvil via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 2 10:54:40 PDT 2021


jankratochvil added a comment.

In D101236#2716317 <https://reviews.llvm.org/D101236#2716317>, @martong wrote:

> You can create a similar descendant class, but with the MinimalImport flag set to true. Then you could call `ImportDefinition` subsequently after an `Import` call. Perhaps that could trigger your assertion.

Do you have another hint or should I try harder? Thanks.

  clang/lib/Basic/SourceManager.cpp:865: clang::FileID clang::SourceManager::getFileIDLoaded(unsigned int) const: Assertion `0 && "Invalid SLocOffset or bad function choice"' failed.
  * thread #1, name = 'ASTTests', stop reason = hit program assert
      frame #4: 0x00000000028d7195 ASTTests`clang::SourceManager::getFileIDLoaded(this=0x0000000004ecf640, SLocOffset=14405) const at SourceManager.cpp:865:5
     862  FileID SourceManager::getFileIDLoaded(unsigned SLocOffset) const {
     863    // Sanity checking, otherwise a bug may lead to hanging in release build.
     864    if (SLocOffset < CurrentLoadedOffset) {
  -> 865      assert(0 && "Invalid SLocOffset or bad function choice");
     866      return FileID();
     867    }
     868
  (lldb) p SLocOffset
  (unsigned int) $0 = 14405
  (lldb) p CurrentLoadedOffset
  (unsigned int) $1 = 2147483648
  (lldb) bt
      frame # 3: libc.so.6`__assert_fail + 70
    * frame # 4: ASTTests`clang::SourceManager::getFileIDLoaded(this=0x0000000004ecf640, SLocOffset=14405) const at SourceManager.cpp:865:5
      frame # 5: ASTTests`clang::SourceManager::getFileIDSlow(this=0x0000000004ecf640, SLocOffset=14405) const at SourceManager.cpp:773:10
      frame # 6: ASTTests`clang::SourceManager::getFileID(clang::SourceLocation) const at SourceManager.h:1107:12
      frame # 7: ASTTests`clang::SourceManager::getDecomposedExpansionLoc(this=0x0000000004ecf640, Loc=(ID = 14405)) const at SourceManager.h:1247:18
      frame # 8: ASTTests`clang::SourceManager::getPresumedLoc(this=0x0000000004ecf640, Loc=(ID = 14405), UseLineDirectives=true) const at SourceManager.cpp:1521:41
      frame # 9: ASTTests`clang::SourceManager::isWrittenInBuiltinFile(this=0x0000000004ecf640, Loc=(ID = 14405)) const at SourceManager.h:1468:24
      frame #10: ASTTests`clang::ASTImporter::Import(this=0x00007ffff78f9010, FromLoc=(ID = 14405)) at ASTImporter.cpp:8834:27
      frame #11: ASTTests`llvm::Error clang::ASTImporter::importInto<clang::SourceLocation>(this=0x00007ffff78f9010, To=0x00007fffffffbe68, From=0x00007fffffffb8e8) at ASTImporter.h:336:22
      frame #12: ASTTests`llvm::Error clang::ASTNodeImporter::importInto<clang::SourceLocation>(this=0x00007fffffffbf60, To=0x00007fffffffbe68, From=0x00007fffffffb8e8) at ASTImporter.cpp:148:23
      frame #13: ASTTests`clang::ASTNodeImporter::ImportDeclParts(this=0x00007fffffffbf60, D=0x0000000004eb8190, DC=0x00007fffffffbe80, LexicalDC=0x00007fffffffbe78, Name=0x00007fffffffbe70, ToD=0x00007fffffffbe60, Loc=0x00007fffffffbe68) at ASTImporter.cpp:1654:19
      frame #14: ASTTests`clang::ASTNodeImporter::VisitRecordDecl(this=0x00007fffffffbf60, D=0x0000000004eb8190) at ASTImporter.cpp:2772:19
      frame #15: ASTTests`clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*> >::VisitCXXRecordDecl(this=0x00007fffffffbf60, D=0x0000000004eb8190) at DeclNodes.inc:263:1
      frame #16: ASTTests`clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*> >::Visit(this=0x00007fffffffbf60, D=0x0000000004eb8190) at DeclNodes.inc:263:1
      frame #17: ASTTests`clang::ASTImporter::ImportImpl(this=0x00007ffff78f9010, FromD=0x0000000004eb8190) at ASTImporter.cpp:8216:19
      frame #18: ASTTests`clang::ASTImporter::Import(this=0x00007ffff78f9010, FromD=0x0000000004eb8190) at ASTImporter.cpp:8387:27
      frame #19: ASTTests`llvm::Expected<clang::Decl*> clang::ASTNodeImporter::import<clang::Decl>(this=0x00007fffffffc6c8, From=0x0000000004eb8190) at ASTImporter.cpp:164:31
      frame #20: ASTTests`clang::ASTNodeImporter::ImportDeclContext(this=0x00007fffffffc6c8, FromDC=0x0000000004e886a8, ForceImport=true) at ASTImporter.cpp:1777:34
      frame #21: ASTTests`clang::ASTImporter::ImportDefinition(this=0x00007ffff78f9010, From=0x0000000004e88668) at ASTImporter.cpp:9072:19
      frame #22: ASTTests`clang::ast_matchers::LLDBMinimalImport_LLDBImportNoUniqueAddress_Test::TestBody() at ASTImporterTest.cpp:6408:50


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101236/new/

https://reviews.llvm.org/D101236



More information about the cfe-commits mailing list