Move setting of LD_LIBRARY_PATH closer to invocation of cppunittester
[LibreOffice.git] / compilerplugins / clang / store / optvalue.cxx
blob2b703e194fd6513c97725d5c55326eded947f7dd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * Based on LLVM/Clang.
7 * This file is distributed under the University of Illinois Open Source
8 * License. See LICENSE.TXT for details.
12 #include <cassert>
13 #include <string>
14 #include <iostream>
15 #include <fstream>
16 #include "config_clang.h"
17 #include "plugin.hxx"
18 #include "check.hxx"
23 namespace
25 class OptValue : public loplugin::FilteringPlugin<OptValue>
27 public:
28 explicit OptValue(loplugin::InstantiationData const& data)
29 : FilteringPlugin(data)
33 virtual bool preRun() override { return true; }
35 virtual void run() override
37 if (preRun())
38 TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
41 bool VisitCXXMemberCallExpr(const CXXMemberCallExpr*);
44 bool OptValue::VisitCXXMemberCallExpr(const CXXMemberCallExpr* topExpr)
46 if (ignoreLocation(topExpr))
47 return true;
48 const CXXMethodDecl* methodDecl = topExpr->getMethodDecl();
49 if (!methodDecl)
50 return true;
51 if (!methodDecl->getIdentifier() || methodDecl->getName() != "value")
52 return true;
53 auto expr1 = topExpr->getImplicitObjectArgument()->IgnoreImpCasts();
54 if (!isa<MaterializeTemporaryExpr>(expr1))
55 return true;
57 report(DiagnosticsEngine::Warning, "call to OptValue::value()", topExpr->getBeginLoc());
59 return true;
62 loplugin::Plugin::Registration<OptValue> optvalue("optvalue", false);
64 } // namespace
66 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */