From e033ec291a1b72f307ab14569ca99822c127610b Mon Sep 17 00:00:00 2001 From: Gabor Marton Date: Thu, 16 Apr 2020 15:48:13 +0200 Subject: [PATCH] [ASTImporter] Fix bug introduced in 2ba4e3a4598b 2ba4e3a4598b (Move FPFeatures from BinaryOperator bitfields to Trailing storage, D76384) introduced an assertion failure during CTU analysis. The reason is that in ASTNodeImporter::VisitCompoundAssignOperator the LHSType and the ResultType have been imported twice. Details: clang: ../../git/llvm-project/clang/lib/Basic/SourceManager.cpp:918: clang::FileID clang::SourceManager::getFileIDLoaded(unsigned int) const: Assertion `0 && "Invalid SLocOffset or bad function choice"' failed. clang::SourceManager::getDecomposedExpansionLoc(clang::SourceLocation) const clang::SourceManager::getPresumedLoc(clang::SourceLocation, bool) const clang::ASTImporter::Import(clang::SourceLocation) llvm::Error clang::ASTImporter::importInto(clang::SourceLocation&, clang::SourceLocation const&) clang::ASTNodeImporter::ImportDeclParts(clang::NamedDecl*, clang::DeclContext*&, clang::DeclContext*&, clang::DeclarationName&, clang::NamedDecl*&, clang::SourceLocation&) clang::ASTNodeImporter::VisitRecordDecl(clang::RecordDecl*) clang::declvisitor::Base >::Visit(clang::Decl*) clang::ASTImporter::Import(clang::Decl*) clang::ASTNodeImporter::VisitRecordType(clang::RecordType const*) clang::TypeVisitor >::Visit(clang::Type const*) clang::ASTImporter::Import(clang::QualType) clang::ASTNodeImporter::VisitElaboratedType(clang::ElaboratedType const*) clang::TypeVisitor >::Visit(clang::Type const*) clang::ASTImporter::Import(clang::QualType) clang::ASTNodeImporter::VisitPointerType(clang::PointerType const*) clang::TypeVisitor >::Visit(clang::Type const*) clang::ASTImporter::Import(clang::QualType) clang::QualType clang::ASTNodeImporter::importChecked(llvm::Error&, clang::QualType const&) clang::ASTNodeImporter::VisitCompoundAssignOperator(clang::CompoundAssignOperator*) --- clang/lib/AST/ASTImporter.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 5cdf1de..afd35e0 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -6818,8 +6818,7 @@ ASTNodeImporter::VisitCompoundAssignOperator(CompoundAssignOperator *E) { Importer.getToContext(), ToLHS, ToRHS, E->getOpcode(), ToType, E->getValueKind(), E->getObjectKind(), ToOperatorLoc, E->getFPFeatures(Importer.getFromContext().getLangOpts()), - importChecked(Err, ToComputationLHSType), - importChecked(Err, ToComputationResultType)); + ToComputationLHSType, ToComputationResultType); } Expected -- 2.7.4