clang-tools
24.0.0git
llvm-project
clang-tools-extra
clang-tidy
portability
AvoidPragmaCommentCheck.h
Go to the documentation of this file.
1
//===----------------------------------------------------------------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PORTABILITY_AVOIDPRAGMACOMMENTCHECK_H
10
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PORTABILITY_AVOIDPRAGMACOMMENTCHECK_H
11
12
#include "
../ClangTidyCheck.h
"
13
14
namespace
clang::tidy::portability
{
15
16
/// Finds uses of ``#pragma comment`` and for ``lib`` or ``linker`` comments
17
/// suggests using the build system for improved portability.
18
///
19
/// Only the "lib" pragma comment type is implemented on Linux, the rest are
20
/// Windows-only and should be caught by "-Wunknown-pragmas" on Linux.
21
///
22
/// For the user-facing documentation see:
23
/// https://clang.llvm.org/extra/clang-tidy/checks/portability/avoid-pragma-comment.html
24
class
AvoidPragmaCommentCheck
:
public
ClangTidyCheck
{
25
public
:
26
AvoidPragmaCommentCheck
(StringRef Name,
ClangTidyContext
*Context)
27
:
ClangTidyCheck
(Name, Context) {}
28
void
registerMatchers
(ast_matchers::MatchFinder *Finder)
override
;
29
void
check
(
const
ast_matchers::MatchFinder::MatchResult &Result)
override
;
30
bool
isLanguageVersionSupported
(
const
LangOptions &LangOpts)
const override
{
31
return
LangOpts.CPlusPlus || LangOpts.C99;
32
}
33
};
34
35
}
// namespace clang::tidy::portability
36
37
#endif
// LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PORTABILITY_AVOIDPRAGMACOMMENTCHECK_H
ClangTidyCheck.h
ClangTidyCheck
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition
ClangTidyDiagnosticConsumer.h:70
clang::tidy::portability::AvoidPragmaCommentCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Definition
AvoidPragmaCommentCheck.cpp:23
clang::tidy::portability::AvoidPragmaCommentCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
Definition
AvoidPragmaCommentCheck.cpp:27
clang::tidy::portability::AvoidPragmaCommentCheck::isLanguageVersionSupported
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override
Definition
AvoidPragmaCommentCheck.h:30
clang::tidy::portability::AvoidPragmaCommentCheck::AvoidPragmaCommentCheck
AvoidPragmaCommentCheck(StringRef Name, ClangTidyContext *Context)
Definition
AvoidPragmaCommentCheck.h:26
clang::tidy::portability
Definition
AvoidPragmaCommentCheck.cpp:16
Generated on
for clang-tools by
1.14.0