Blame lib/analyzerinfo.h

Packit 2035a7
/*
Packit 2035a7
* Cppcheck - A tool for static C/C++ code analysis
Packit 2035a7
* Copyright (C) 2007-2017 Cppcheck team.
Packit 2035a7
*
Packit 2035a7
* This program is free software: you can redistribute it and/or modify
Packit 2035a7
* it under the terms of the GNU General Public License as published by
Packit 2035a7
* the Free Software Foundation, either version 3 of the License, or
Packit 2035a7
* (at your option) any later version.
Packit 2035a7
*
Packit 2035a7
* This program is distributed in the hope that it will be useful,
Packit 2035a7
* but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 2035a7
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 2035a7
* GNU General Public License for more details.
Packit 2035a7
*
Packit 2035a7
* You should have received a copy of the GNU General Public License
Packit 2035a7
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 2035a7
*/
Packit 2035a7
Packit 2035a7
//---------------------------------------------------------------------------
Packit 2035a7
#ifndef analyzerinfoH
Packit 2035a7
#define analyzerinfoH
Packit 2035a7
//---------------------------------------------------------------------------
Packit 2035a7
Packit 2035a7
#include "config.h"
Packit 2035a7
#include "errorlogger.h"
Packit 2035a7
#include "importproject.h"
Packit 2035a7
Packit 2035a7
#include <fstream>
Packit 2035a7
#include <list>
Packit 2035a7
#include <string>
Packit 2035a7
Packit 2035a7
/// @addtogroup Core
Packit 2035a7
/// @{
Packit 2035a7
Packit 2035a7
/**
Packit 2035a7
* @brief Analyzer information
Packit 2035a7
*
Packit 2035a7
* Store various analysis information:
Packit 2035a7
* - checksum
Packit 2035a7
* - error messages
Packit 2035a7
* - whole program analysis data
Packit 2035a7
*
Packit 2035a7
* The information can be used for various purposes. It allows:
Packit 2035a7
* - 'make' - only analyze TUs that are changed and generate full report
Packit 2035a7
* - should be possible to add distributed analysis later
Packit 2035a7
* - multi-threaded whole program analysis
Packit 2035a7
*/
Packit 2035a7
class CPPCHECKLIB AnalyzerInformation {
Packit 2035a7
public:
Packit 2035a7
    ~AnalyzerInformation();
Packit 2035a7
Packit 2035a7
    static void writeFilesTxt(const std::string &buildDir, const std::list<std::string> &sourcefiles, const std::list<ImportProject::FileSettings> &fileSettings);
Packit 2035a7
Packit 2035a7
    /** Close current TU.analyzerinfo file */
Packit 2035a7
    void close();
Packit 2035a7
    bool analyzeFile(const std::string &buildDir, const std::string &sourcefile, const std::string &cfg, unsigned long long checksum, std::list<ErrorLogger::ErrorMessage> *errors);
Packit 2035a7
    void reportErr(const ErrorLogger::ErrorMessage &msg, bool verbose);
Packit 2035a7
    void setFileInfo(const std::string &check, const std::string &fileInfo);
Packit 2035a7
    static std::string getAnalyzerInfoFile(const std::string &buildDir, const std::string &sourcefile, const std::string &cfg;;
Packit 2035a7
private:
Packit 2035a7
    std::ofstream fout;
Packit 2035a7
    std::string analyzerInfoFile;
Packit 2035a7
};
Packit 2035a7
Packit 2035a7
/// @}
Packit 2035a7
//---------------------------------------------------------------------------
Packit 2035a7
#endif // analyzerinfoH