Skip to content

Commit

Permalink
[ASTImporter] Fix bug introduced in 2ba4e3a
Browse files Browse the repository at this point in the history
2ba4e3a (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&, 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<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*> >::Visit(clang::Decl*)
clang::ASTImporter::Import(clang::Decl*)
clang::ASTNodeImporter::VisitRecordType(clang::RecordType const*)
clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType> >::Visit(clang::Type const*)
clang::ASTImporter::Import(clang::QualType)
clang::ASTNodeImporter::VisitElaboratedType(clang::ElaboratedType const*)
clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType> >::Visit(clang::Type const*)
clang::ASTImporter::Import(clang::QualType)
clang::ASTNodeImporter::VisitPointerType(clang::PointerType const*)
clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType> >::Visit(clang::Type const*)
clang::ASTImporter::Import(clang::QualType)
clang::QualType clang::ASTNodeImporter::importChecked<clang::QualType>(llvm::Error&, clang::QualType const&)
clang::ASTNodeImporter::VisitCompoundAssignOperator(clang::CompoundAssignOperator*)
  • Loading branch information
Gabor Marton committed Apr 16, 2020
1 parent 5d3a400 commit e033ec2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions clang/lib/AST/ASTImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CXXCastPath>
Expand Down

0 comments on commit e033ec2

Please sign in to comment.