Author: alexfh Date: Fri Dec 30 09:15:14 2016 New Revision: 290756 URL: http://llvm.org/viewvc/llvm-project?rev=290756&view=rev Log: [clang-tidy] google-explicit-constructor: ignore macros
Modified: clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp Modified: clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp?rev=290756&r1=290755&r2=290756&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp Fri Dec 30 09:15:14 2016 @@ -89,6 +89,10 @@ void ExplicitConstructorCheck::check(con if (const auto *Conversion = Result.Nodes.getNodeAs<CXXConversionDecl>("conversion")) { SourceLocation Loc = Conversion->getLocation(); + // Ignore all macros until we learn to ignore specific ones (e.g. used in + // gmock to define matchers). + if (Loc.isMacroID()) + return; diag(Loc, WarningMessage) << Conversion << FixItHint::CreateInsertion(Loc, "explicit "); return; Modified: clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp?rev=290756&r1=290755&r2=290756&view=diff ============================================================================== --- clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp Fri Dec 30 09:15:14 2016 @@ -168,5 +168,11 @@ void f2() { if (b) {} (void)(F<double>*)b; (void)(F<double*>*)b; - } + +#define DEFINE_STRUCT_WITH_OPERATOR_BOOL(name) \ + struct name { \ + operator bool() const; \ + } + +DEFINE_STRUCT_WITH_OPERATOR_BOOL(H); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits