@@ -551,8 +551,8 @@ bool CheckInitialized(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
551551
552552 if (const auto *VD = Ptr.getDeclDesc ()->asVarDecl ();
553553 VD && (VD->isConstexpr () || VD->hasGlobalStorage ())) {
554- const SourceInfo &Loc = S.Current ->getSource (OpPC);
555554 if (VD->getAnyInitializer ()) {
555+ const SourceInfo &Loc = S.Current ->getSource (OpPC);
556556 S.FFDiag (Loc, diag::note_constexpr_var_init_non_constant, 1 ) << VD;
557557 S.Note (VD->getLocation (), diag::note_declared_at);
558558 } else {
@@ -722,7 +722,6 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
722722 if (F->isLambdaStaticInvoker ())
723723 return true ;
724724
725- const SourceLocation &Loc = S.Current ->getLocation (OpPC);
726725 if (S.getLangOpts ().CPlusPlus11 ) {
727726 const FunctionDecl *DiagDecl = F->getDecl ();
728727
@@ -748,7 +747,8 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
748747 // or an inheriting constructor, we should be much more explicit about why
749748 // it's not constexpr.
750749 if (CD && CD->isInheritingConstructor ()) {
751- S.FFDiag (Loc, diag::note_constexpr_invalid_inhctor, 1 )
750+ S.FFDiag (S.Current ->getLocation (OpPC),
751+ diag::note_constexpr_invalid_inhctor, 1 )
752752 << CD->getInheritedConstructor ().getConstructor ()->getParent ();
753753 S.Note (DiagDecl->getLocation (), diag::note_declared_at);
754754 } else {
@@ -766,7 +766,8 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
766766 DiagDecl->hasBody ())
767767 return false ;
768768
769- S.FFDiag (Loc, diag::note_constexpr_invalid_function, 1 )
769+ S.FFDiag (S.Current ->getLocation (OpPC),
770+ diag::note_constexpr_invalid_function, 1 )
770771 << DiagDecl->isConstexpr () << (bool )CD << DiagDecl;
771772
772773 if (DiagDecl->getDefinition ())
@@ -776,7 +777,8 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
776777 S.Note (DiagDecl->getLocation (), diag::note_declared_at);
777778 }
778779 } else {
779- S.FFDiag (Loc, diag::note_invalid_subexpr_in_const_expr);
780+ S.FFDiag (S.Current ->getLocation (OpPC),
781+ diag::note_invalid_subexpr_in_const_expr);
780782 }
781783
782784 return false ;
@@ -980,11 +982,6 @@ bool CheckNonNullArgs(InterpState &S, CodePtr OpPC, const Function *F,
980982 return true ;
981983}
982984
983- // FIXME: This is similar to code we already have in Compiler.cpp.
984- // I think it makes sense to instead add the field and base destruction stuff
985- // to the destructor Function itself. Then destroying a record would really
986- // _just_ be calling its destructor. That would also help with the diagnostic
987- // difference when the destructor or a field/base fails.
988985static bool runRecordDestructor (InterpState &S, CodePtr OpPC,
989986 const Pointer &BasePtr,
990987 const Descriptor *Desc) {
@@ -1094,8 +1091,8 @@ bool Free(InterpState &S, CodePtr OpPC, bool DeleteIsArrayForm,
10941091
10951092 // For a class type with a virtual destructor, the selected operator delete
10961093 // is the one looked up when building the destructor.
1097- QualType AllocType = Ptr.getType ();
10981094 if (!DeleteIsArrayForm && !IsGlobalDelete) {
1095+ QualType AllocType = Ptr.getType ();
10991096 auto getVirtualOperatorDelete = [](QualType T) -> const FunctionDecl * {
11001097 if (const CXXRecordDecl *RD = T->getAsCXXRecordDecl ())
11011098 if (const CXXDestructorDecl *DD = RD->getDestructor ())
0 commit comments