llvm-project/clang/test/Lexer
Chris Bieneman 43de869d77 Implement #pragma clang restrict_expansion
This patch adds `#pragma clang restrict_expansion ` to enable flagging
macros as unsafe for header use. This is to allow macros that may have
ABI implications to be avoided in headers that have ABI stability
promises.

Using macros in headers (particularly public headers) can cause a
variety of issues relating to ABI and modules. This new pragma logs
warnings when using annotated macros outside the main source file.

This warning is added under a new diagnostics group -Wpedantic-macros

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D107095
2021-08-23 09:46:38 -07:00
..
Inputs Implement #pragma clang restrict_expansion 2021-08-23 09:46:38 -07:00
11-27-2007-FloatLiterals.c
SourceLocationsOverflow.c Detect source location overflow due includes 2020-01-24 23:56:47 +00:00
aligned-allocation.cpp [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS 2020-09-16 14:49:03 -04:00
asm-preproc-no-unicode.s
badstring_in_if0.c
bcpl-escaped-newline.c
block_cmt_end.c PR50456: Properly handle multiple escaped newlines in a '*/'. 2021-05-24 16:21:03 -07:00
builtin_redef.c
c2x_digit_separators.c Add support for digit separators in C2x. 2021-03-12 07:21:03 -05:00
c90.c
case-insensitive-include-ms.c Let normalize() for posix style convert backslash to slash unconditionally. 2020-05-05 13:54:55 -04:00
case-insensitive-include-pr31836.sh Fix bugs when an included file name is typo corrected. 2020-05-08 13:33:39 -04:00
case-insensitive-include-win.c Fix bugs when an included file name is typo corrected. 2020-05-08 13:33:39 -04:00
case-insensitive-include.c Fix pr31836 on Windows too, and correctly handle repeated separators. 2020-05-01 14:17:01 -04:00
case-insensitive-system-include.c [clang] Get rid of "%T" expansions 2017-08-15 19:47:06 +00:00
char-escapes.c
char-literal-encoding-error.c
char-literal.cpp Make wide multi-character character literals ill-formed 2021-08-20 11:10:53 -04:00
char8_t.cpp Make -fno-char8_t disable the char8_t keyword, even in C++20. 2020-04-28 23:49:35 -07:00
comment-escape.c
conflict-marker.c
constants.c Convert diagnostics about multi-character literals from extension to warning 2020-10-06 08:47:17 -04:00
coroutines.cpp
counter.c
cross-windows-on-linux-default.cpp Move normalization of `\` in #includes from -fms-compatibility to -fms-extensions 2019-09-26 17:19:22 +00:00
cross-windows-on-linux.cpp Move normalization of `\` in #includes from -fms-compatibility to -fms-extensions 2019-09-26 17:19:22 +00:00
cxx-features.cpp [clang] add C++ feature test macro for P2266 simpler implicit move 2021-06-26 23:05:23 +02:00
cxx0x_keyword_as_cxx98.cpp
cxx0x_raw_string_delim_length.cpp
cxx0x_raw_string_directives.cpp
cxx0x_raw_string_unterminated.cpp
cxx1y_binary_literal.cpp
cxx1y_digit_separators.cpp [Lex] Fix handling numerical literals ending with ' and signed exponent. 2018-02-06 22:39:25 +00:00
cxx1z-trigraphs.cpp [SystemZ][z/OS] enable trigraphs by default on z/OS 2020-08-13 16:02:07 -04:00
cxx2a-spaceship.cpp Add -std=c++20 flag, replace C++2a with C++20 throughout the Clang 2020-02-18 16:16:37 -08:00
cxx2a_keyword_as_cxx17.cpp Add -std=c++20 flag, replace C++2a with C++20 throughout the Clang 2020-02-18 16:16:37 -08:00
deprecate-macro.c Support macro deprecation #pragma clang deprecated 2021-07-29 12:40:53 -05:00
digraph.c [Driver] Add -fno-digraphs 2018-07-17 04:56:22 +00:00
dollar-idents.c
eof-char.c
eof-conflict-marker.c
eof-file.c
eof-include.c Factor out repeated code parsing and concatenating header-names from 2019-03-19 01:51:19 +00:00
eof-number.c
eof-string.c
escape_newline.c
gnu-flags.c
half-literal.cpp [NFC] Explicitly add -std=c++14 option to tests that rely on the C++14 default 2019-02-05 12:05:53 +00:00
has_attribute_objc_boxable.m
has_extension.c
has_extension_cxx.cpp
has_feature_address_sanitizer.cpp hwasan: add -fsanitize=kernel-hwaddress flag 2018-04-13 18:05:21 +00:00
has_feature_boxed_nsvalue_expressions.m
has_feature_c1x.c
has_feature_coverage_sanitizer.cpp [Clang] Enable __has_feature(coverage_sanitizer) 2021-05-27 18:24:21 +02:00
has_feature_cxx0x.cpp
has_feature_cxx_abi_relative_vtable.cpp [clang][feature] Add cxx_abi_relative_vtable feature 2020-10-08 10:30:54 -07:00
has_feature_exceptions.cpp
has_feature_leak_sanitizer.cpp [clang] [Basic] Enable __has_feature(leak_sanitizer) 2019-09-22 20:55:01 +00:00
has_feature_memory_sanitizer.cpp [MSan] add KMSAN support to Clang driver 2018-09-07 09:21:09 +00:00
has_feature_memtag_sanitizer.cpp ARM MTE stack sanitizer. 2019-07-15 20:02:23 +00:00
has_feature_modules.m
has_feature_objc_arc.m [ObjC] Allow declaring __strong pointer fields in structs in Objective-C 2018-02-28 07:15:55 +00:00
has_feature_rtti.cpp
has_feature_speculative_load_hardening.cpp [clang][slh] Add test for SLH feature checking macro 2020-05-15 12:23:31 -07:00
has_feature_thread_sanitizer.cpp
has_feature_type_traits.cpp
has_feature_undefined_behavior_sanitizer.cpp [Lexer] Add udefined_behavior_sanitizer feature 2018-09-22 01:03:16 +00:00
has_feature_xray_instrument.cpp [Lexer] Add xray_instrument feature 2018-09-17 05:25:47 +00:00
header.cpp
hexfloat.cpp Replace remaining user-visible mentions of C++1z with C++17. 2017-08-13 22:26:53 +00:00
keywords_test.c [MSVC] Recognize `static_assert` keyword in C and C++98 2019-02-15 19:59:45 +00:00
keywords_test.cpp [Concepts] Deprecate -fconcepts-ts, enable Concepts under -std=c++2a 2020-01-24 00:48:59 +02:00
long-long.cpp
minimize_source_to_dependency_directives_at_import_extra_tokens.m Add clang source minimizer that reduces source to directives 2019-06-03 22:59:17 +00:00
minimize_source_to_dependency_directives_at_import_missing_semi.m Add clang source minimizer that reduces source to directives 2019-06-03 22:59:17 +00:00
minimize_source_to_dependency_directives_include.c [clang-scan-deps] Minimizer: Correctly skip over double slashes in angle bracket #include 2019-08-26 23:28:05 +00:00
minimize_source_to_dependency_directives_invalid_error.c Revert "Revert "As a follow-up to my initial mail to llvm-dev here's a first pass at the O1 described there."" 2019-11-26 20:28:52 -08:00
minimize_source_to_dependency_directives_invalid_macro_name.c Add clang source minimizer that reduces source to directives 2019-06-03 22:59:17 +00:00
minimize_source_to_dependency_directives_utf8bom.c [clang-scan-deps] Skip UTF-8 BOM in source minimizer 2019-08-27 00:13:52 +00:00
modules-ts.cpp
ms-compatibility.c
ms-extensions.c
ms-extensions.cpp
msdos-cpm-eof.c
multi-char-constants.c Convert diagnostics about multi-character literals from extension to warning 2020-10-06 08:47:17 -04:00
multiple-include.c
newline-eof-c++98-compat.cpp
newline-eof.c
newline-nul.c
null-character-in-literal.c [Lex] Avoid out-of-bounds dereference in LexAngledStringLiteral. 2018-01-12 18:54:35 +00:00
numeric-literal-trash.c
objc_macros.m
opencl-half-literal.cl
pedantic-macro-interplay.c Implement #pragma clang restrict_expansion 2021-08-23 09:46:38 -07:00
pragma-mark.c
pragma-message.c
pragma-message2.c
pragma-operators.cpp Add support for #pragma system_header with -fms-extensions 2021-06-23 13:26:03 +02:00
pragma-region.c
preamble.c
preamble2.c
rdar-8914293.c
rdr-6096838-2.c
rdr-6096838.c
size_t-literal.cpp [C++2b] Support size_t literals 2021-03-31 13:36:23 +00:00
string-literal-encoding.c
string-literal-errors.cpp
string_concat.cpp
token-concat.c
token-concat.cpp
unicode-strings.c
unicode.c Use a more general test here. 2021-08-18 09:32:05 -04:00
unknown-char.c
unsafe-macro.c Implement #pragma clang restrict_expansion 2021-08-23 09:46:38 -07:00
utf-16.c
utf-16.c.txt
utf8-char-literal.cpp
utf8-invalid.c
warn-date-time.c
warn_binary_literals.cpp
wchar-signedness.c [SystemZ][z/OS] Set default wchar_t type for zOS 2020-09-22 08:03:03 -04:00
wchar.c Make wide multi-character character literals ill-formed 2021-08-20 11:10:53 -04:00