[PATCH] D16979: [clang-tidy] Some improvements in 'misc-definitions-in-headers' check.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 8 08:09:56 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL260108: [clang-tidy] Some improvements in 'misc-definitions-in-headers' check. (authored by hokein).
Changed prior to commit:
http://reviews.llvm.org/D16979?vs=47178&id=47205#toc
Repository:
rL LLVM
http://reviews.llvm.org/D16979
Files:
clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
Index: clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -51,6 +51,8 @@
}
void DefinitionsInHeadersCheck::registerMatchers(MatchFinder *Finder) {
+ if (!getLangOpts().CPlusPlus)
+ return;
if (UseHeaderFileExtension) {
Finder->addMatcher(
namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())),
@@ -78,6 +80,8 @@
// 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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16979.47205.patch
Type: text/x-patch
Size: 850 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160208/30e5eeaf/attachment.bin>
More information about the cfe-commits
mailing list