/* SPDX-FileCopyrightText: 2018 Sergio Martins SPDX-License-Identifier: LGPL-2.0-or-later */ #include "raw-environment-function.h" #include "StringUtils.h" #include #include #include #include #include #include using namespace clang; void RawEnvironmentFunction::VisitStmt(clang::Stmt *stmt) { auto *callexpr = dyn_cast(stmt); if (!callexpr) { return; } const FunctionDecl *func = callexpr->getDirectCallee(); if (!func) { return; } StringRef funcName = clazy::name(func); if (funcName == "putenv") { emitWarning(stmt, "Prefer using qputenv instead of putenv"); } if (funcName == "getenv") { emitWarning(stmt, "Prefer using qgetenv instead of getenv"); } }