[PATCH] D80631: [clang-tidy] RenamerClangTidyChecks ignore builtin and command line macros
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat May 30 13:14:54 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG44119626dedf: [clang-tidy] RenamerClangTidyChecks ignore builtin and command line macros (authored by njames93).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80631/new/
https://reviews.llvm.org/D80631
Files:
clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp
Index: clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp
@@ -80,7 +80,7 @@
// RUN: {key: readability-identifier-naming.LocalPointerPrefix, value: 'l_'}, \
// RUN: {key: readability-identifier-naming.LocalConstantPointerCase, value: CamelCase}, \
// RUN: {key: readability-identifier-naming.LocalConstantPointerPrefix, value: 'lc_'}, \
-// RUN: ]}' -- -fno-delayed-template-parsing \
+// RUN: ]}' -- -fno-delayed-template-parsing -Dbad_macro \
// RUN: -I%S/Inputs/readability-identifier-naming \
// RUN: -isystem %S/Inputs/readability-identifier-naming/system
Index: clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
+++ clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
@@ -73,6 +73,14 @@
/// MacroDefined calls checkMacro for macros in the main file
void MacroDefined(const Token &MacroNameTok,
const MacroDirective *MD) override {
+ if (MD->getMacroInfo()->isBuiltinMacro())
+ return;
+ if (PP->getSourceManager().isWrittenInBuiltinFile(
+ MacroNameTok.getLocation()))
+ return;
+ if (PP->getSourceManager().isWrittenInCommandLineFile(
+ MacroNameTok.getLocation()))
+ return;
Check->checkMacro(PP->getSourceManager(), MacroNameTok, MD->getMacroInfo());
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80631.267472.patch
Type: text/x-patch
Size: 1680 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200530/d3c0e95a/attachment.bin>
More information about the cfe-commits
mailing list