MCPcopy Create free account
hub / github.com/andreasfertig/cppinsights / FindVarDeclRef

Function FindVarDeclRef

InsightsHelpers.cpp:1059–1076  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1057//-----------------------------------------------------------------------------
1058
1059static const DeclRefExpr* FindVarDeclRef(const Stmt* stmt)
1060{
1061 if(const auto* dref = dyn_cast_or_null<DeclRefExpr>(stmt)) {
1062 if(const auto* vd = dyn_cast_or_null<VarDecl>(dref->getDecl())) {
1063 return dref;
1064 }
1065 }
1066
1067 if(stmt) {
1068 for(const auto* child : stmt->children()) {
1069 if(const auto* childRef = FindVarDeclRef(child)) {
1070 return childRef;
1071 }
1072 }
1073 }
1074
1075 return nullptr;
1076}
1077//-----------------------------------------------------------------------------
1078
1079/*

Callers 1

Calls 1

childrenMethod · 0.80

Tested by

no test coverage detected