[PATCH] D65935: [ASTImporter] Import ctor initializers after setting flags.

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 16 02:21:43 PDT 2019


balazske added a comment.

LLDB probably does the import in other way. CTU test fails without the fix:

  FAIL: Clang :: Analysis/ctu-main.cpp (540 of 15341)
  ******************** TEST 'Clang :: Analysis/ctu-main.cpp' FAILED ********************
  Script:
  --
  : 'RUN: at line 1';   rm -rf build/Release/tools/clang/test/Analysis/Output/ctu-main.cpp.tmp && mkdir build/Release/tools/clang/test/Analysis/Output/ctu-main.cpp.tmp
  : 'RUN: at line 2';   mkdir -p build/Release/tools/clang/test/Analysis/Output/ctu-main.cpp.tmp/ctudir
  : 'RUN: at line 3';   build/Release/bin/clang -cc1 -internal-isystem build/Release/lib/clang/10.0.0/include -nostdsysteminc -triple x86_64-pc-linux-gnu    -emit-pch -o build/Release/tools/clang/test/Analysis/Output/ctu-main.cpp.tmp/ctudir/ctu-other.cpp.ast llvm-project/clang/test/Analysis/Inputs/ctu-other.cpp
  : 'RUN: at line 5';   build/Release/bin/clang -cc1 -internal-isystem build/Release/lib/clang/10.0.0/include -nostdsysteminc -triple x86_64-pc-linux-gnu    -emit-pch -o build/Release/tools/clang/test/Analysis/Output/ctu-main.cpp.tmp/ctudir/ctu-chain.cpp.ast llvm-project/clang/test/Analysis/Inputs/ctu-chain.cpp
  : 'RUN: at line 7';   cp llvm-project/clang/test/Analysis/Inputs/ctu-other.cpp.externalDefMap.txt build/Release/tools/clang/test/Analysis/Output/ctu-main.cpp.tmp/ctudir/externalDefMap.txt
  : 'RUN: at line 8';   build/Release/bin/clang -cc1 -internal-isystem build/Release/lib/clang/10.0.0/include -nostdsysteminc -analyze -analyzer-constraints=range -triple x86_64-pc-linux-gnu    -analyzer-checker=core,debug.ExprInspection    -analyzer-config experimental-enable-naive-ctu-analysis=true    -analyzer-config ctu-dir=build/Release/tools/clang/test/Analysis/Output/ctu-main.cpp.tmp/ctudir    -verify llvm-project/clang/test/Analysis/ctu-main.cpp
  : 'RUN: at line 13';   build/Release/bin/clang -cc1 -internal-isystem build/Release/lib/clang/10.0.0/include -nostdsysteminc -analyze -analyzer-constraints=range -triple x86_64-pc-linux-gnu    -analyzer-checker=core,debug.ExprInspection    -analyzer-config experimental-enable-naive-ctu-analysis=true    -analyzer-config ctu-dir=build/Release/tools/clang/test/Analysis/Output/ctu-main.cpp.tmp/ctudir    -analyzer-config display-ctu-progress=true 2>&1 llvm-project/clang/test/Analysis/ctu-main.cpp | build/Release/bin/FileCheck llvm-project/clang/test/Analysis/ctu-main.cpp
  --
  Exit Code: 134
  
  Command Output (stderr):
  --
  clang: llvm-project/clang/lib/AST/DeclBase.cpp:939: bool clang::Decl::AccessDeclContextSanity() const: Assertion `Access != AS_none && "Access specifier is AS_none inside a record decl"' failed.
  Stack dump:
  0.      Program arguments: build/Release/bin/clang -cc1 -internal-isystem build/Release/lib/clang/10.0.0/include -nostdsysteminc -analyze -analyzer-constraints=range -triple x86_64-pc-linux-gnu -analyzer-checker=core,debug.ExprInspection -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=build/Release/tools/clang/test/Analysis/Output/ctu-main.cpp.tmp/ctudir -verify llvm-project/clang/test/Analysis/ctu-main.cpp 
  1.      <eof> parser at end of file
  2.      While analyzing stack: 
          #0 Calling main
  3.      llvm-project/clang/test/Analysis/ctu-main.cpp:164:23: Error evaluating statement
  4.      llvm-project/clang/test/Analysis/ctu-main.cpp:164:23: Error evaluating statement
   #0 0x00007f30c91a5efa llvm::sys::PrintStackTrace(llvm::raw_ostream&) (build/Release/lib/libLLVMSupport.so.10svn+0x191efa)
   #1 0x00007f30c91a3bd4 llvm::sys::RunSignalHandlers() (build/Release/lib/libLLVMSupport.so.10svn+0x18fbd4)
   #2 0x00007f30c91a3d12 SignalHandler(int) (build/Release/lib/libLLVMSupport.so.10svn+0x18fd12)
   #3 0x00007f30c6347f20 (/lib/x86_64-linux-gnu/libc.so.6+0x3ef20)
   #4 0x00007f30c6347e97 raise /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
   #5 0x00007f30c6349801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
   #6 0x00007f30c633939a __assert_fail_base /build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
   #7 0x00007f30c6339412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
   #8 0x00007f30c24ad3fc (build/Release/lib/libclangAST.so.10svn+0x27c3fc)
   #9 0x00007f30c23c1f49 clang::Decl::getAccess() const (build/Release/lib/libclangAST.so.10svn+0x190f49)
  #10 0x00007f30c2309f32 IsStructurallyEquivalent(clang::StructuralEquivalenceContext&, clang::CXXMethodDecl*, clang::CXXMethodDecl*) (build/Release/lib/libclangAST.so.10svn+0xd8f32)
  #11 0x00007f30c243cda9 clang::StructuralEquivalenceContext::CheckKindSpecificEquivalence(clang::Decl*, clang::Decl*) (build/Release/lib/libclangAST.so.10svn+0x20bda9)
  #12 0x00007f30c243d046 clang::StructuralEquivalenceContext::Finish() (build/Release/lib/libclangAST.so.10svn+0x20c046)
  #13 0x00007f30c243da28 clang::StructuralEquivalenceContext::IsEquivalent(clang::Decl*, clang::Decl*) (build/Release/lib/libclangAST.so.10svn+0x20ca28)
  #14 0x00007f30c23c43fb clang::ASTNodeImporter::IsStructuralMatch(clang::FunctionDecl*, clang::FunctionDecl*) (build/Release/lib/libclangAST.so.10svn+0x1933fb)
  #15 0x00007f30c23d4689 clang::ASTNodeImporter::VisitFunctionDecl(clang::FunctionDecl*) (build/Release/lib/libclangAST.so.10svn+0x1a3689)
  #16 0x00007f30c23d626d clang::ASTNodeImporter::VisitCXXMethodDecl(clang::CXXMethodDecl*) (build/Release/lib/libclangAST.so.10svn+0x1a526d)
  #17 0x00007f30c23d62ad clang::ASTNodeImporter::VisitCXXConstructorDecl(clang::CXXConstructorDecl*) (build/Release/lib/libclangAST.so.10svn+0x1a52ad)
  #18 0x00007f30c23d65d5 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*> >::Visit(clang::Decl*) (build/Release/lib/libclangAST.so.10svn+0x1a55d5)
  #19 0x00007f30c23d6a4b clang::ASTImporter::Import(clang::Decl*) (build/Release/lib/libclangAST.so.10svn+0x1a5a4b)
  #20 0x00007f30c23dbec8 llvm::Expected<std::tuple<clang::CXXConstructorDecl*> > clang::ASTNodeImporter::importSeq<clang::CXXConstructorDecl*>(clang::CXXConstructorDecl* const&) (.isra.2408) (build/Release/lib/libclangAST.so.10svn+0x1aaec8)
  #21 0x00007f30c241537b clang::ASTNodeImporter::VisitCXXConstructExpr(clang::CXXConstructExpr*) (build/Release/lib/libclangAST.so.10svn+0x1e437b)
  #22 0x00007f30c23dcfbe clang::StmtVisitorBase<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Stmt*> >::Visit(clang::Stmt*) (build/Release/lib/libclangAST.so.10svn+0x1abfbe)
  #23 0x00007f30c23dd3e7 clang::ASTImporter::Import(clang::Stmt*) (build/Release/lib/libclangAST.so.10svn+0x1ac3e7)
  #24 0x00007f30c23e01e2 clang::ASTImporter::Import(clang::Expr*) (build/Release/lib/libclangAST.so.10svn+0x1af1e2)
  #25 0x00007f30c241db2e clang::ASTImporter::Import(clang::CXXCtorInitializer*) (build/Release/lib/libclangAST.so.10svn+0x1ecb2e)
  #26 0x00007f30c241e376 llvm::Error clang::ASTNodeImporter::ImportArrayChecked<clang::CXXCtorInitializer**, clang::CXXCtorInitializer**>(clang::CXXCtorInitializer**, clang::CXXCtorInitializer**, clang::CXXCtorInitializer**) (build/Release/lib/libclangAST.so.10svn+0x1ed376)
  #27 0x00007f30c23d5b6e clang::ASTNodeImporter::VisitFunctionDecl(clang::FunctionDecl*) (build/Release/lib/libclangAST.so.10svn+0x1a4b6e)
  #28 0x00007f30c23d626d clang::ASTNodeImporter::VisitCXXMethodDecl(clang::CXXMethodDecl*) (build/Release/lib/libclangAST.so.10svn+0x1a526d)
  #29 0x00007f30c23d62ad clang::ASTNodeImporter::VisitCXXConstructorDecl(clang::CXXConstructorDecl*) (build/Release/lib/libclangAST.so.10svn+0x1a52ad)
  #30 0x00007f30c23d65d5 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*> >::Visit(clang::Decl*) (build/Release/lib/libclangAST.so.10svn+0x1a55d5)
  #31 0x00007f30c23d6a4b clang::ASTImporter::Import(clang::Decl*) (build/Release/lib/libclangAST.so.10svn+0x1a5a4b)
  #32 0x00007f30c23d82b5 llvm::Expected<clang::Decl*> clang::ASTNodeImporter::import<clang::Decl>(clang::Decl*) (build/Release/lib/libclangAST.so.10svn+0x1a72b5)
  #33 0x00007f30c24016df clang::ASTNodeImporter::ImportDeclContext(clang::DeclContext*, bool) (build/Release/lib/libclangAST.so.10svn+0x1d06df)
  #34 0x00007f30c2400f07 clang::ASTNodeImporter::ImportDefinition(clang::RecordDecl*, clang::RecordDecl*, clang::ASTNodeImporter::ImportDefinitionKind) (build/Release/lib/libclangAST.so.10svn+0x1cff07)
  #35 0x00007f30c240c2e9 clang::ASTNodeImporter::VisitRecordDecl(clang::RecordDecl*) (build/Release/lib/libclangAST.so.10svn+0x1db2e9)
  #36 0x00007f30c23d6415 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*> >::Visit(clang::Decl*) (build/Release/lib/libclangAST.so.10svn+0x1a5415)
  #37 0x00007f30c23d6a4b clang::ASTImporter::Import(clang::Decl*) (build/Release/lib/libclangAST.so.10svn+0x1a5a4b)
  #38 0x00007f30c23d9657 clang::ASTNodeImporter::VisitRecordType(clang::RecordType const*) (build/Release/lib/libclangAST.so.10svn+0x1a8657)
  #39 0x00007f30c23e7ce5 clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType> >::Visit(clang::Type const*) (build/Release/lib/libclangAST.so.10svn+0x1b6ce5)
  #40 0x00007f30c23e7ec1 clang::ASTImporter::Import(clang::QualType) (build/Release/lib/libclangAST.so.10svn+0x1b6ec1)
  #41 0x00007f30c23ebcd8 llvm::Expected<std::tuple<clang::QualType> > clang::ASTNodeImporter::importSeq<clang::QualType>(clang::QualType const&) (build/Release/lib/libclangAST.so.10svn+0x1bacd8)
  #42 0x00007f30c2411c8d clang::ASTNodeImporter::VisitVarDecl(clang::VarDecl*) (build/Release/lib/libclangAST.so.10svn+0x1e0c8d)
  #43 0x00007f30c23d63bd clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*> >::Visit(clang::Decl*) (build/Release/lib/libclangAST.so.10svn+0x1a53bd)
  #44 0x00007f30c23d6a4b clang::ASTImporter::Import(clang::Decl*) (build/Release/lib/libclangAST.so.10svn+0x1a5a4b)
  #45 0x00007f30c23d82b5 llvm::Expected<clang::Decl*> clang::ASTNodeImporter::import<clang::Decl>(clang::Decl*) (build/Release/lib/libclangAST.so.10svn+0x1a72b5)
  #46 0x00007f30c23d83ff llvm::Expected<clang::DeclGroupRef> clang::ASTNodeImporter::import<clang::DeclGroupRef>(clang::DeclGroupRef const&) (build/Release/lib/libclangAST.so.10svn+0x1a73ff)
  #47 0x00007f30c23d8708 clang::ASTNodeImporter::VisitDeclStmt(clang::DeclStmt*) (build/Release/lib/libclangAST.so.10svn+0x1a7708)
  #48 0x00007f30c23dd1e0 clang::StmtVisitorBase<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Stmt*> >::Visit(clang::Stmt*) (build/Release/lib/libclangAST.so.10svn+0x1ac1e0)
  #49 0x00007f30c23dd3e7 clang::ASTImporter::Import(clang::Stmt*) (build/Release/lib/libclangAST.so.10svn+0x1ac3e7)
  #50 0x00007f30c23dd685 llvm::Expected<clang::Stmt*> clang::ASTNodeImporter::import<clang::Stmt>(clang::Stmt*) (build/Release/lib/libclangAST.so.10svn+0x1ac685)
  #51 0x00007f30c23dd904 clang::ASTNodeImporter::VisitCompoundStmt(clang::CompoundStmt*) (build/Release/lib/libclangAST.so.10svn+0x1ac904)
  #52 0x00007f30c23dd214 clang::StmtVisitorBase<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Stmt*> >::Visit(clang::Stmt*) (build/Release/lib/libclangAST.so.10svn+0x1ac214)
  #53 0x00007f30c23dd3e7 clang::ASTImporter::Import(clang::Stmt*) (build/Release/lib/libclangAST.so.10svn+0x1ac3e7)
  #54 0x00007f30c23dd685 llvm::Expected<clang::Stmt*> clang::ASTNodeImporter::import<clang::Stmt>(clang::Stmt*) (build/Release/lib/libclangAST.so.10svn+0x1ac685)
  #55 0x00007f30c23dd79f clang::ASTNodeImporter::ImportFunctionDeclBody(clang::FunctionDecl*, clang::FunctionDecl*) (build/Release/lib/libclangAST.so.10svn+0x1ac79f)
  #56 0x00007f30c23d596b clang::ASTNodeImporter::VisitFunctionDecl(clang::FunctionDecl*) (build/Release/lib/libclangAST.so.10svn+0x1a496b)
  #57 0x00007f30c23d63e5 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*> >::Visit(clang::Decl*) (build/Release/lib/libclangAST.so.10svn+0x1a53e5)
  #58 0x00007f30c23d6a4b clang::ASTImporter::Import(clang::Decl*) (build/Release/lib/libclangAST.so.10svn+0x1a5a4b)
  #59 0x00007f30be7a7e6d clang::cross_tu::CrossTranslationUnitContext::importDefinition(clang::FunctionDecl const*, clang::ASTUnit*) (build/Release/lib/libclangCrossTU.so.10svn+0xde6d)
  #60 0x00007f30be7a8501 clang::cross_tu::CrossTranslationUnitContext::getCrossTUDefinition(clang::FunctionDecl const*, llvm::StringRef, llvm::StringRef, bool) (build/Release/lib/libclangCrossTU.so.10svn+0xe501)
  #61 0x00007f30bdd0c985 clang::ento::AnyFunctionCall::getRuntimeDefinition() const (build/Release/lib/libclangStaticAnalyzerCore.so.10svn+0xaf985)
  #62 0x00007f30bdd7479b clang::ento::ExprEngine::defaultEvalCall(clang::ento::NodeBuilder&, clang::ento::ExplodedNode*, clang::ento::CallEvent const&, clang::ento::ExprEngine::EvalCallOptions const&) (build/Release/lib/libclangStaticAnalyzerCore.so.10svn+0x11779b)
  #63 0x00007f30bdd1a0c9 clang::ento::CheckerManager::runCheckersForEvalCall(clang::ento::ExplodedNodeSet&, clang::ento::ExplodedNodeSet const&, clang::ento::CallEvent const&, clang::ento::ExprEngine&) (build/Release/lib/libclangStaticAnalyzerCore.so.10svn+0xbd0c9)
  #64 0x00007f30bdd70ebf clang::ento::ExprEngine::evalCall(clang::ento::ExplodedNodeSet&, clang::ento::ExplodedNode*, clang::ento::CallEvent const&) (build/Release/lib/libclangStaticAnalyzerCore.so.10svn+0x113ebf)
  #65 0x00007f30bdd711f8 clang::ento::ExprEngine::VisitCallExpr(clang::CallExpr const*, clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&) (build/Release/lib/libclangStaticAnalyzerCore.so.10svn+0x1141f8)
  #66 0x00007f30bdd5598d clang::ento::ExprEngine::Visit(clang::Stmt const*, clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&) (build/Release/lib/libclangStaticAnalyzerCore.so.10svn+0xf898d)
  #67 0x00007f30bdd56594 clang::ento::ExprEngine::ProcessStmt(clang::Stmt const*, clang::ento::ExplodedNode*) (build/Release/lib/libclangStaticAnalyzerCore.so.10svn+0xf9594)
  #68 0x00007f30bdd56782 clang::ento::ExprEngine::processCFGElement(clang::CFGElement, clang::ento::ExplodedNode*, unsigned int, clang::ento::NodeBuilderContext*) (build/Release/lib/libclangStaticAnalyzerCore.so.10svn+0xf9782)
  #69 0x00007f30bdd23cbb clang::ento::CoreEngine::HandlePostStmt(clang::CFGBlock const*, unsigned int, clang::ento::ExplodedNode*) (build/Release/lib/libclangStaticAnalyzerCore.so.10svn+0xc6cbb)
  #70 0x00007f30bdd23f27 clang::ento::CoreEngine::dispatchWorkItem(clang::ento::ExplodedNode*, clang::ProgramPoint, clang::ento::WorkListUnit const&) (build/Release/lib/libclangStaticAnalyzerCore.so.10svn+0xc6f27)
  #71 0x00007f30bdd241a4 clang::ento::CoreEngine::ExecuteWorkList(clang::LocationContext const*, unsigned int, llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>) (build/Release/lib/libclangStaticAnalyzerCore.so.10svn+0xc71a4)
  #72 0x00007f30bf3e9339 (anonymous namespace)::AnalysisConsumer::HandleCode(clang::Decl*, unsigned int, clang::ento::ExprEngine::InliningModes, llvm::DenseSet<clang::Decl const*, llvm::DenseMapInfo<clang::Decl const*> >*) (build/Release/lib/libclangStaticAnalyzerFrontend.so.10svn+0x2f339)
  #73 0x00007f30bf3f8868 (anonymous namespace)::AnalysisConsumer::runAnalysisOnTranslationUnit(clang::ASTContext&) (build/Release/lib/libclangStaticAnalyzerFrontend.so.10svn+0x3e868)
  #74 0x00007f30bf3f963b (anonymous namespace)::AnalysisConsumer::HandleTranslationUnit(clang::ASTContext&) (build/Release/lib/libclangStaticAnalyzerFrontend.so.10svn+0x3f63b)
  #75 0x00007f30c0da3e49 clang::ParseAST(clang::Sema&, bool, bool) (build/Release/lib/libclangParse.so.10svn+0x2fe49)
  #76 0x00007f30c71c23a9 clang::FrontendAction::Execute() (build/Release/lib/libclangFrontend.so.10svn+0xf83a9)
  #77 0x00007f30c717cab1 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (build/Release/lib/libclangFrontend.so.10svn+0xb2ab1)
  #78 0x00007f30c6ec784f clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (build/Release/lib/libclangFrontendTool.so.10svn+0x484f)
  #79 0x0000557bea4109cf cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (build/Release/bin/clang+0x129cf)
  #80 0x0000557bea40b3c9 main (build/Release/bin/clang+0xd3c9)
  #81 0x00007f30c632ab97 __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
  #82 0x0000557bea40c1ba _start (build/Release/bin/clang+0xe1ba)
  build/Release/tools/clang/test/Analysis/Output/ctu-main.cpp.script: line 7: 12535 Aborted                 (core dumped) build/Release/bin/clang -cc1 -internal-isystem build/Release/lib/clang/10.0.0/include -nostdsysteminc -analyze -analyzer-constraints=range -triple x86_64-pc-linux-gnu -analyzer-checker=core,debug.ExprInspection -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=build/Release/tools/clang/test/Analysis/Output/ctu-main.cpp.tmp/ctudir -verify llvm-project/clang/test/Analysis/ctu-main.cpp


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65935





More information about the cfe-commits mailing list