clang-tools 8.0.0

UnusedReturnValueCheck.h
Go to the documentation of this file.
1 //===--- UnusedReturnValueCheck.h - clang-tidy-------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_UNUSEDRETURNVALUECHECK_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_UNUSEDRETURNVALUECHECK_H
12
13 #include "../ClangTidy.h"
14 #include <string>
15
16 namespace clang {
17 namespace tidy {
18 namespace bugprone {
19
20 /// Detects function calls where the return value is unused.
21 ///
22 /// For the user-facing documentation see:
23 /// http://clang.llvm.org/extra/clang-tidy/checks/bugprone-unused-return-value.html
24 class UnusedReturnValueCheck : public ClangTidyCheck {
25 public:
26 UnusedReturnValueCheck(StringRef Name, ClangTidyContext *Context);
27 void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
28 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
29 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
30
31 private:
32 std::string CheckedFunctions;
33 };
34
35 } // namespace bugprone
36 } // namespace tidy
37 } // namespace clang
38
39 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_UNUSEDRETURNVALUECHECK_H
clang::tidy::bugprone::UnusedReturnValueCheck::UnusedReturnValueCheck
UnusedReturnValueCheck(StringRef Name, ClangTidyContext *Context)
Definition: UnusedReturnValueCheck.cpp:36
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition: ClangTidy.h:127
clang::tidy::bugprone::UnusedReturnValueCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition: UnusedReturnValueCheck.cpp:87
clang::tidy::bugprone::UnusedReturnValueCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Definition: UnusedReturnValueCheck.cpp:53
Name
static constexpr llvm::StringLiteral Name
Definition: UppercaseLiteralSuffixCheck.cpp:28
clang::tidy::ClangTidyOptions::OptionMap
std::map< std::string, std::string > OptionMap
Definition: ClangTidyOptions.h:98
Result
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
Definition: ClangdServer.cpp:60
clang::tidy::bugprone::UnusedReturnValueCheck::storeOptions
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
Definition: UnusedReturnValueCheck.cpp:49
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ChangeNamespace.cpp:18
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition: ClangTidyDiagnosticConsumer.h:100
clang::tidy::bugprone::UnusedReturnValueCheck
Detects function calls where the return value is unused.
Definition: UnusedReturnValueCheck.h:24