diff --git a/lib/Differentiator/TBRAnalyzer.cpp b/lib/Differentiator/TBRAnalyzer.cpp index 3b1612e8b..833a8a450 100644 --- a/lib/Differentiator/TBRAnalyzer.cpp +++ b/lib/Differentiator/TBRAnalyzer.cpp @@ -327,11 +327,12 @@ void TBRAnalyzer::Analyze(const FunctionDecl* FD) { curBlockID = entry->getBlockID(); blockData[curBlockID] = std::unique_ptr(new VarsData()); - /// If we are analysing a method, add a VarData for 'this' pointer + /// If we are analysing a non-static method, add a VarData for 'this' pointer /// (it is represented with nullptr). - if (isa(FD)) { + const auto* MD = dyn_cast(FD); + if (MD && !MD->isStatic()) { const Type* recordType = - dyn_cast(FD->getParent())->getTypeForDecl(); + MD->getParent()->getTypeForDecl(); getCurBlockVarsData()[nullptr] = VarData(QualType::getFromOpaquePtr(recordType)); }