39 #include <unordered_set>
62 using ExecuteCmdFn = std::function<int (std::string,std::vector<std::string>,std::string,std::string&)>;
68 bool useGlobalSuppressions,
90 unsigned int check(
const std::string &path);
104 unsigned int check(
const std::string &path,
const std::string &content);
116 static const char * version();
124 static const char * extraVersion();
130 static void getErrorMessages(
ErrorLogger &errorlogger);
132 void tooManyConfigsError(
const std::string &file,
const int numberOfConfigurations);
133 void purgedConfigurationMessage(
const std::string &file,
const std::string& configuration);
140 bool analyseWholeProgram();
143 void analyseClangTidy(
const FileSettings &fileSettings);
146 unsigned int analyseWholeProgram(
const std::string &buildDir,
const std::list<FileWithDetails> &files,
const std::list<FileSettings>& fileSettings);
149 void removeCtuInfoFiles(
const std::list<FileWithDetails>& files,
const std::list<FileSettings>& fileSettings);
151 static void resetTimerResults();
154 bool isPremiumCodingStandardId(
const std::string&
id)
const;
161 std::string getDumpFileContentsRawTokens(
const std::vector<std::string>& files,
const simplecpp::TokenList& tokens1)
const;
166 bool hasRule(
const std::string &tokenlist)
const;
170 void internalError(
const std::string &filename,
const std::string &msg);
179 unsigned int checkFile(
const std::string& filename,
const std::string &cfgname, std::istream* fileStream =
nullptr);
185 void checkNormalTokens(
const Tokenizer &tokenizer);
190 void executeAddons(
const std::vector<std::string>& files,
const std::string& file0);
191 void executeAddons(
const std::string &dumpFile,
const std::string& file0);
196 void executeAddonsWholeProgram(
const std::list<FileWithDetails> &files);
204 void executeRules(
const std::string &tokenlist,
const TokenList &list);
207 unsigned int checkClang(
const std::string &path);
229 void reportProgress(
const std::string &filename,
const char stage[],
const std::size_t value)
override;
239 unsigned int mExitCode{};
244 bool mTooManyConfigs{};
Check for functions never called.
This is the base class which will use other classes to do static code analysis for C and C++ code to ...
ErrorLogger & mErrorLogger
std::unordered_set< std::string > mErrorList
std::unique_ptr< CheckUnusedFunctions > mUnusedFunctionsCheck
AnalyzerInformation mAnalyzerInformation
std::string getAddonMessage(const std::string &id, const std::string &text) const
std::list< Check::FileInfo * > mFileInfo
File info used for whole program analysis.
std::function< int(std::string, std::vector< std::string >, std::string, std::string &)> ExecuteCmdFn
std::pair< std::string, int > Location
bool mUseGlobalSuppressions
std::string mCurrentConfig
Current preprocessor configuration.
std::map< Location, std::set< std::string > > mLocationMacros
ExecuteCmdFn mExecuteCommand
Callback for executing a shell command (exe, args, output)
This is an interface, which the class responsible of error logging should implement.
virtual void reportErr(const ErrorMessage &msg)=0
Information about found errors and warnings is directed here.
virtual void reportOut(const std::string &outmsg, Color c=Color::Reset)=0
Information about progress is directed here.
virtual void reportProgress(const std::string &filename, const char stage[], const std::size_t value)
Report progress to client.
Wrapper for error messages, provided by reportErr()
This is just a container for general settings so that we don't need to pass individual values to func...
The main purpose is to tokenize the source code.