1212#include " clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h"
1313#include " clang/StaticAnalyzer/Frontend/AnalysisConsumer.h"
1414#include " clang/StaticAnalyzer/Checkers/SValExplainer.h"
15+ #if LLVM_VERSION_MAJOR >= 9
16+ #include " clang/StaticAnalyzer/Frontend/CheckerRegistry.h"
17+ #else
1518#include " clang/StaticAnalyzer/Core/CheckerRegistry.h"
19+ #endif
1620#include < iostream>
1721
1822namespace {
@@ -207,14 +211,16 @@ namespace {
207211 }
208212
209213 PDP VisitNode (const ExplodedNode *N,
214+ #if LLVM_VERSION_MAJOR <= 8
210215 const ExplodedNode *PrevN,
216+ #endif
211217 BugReporterContext &BRC,
212218 BugReport &BR) override ;
213219 };
214220
215221 class GCValueBugVisitor
216222#if LLVM_VERSION_MAJOR >= 7
217- : public BugReporterVisitor
223+ : public BugReporterVisitor {
218224#else
219225 : public BugReporterVisitorImpl<GCValueBugVisitor> {
220226#endif
@@ -236,7 +242,9 @@ namespace {
236242 const ExplodedNode *N, PathDiagnosticLocation Pos, BugReporterContext &BRC, BugReport &BR);
237243
238244 PDP VisitNode (const ExplodedNode *N,
245+ #if LLVM_VERSION_MAJOR <= 8
239246 const ExplodedNode *PrevN,
247+ #endif
240248 BugReporterContext &BRC,
241249 BugReport &BR) override ;
242250 };
@@ -317,8 +325,12 @@ namespace Helpers {
317325}
318326
319327PDP GCChecker::GCBugVisitor::VisitNode (
320- const ExplodedNode *N, const ExplodedNode *PrevN,
328+ const ExplodedNode *N,
329+ #if LLVM_VERSION_MAJOR <= 8
330+ const ExplodedNode *,
331+ #endif
321332 BugReporterContext &BRC, BugReport &BR) {
333+ const ExplodedNode *PrevN = N->getFirstPred ();
322334 unsigned NewGCDepth = N->getState ()->get <GCDepth>();
323335 unsigned OldGCDepth = PrevN->getState ()->get <GCDepth>();
324336 if (NewGCDepth != OldGCDepth) {
@@ -412,8 +424,12 @@ PDP GCChecker::GCValueBugVisitor::ExplainNoPropagation(
412424}
413425
414426PDP GCChecker::GCValueBugVisitor::VisitNode (
415- const ExplodedNode *N, const ExplodedNode *PrevN,
427+ const ExplodedNode *N,
428+ #if LLVM_VERSION_MAJOR <= 8
429+ const ExplodedNode *,
430+ #endif
416431 BugReporterContext &BRC, BugReport &BR) {
432+ const ExplodedNode *PrevN = N->getFirstPred ();
417433 const ValueState *NewValueState = N->getState ()->get <GCValueMap>(Sym);
418434 const ValueState *OldValueState = PrevN->getState ()->get <GCValueMap>(Sym);
419435 const Stmt *Stmt = PathDiagnosticLocation::getStmt (N);
@@ -1518,7 +1534,11 @@ extern "C" const char clang_analyzerAPIVersionString[] =
15181534 CLANG_ANALYZER_API_VERSION_STRING;
15191535extern " C"
15201536void clang_registerCheckers (CheckerRegistry ®istry) {
1521- registry.addChecker <GCChecker>(" julia.GCChecker" ,
1522- " Validates julia gc invariants" );
1537+ registry.addChecker <GCChecker>(" julia.GCChecker" ,
1538+ " Validates julia gc invariants"
1539+ #if LLVM_VERSION_MAJOR >= 8
1540+ ," https://docs.julialang.org/en/v1/devdocs/gc-sa/"
1541+ #endif
1542+ );
15231543}
15241544#endif
0 commit comments