[PATCH] D81455: [clang][NFC] Generate the {Type,ArrayType,UnaryExprOrType,Expression}Traits enumerations from TokenKinds.def...
Bruno Ricci via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 9 03:48:30 PDT 2020
riccibruno created this revision.
riccibruno added a reviewer: aaron.ballman.
riccibruno added a project: clang.
Herald added subscribers: sstefan1, mgorny.
Herald added a reviewer: jdoerfert.
riccibruno marked an inline comment as done.
riccibruno added inline comments.
riccibruno marked 2 inline comments as done.
================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:6008
def ext_sizeof_alignof_void_type : Extension<
- "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
- "to a void type">, InGroup<PointerArith>;
+ "invalid application of '%0' to a void type">, InGroup<PointerArith>;
def err_opencl_sizeof_alignof_type : Error<
----------------
These two can merged in a further patch.
================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:6014
def err_sizeof_alignof_function_type : Error<
- "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
- "to a function type">;
+ "invalid application of '%0' to a function type">;
def err_openmp_default_simd_align_expr : Error<
----------------
Same.
================
Comment at: clang/include/clang/Basic/TokenKinds.def:65
+#endif
#ifndef ALIAS
#define ALIAS(X,Y,Z)
----------------
It is slightly unfortunate to have to use both `UNARY_EXPR_OR_TYPE_TRAIT` and `CXX11_UNARY_EXPR_OR_TYPE_TRAIT` since users have to define both. I have no better idea unfortunately.
... and remove the various places where these traits are hardcoded.
All the information needed to generate these enumerations is already present in `TokenKinds.def`.
The motivation here is to be able to dump the trait spelling without hard-coding the list in yet another
place.
Note that this change the order of the enumerators in the enumerations (except that in the `TypeTrait`
enumeration all unary type traits are before all binary type traits, and all binary type traits are before all
n-ary type traits).
Apart from the aforementioned ordering which is relied upon, after this patch no code in clang or in the
various clang tools depend on the specific ordering of the enumerators.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D81455
Files:
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Basic/ExpressionTraits.h
clang/include/clang/Basic/TokenKinds.def
clang/include/clang/Basic/TypeTraits.h
clang/lib/AST/JSONNodeDumper.cpp
clang/lib/AST/StmtPrinter.cpp
clang/lib/AST/TextNodeDumper.cpp
clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
clang/lib/ASTMatchers/Dynamic/Marshallers.h
clang/lib/Basic/CMakeLists.txt
clang/lib/Basic/ExpressionTraits.cpp
clang/lib/Basic/TypeTraits.cpp
clang/lib/Sema/SemaExpr.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81455.269467.patch
Type: text/x-patch
Size: 25860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200609/5212a11d/attachment-0001.bin>
More information about the cfe-commits
mailing list