Index: clang-tidy/misc/DefinitionsInHeadersCheck.cpp =================================================================== --- clang-tidy/misc/DefinitionsInHeadersCheck.cpp +++ clang-tidy/misc/DefinitionsInHeadersCheck.cpp @@ -53,15 +53,17 @@ void DefinitionsInHeadersCheck::registerMatchers(MatchFinder *Finder) { if (!getLangOpts().CPlusPlus) return; + auto DefinitionMatcher = + anyOf(functionDecl(isDefinition(), unless(isDeleted())), + varDecl(isDefinition())); if (UseHeaderFileExtension) { - Finder->addMatcher( - namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())), - usesHeaderFileExtension(HeaderFileExtensions)) - .bind("name-decl"), - this); + Finder->addMatcher(namedDecl(DefinitionMatcher, + usesHeaderFileExtension(HeaderFileExtensions)) + .bind("name-decl"), + this); } else { Finder->addMatcher( - namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())), + namedDecl(DefinitionMatcher, anyOf(usesHeaderFileExtension(HeaderFileExtensions), unless(isExpansionInMainFile()))) .bind("name-decl"), Index: test/clang-tidy/misc-definitions-in-headers-cxx11.hpp =================================================================== --- /dev/null +++ test/clang-tidy/misc-definitions-in-headers-cxx11.hpp @@ -0,0 +1,7 @@ +// RUN: clang-tidy %s -checks="-*,misc-definitions-in-headers" -- -extra-arg="-std=c++11" | FileCheck -allow-empty %s + +// Note: This test verifies that the checker does not emit any warning for the +// function being marked delete. + +int f() = delete; +// CHECK-NOT: [misc-definitions-in-headers]