Skip to content

Commit

Permalink
[clang-tidy] Some improvements in 'misc-definitions-in-headers' check.
Browse files Browse the repository at this point in the history
Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D16979

llvm-svn: 260108
  • Loading branch information
hokein committed Feb 8, 2016
1 parent 1e3c32b commit 3d1d076
Showing 1 changed file with 4 additions and 0 deletions.
Expand Up @@ -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())),
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3d1d076

Please sign in to comment.