forked from OSchip/llvm-project
01a6338180
Summary: This patch implements parsing of [[clang::suppress(rule, ...)]] and [[gsl::suppress(rule, ...)]] attributes. C++ Core Guidelines depend heavily on tool support for rule enforcement. They also propose a way to suppress warnings [1] which is by annotating any ancestor in AST with the C++11 attribute [[gsl::suppress(rule1,...)]]. To have a mechanism to suppress non-C++ Core Guidelines specific, an additional spelling of [[clang::suppress]] is defined. For example, to suppress the warning cppcoreguidelines-slicing, one could do ``` [[clang::suppress("cppcoreguidelines-slicing")]] void f() { ... code that does slicing ... } ``` or ``` void g() { Derived b; [[clang::suppress("cppcoreguidelines-slicing")]] Base a{b}; [[clang::suppress("cppcoreguidelines-slicing")]] { doSomething(); Base a2{b}; } } ``` This parsing can then be used by clang-tidy, which includes multiple C++ Core Guidelines rules, to suppress warnings (see https://reviews.llvm.org/D24888). For the exact naming of the rule in the attribute, there are different possibilities, which will be defined in the corresponding clang-tidy patch. Currently, clang-tidy supports suppressing of warnings through "// NOLINT" comments. There are some advantages that the attribute has: - Suppressing specific warnings instead of all warnings - Suppressing warnings in a block (namespace, function, compound statement) - Code formatting may split a statement into multiple lines, thus a "// NOLINT" comment may be on the wrong line I'm looking forward to your comments! [1] https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#inforce-enforcement Reviewers: alexfh, aaron.ballman, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24886 llvm-svn: 298880 |
||
---|---|---|
.. | ||
Inputs | ||
amdgcn.languageOptsOpenCL.cl | ||
ast-dump-arm-attr.c | ||
ast-dump-attr.cpp | ||
ast-dump-color.cpp | ||
ast-dump-comment.cpp | ||
ast-dump-decl.c | ||
ast-dump-decl.cpp | ||
ast-dump-decl.m | ||
ast-dump-decl.mm | ||
ast-dump-invalid.cpp | ||
ast-dump-lookups.cpp | ||
ast-dump-msp430-attr.c | ||
ast-dump-pipe.cl | ||
ast-dump-stmt.c | ||
ast-dump-stmt.cpp | ||
ast-dump-stmt.m | ||
ast-dump-templates.cpp | ||
ast-dump-wchar.cpp | ||
ast-print-char-literal.cpp | ||
ast-print-objectivec.m | ||
ast-print-pragmas-xfail.cpp | ||
ast-print-pragmas.cpp | ||
attr-source-range.cpp | ||
backend-optimization-failure-nodbg.cpp | ||
backend-optimization-failure.cpp | ||
backend-resource-limit-diagnostics.cl | ||
backend-stack-frame-diagnostics-fallback.cpp | ||
backend-stack-frame-diagnostics.cpp | ||
caret-diags-macros.c | ||
caret-diags-scratch-buffer.c | ||
cc1as-asm.s | ||
dev-fd-fs.c | ||
diag-aka-types.cpp | ||
diag-format.c | ||
diag-line-wrapping.cpp | ||
diag-macro-backtrace.c | ||
diag-macro-backtrace2.c | ||
diag-mapping.c | ||
diag-mapping2.c | ||
diag-null-bytes-in-line.cpp | ||
diag-presumed.c | ||
diag-special-chars.c | ||
diag-template-diffing-color.cpp | ||
diag-template-diffing-cxx98.cpp | ||
diag-template-diffing.cpp | ||
diag-trailing-null-bytes.cpp | ||
diag-verify.cpp | ||
diagnostic-crash.cpp | ||
driver-verify.c | ||
emit-html-insert.c | ||
emit-html.c | ||
error-limit-multiple-notes.cpp | ||
error-limit.c | ||
freebsd-arm-size_t.c | ||
include-stack-for-note-flag.cpp | ||
integer-literal-printing.cpp | ||
interpreter.c | ||
languageOptsOpenCL.cl | ||
macro-backtrace.c | ||
message-length.c | ||
nvptx.languageOptsOpenCL.cl | ||
permissions.cpp | ||
predefines.c | ||
r600.languageOptsOpenCL.cl | ||
reduced-diags-macros-backtrace.cpp | ||
reduced-diags-macros.cpp | ||
remap-file.c | ||
serialized-diags-driver.c | ||
serialized-diags-frontend.c | ||
serialized-diags-no-category.c | ||
serialized-diags-no-issue.c | ||
serialized-diags-really-long-text.cpp | ||
serialized-diags-single-issue.c | ||
serialized-diags-stable.c | ||
serialized-diags.c | ||
serialized-diags.h | ||
serialized-diags.m | ||
show-diag-options.c | ||
tabstop.c | ||
target-parser.c | ||
thinlto.c | ||
unnecessary-elipses.cpp | ||
unprintable.c | ||
verify.c | ||
warn-in-system-header.c | ||
warn-in-system-header.h | ||
warn-sysheader.cpp | ||
warning-flags-enabled.c | ||
warning-flags-tree.c | ||
warning-flags.c | ||
win32-macho.c | ||
working-directory.c | ||
wrong-encoding.c | ||
wrong-encoding2.c |