Skip to content

Commit

Permalink
Do not assign VarData to this in static methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
PetroZarytskyi committed Nov 18, 2023
1 parent 9280afd commit d328558
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/Differentiator/TBRAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,12 @@ void TBRAnalyzer::Analyze(const FunctionDecl* FD) {
curBlockID = entry->getBlockID();
blockData[curBlockID] = std::unique_ptr<VarsData>(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<CXXMethodDecl>(FD)) {
const auto* MD = dyn_cast<CXXMethodDecl>(FD);
if (MD && !MD->isStatic()) {
const Type* recordType =
dyn_cast<CXXRecordDecl>(FD->getParent())->getTypeForDecl();
MD->getParent()->getTypeForDecl();
getCurBlockVarsData()[nullptr] =
VarData(QualType::getFromOpaquePtr(recordType));
}
Expand Down

0 comments on commit d328558

Please sign in to comment.