@@ -53,8 +53,8 @@ class GCChecker
5353 check::Location> {
5454 mutable std::unique_ptr<BugType> BT;
5555 template <typename callback>
56- void report_error (callback f, CheckerContext &C, const char * message) const ;
57- void report_error (CheckerContext &C, const char * message) const {
56+ void report_error (callback f, CheckerContext &C, StringRef message) const ;
57+ void report_error (CheckerContext &C, StringRef message) const {
5858 return report_error ([](PathSensitiveBugReport *) {}, C, message);
5959 }
6060 void
@@ -509,7 +509,7 @@ PDP GCChecker::GCValueBugVisitor::VisitNode(const ExplodedNode *N,
509509
510510template <typename callback>
511511void GCChecker::report_error (callback f, CheckerContext &C,
512- const char * message) const {
512+ StringRef message) const {
513513 // Generate an error node.
514514 ExplodedNode *N = C.generateErrorNode ();
515515 if (!N)
@@ -1230,8 +1230,15 @@ void GCChecker::checkPreCall(const CallEvent &Call, CheckerContext &C) const {
12301230 // We could separate out "not safepoint, except for noreturn functions",
12311231 // but that seems like a lot of effort with little benefit.
12321232 if (!FD || !FD->isNoReturn ()) {
1233- report_error (C, " Calling potential safepoint from function annotated "
1234- " JL_NOTSAFEPOINT" );
1233+ report_error (
1234+ [&](PathSensitiveBugReport *Report) {
1235+ if (FD)
1236+ Report->addNote (
1237+ " Tried to call method defined here" ,
1238+ PathDiagnosticLocation::create (FD, C.getSourceManager ()));
1239+ },
1240+ C, (" Calling potential safepoint as " +
1241+ Call.getKindAsString () + " from function annotated JL_NOTSAFEPOINT" ).str ());
12351242 return ;
12361243 }
12371244 }
0 commit comments