@@ -20,10 +20,6 @@ void GlobalVariableUsageMatchCallback::checkUsage(const MatchFinder::MatchResult
2020            Result.Nodes .getNodeAs <clang::VarDecl>(Matchers::GLOBAL_VARIABLE_USAGE)) {
2121        clang::QualType varType = pVarDecl->getType ();
2222        std::string name = pVarDecl->getNameAsString ();
23-         if  (!pVarDecl->isKnownToBeDefined ()) {
24-             LOG_S (DEBUG) << " Variable \" " " \"  was skipped - it has no definition." 
25-             return ;
26-         }
2723        if  (const  auto  *pFunctionDecl = Result.Nodes .getNodeAs <clang::FunctionDecl>(
2824                Matchers::FUNCTION_USED_GLOBAL_VARIABLE)) {
2925            if  (varType.isConstant (pVarDecl->getASTContext ())) {
@@ -62,12 +58,15 @@ void GlobalVariableUsageMatchCallback::handleUsage(const clang::FunctionDecl *fu
6258        return ;
6359    }
6460
65-     auto  &methods  = (*parent->projectTests ).at (sourceFilePath). methods ;
66-     auto  &method = methods[usage.functionName ];
61+     auto  &tests  = (*parent->projectTests ).at (sourceFilePath);
62+     auto  &method = tests. methods [usage.functionName ];
6763    const  clang::QualType realParamType = varDecl->getType ().getCanonicalType ();
6864    const  std::string usedParamTypeString = varDecl->getType ().getAsString ();
6965    types::Type paramType = types::Type (realParamType, usedParamTypeString, sourceManager);
7066    method.globalParams .emplace_back (paramType, usage.variableName , AlignmentFetcher::fetch (varDecl));
67+     if  (varDecl->hasExternalStorage ()) {
68+         tests.externVariables .insert ({paramType, usage.variableName });
69+     }
7170}
7271
7372GlobalVariableUsageMatchCallback::Usage::Usage (std::string variableName, std::string functionName)
0 commit comments