[all-commits] [llvm/llvm-project] 4be8a2: Use tablegen to diagnose mutually exclusive attrib...
Aaron Ballman via All-commits
all-commits at lists.llvm.org
Fri Apr 2 13:35:10 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4be8a26951da9a6e04de327b38dd158f4c8e3280
https://github.com/llvm/llvm-project/commit/4be8a26951da9a6e04de327b38dd158f4c8e3280
Author: Aaron Ballman <aaron at aaronballman.com>
Date: 2021-04-02 (Fri, 02 Apr 2021)
Changed paths:
M clang/docs/InternalsManual.rst
M clang/include/clang/Basic/Attr.td
M clang/include/clang/Sema/ParsedAttr.h
M clang/include/clang/Sema/Sema.h
M clang/lib/Sema/ParsedAttr.cpp
M clang/lib/Sema/SemaAttr.cpp
M clang/lib/Sema/SemaDecl.cpp
M clang/lib/Sema/SemaDeclAttr.cpp
M clang/lib/Sema/SemaStmtAttr.cpp
M clang/test/Sema/attr-coldhot.c
M clang/test/Sema/attr-disable-tail-calls.c
M clang/test/Sema/internal_linkage.c
M clang/test/SemaCXX/attr-speculative-load-hardening.cpp
M clang/utils/TableGen/ClangAttrEmitter.cpp
Log Message:
-----------
Use tablegen to diagnose mutually exclusive attributes
Currently, when one or more attributes are mutually exclusive, the
developer adding the attribute has to manually emit diagnostics. In
practice, this is highly error prone, especially for declaration
attributes, because such checking is not trivial. Redeclarations
require you to write a "merge" function to diagnose mutually exclusive
attributes and most attributes get this wrong.
This patch introduces a table-generated way to specify that a group of
two or more attributes are mutually exclusive:
def : MutualExclusions<[Attr1, Attr2, Attr3]>;
This works for both statement and declaration attributes (but not type
attributes) and the checking is done either from the common attribute
diagnostic checking code or from within mergeDeclAttribute() when
merging redeclarations.
More information about the All-commits
mailing list