forked from OSchip/llvm-project
[clang-tidy] Some improvements in 'misc-definitions-in-headers' check.
Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D16979 llvm-svn: 260108
This commit is contained in:
parent
1e3c32b38a
commit
3d1d076f79
|
@ -51,6 +51,8 @@ void DefinitionsInHeadersCheck::storeOptions(
|
|||
}
|
||||
|
||||
void DefinitionsInHeadersCheck::registerMatchers(MatchFinder *Finder) {
|
||||
if (!getLangOpts().CPlusPlus)
|
||||
return;
|
||||
if (UseHeaderFileExtension) {
|
||||
Finder->addMatcher(
|
||||
namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())),
|
||||
|
@ -78,6 +80,8 @@ void DefinitionsInHeadersCheck::check(const MatchFinder::MatchResult &Result) {
|
|||
// satisfy the following requirements.
|
||||
const auto *ND = Result.Nodes.getNodeAs<NamedDecl>("name-decl");
|
||||
assert(ND);
|
||||
if (ND->isInvalidDecl())
|
||||
return;
|
||||
|
||||
// Internal linkage variable definitions are ignored for now:
|
||||
// const int a = 1;
|
||||
|
|
Loading…
Reference in New Issue