llvm-capstone/clang/test/Preprocessor
Elliot Goodrich d7354fb634 Keep multiple-include optimization for null directives
The multiple-include optimization allows Clang to avoid opening a
files when they contain #pragma once or a proper include guard.

Both GCC and Microsoft Visual Studio allow null directives outside of
the #ifndef/#endif pair without disabling this multiple-include
optimization. GCC documents this behavior here
https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html.

> There must be no directives outside the controlling directive pair,
> but the null directive (a line containing nothing other than a
> single '#' and possibly whitespace) is permitted.

However, Clang disables the multiple-include optimization when
encountering the null directive.

In particular, this slows down preprocessing of most projects that
depend on boost as many boost libraries depend on the boost
preprocessor library, which contains null directives outside the
include guard on every header file.

Differential Revision: https://reviews.llvm.org/D147928
2023-04-27 13:44:11 -04:00
..
Inputs [clang][Lexer] Fix crash/assert clang::HeaderSearch::search_dir_nth 2023-03-16 02:19:11 -07:00
_Pragma-dependency2.c
_Pragma-dependency.c
_Pragma-in-macro-arg.c
_Pragma-in-macro-arg.cpp
_Pragma-location.c
_Pragma-newline.c [Preprocessor] Fix newline before/after _Pragma. 2021-11-05 00:43:40 -05:00
_Pragma-physloc.c
_Pragma.c
aarch64_asm_flag_output.c [AArch64][InlineAsm]Add Clang support for flag output constraints 2023-04-27 09:39:08 -07:00
aarch64-target-features.c [AArch64] Don't #define __ARM_FP when there's no FPU. 2023-03-13 16:43:25 +00:00
aix-vec_extabi.c [AIX][PowerPC] Remove error when specifying mabi=vec-default on AIX 2021-06-23 07:40:38 -04:00
annotate_in_macro_arg.c
arm64_32.c
arm64e.c
arm-acle-6.4.c
arm-acle-6.5.c
arm-pic-predefines.c
arm-target-features.c [AArch64][ARM] add Armv8.9-a/Armv9.4-a identifier support 2022-11-16 10:20:14 +00:00
assembler-with-cpp.c Implement P1949 2021-08-18 07:33:14 -04:00
avr-atmega328p.c [AVR][Clang] Implement __AVR_HAVE_*__ macros 2022-11-23 01:21:09 +01:00
avr-attiny104.c [AVR][Clang] Implement __AVR_HAVE_*__ macros 2022-11-23 01:21:09 +01:00
avr-common.c [compiler-rt][builtins] Fix wrong ABI of AVR __mulqi3 & __mulhi3 2022-05-06 13:46:49 +00:00
bigoutput.c
bpf-predefined-macros.c
builtin_line.c
c2x.c Bump the value of __STDC_VERSION__ in -std=c2x mode 2021-10-17 09:23:43 -04:00
c17.c
c90.c
c99-6_10_3_3_p4.c
c99-6_10_3_4_p5.c
c99-6_10_3_4_p6.c
c99-6_10_3_4_p7.c
c99-6_10_3_4_p9.c
clang_headers.c
comment_save_if.c
comment_save_macro.c [Clang] Fix how ReadMacroParameterList handles comments in macro parameter-list when in -CC mode 2023-03-30 13:37:21 -07:00
comment_save.c [Preprocessor] Implement -fminimize-whitespace. 2021-07-25 23:30:57 -05:00
csky-target-features.c [Clang][CSKY] Add the CSKY target and compiler driver 2022-04-06 11:37:37 +08:00
cuda-approx-transcendentals.cu
cuda-macos-includes.cu
cuda-preprocess.cu [Driver][test] Remove unused/obsoleted REQUIRES: clang-driver 2022-04-12 13:29:46 -07:00
cuda-types.cu [X86][clang] Lift _BitInt() supported max width. 2022-12-06 11:02:27 +08:00
cxx_and.cpp
cxx_bitand.cpp
cxx_bitor.cpp
cxx_compl.cpp
cxx_not_eq.cpp
cxx_not.cpp
cxx_oper_keyword_ms_compat.cpp
cxx_oper_keyword.cpp
cxx_oper_spelling.cpp
cxx_or.cpp
cxx_true.cpp
cxx_xor.cpp
dependencies-and-pp.c
directive-invalid.c
directives_asm.S Use explicit target in clang/test/Preprocessor/directives_asm.S 2023-03-07 18:06:41 +00:00
disabled-cond-diags2.c
disabled-cond-diags.c
dump_import.h
dump_import.m
dump_include.c
dump_include.h
dump_macros.c
dump-macros-spacing.c
dump-macros-undef.c
dump-options.c
dumptokens_phyloc.c
elfiamcu-predefines.c
elifdef.c Warn if using elifdef & elifndef in not C2x & C++2b mode 2022-05-12 09:26:44 -04:00
empty_file_to_include.h
empty_va_arg.cpp Fix a diagnoses-valid in C++20 with variadic macros 2021-10-09 08:20:20 -04:00
expr_comma.c
expr_define_expansion.c
expr_invalid_tok.c
expr_liveness.c
expr_multichar.c
expr_usual_conversions.c
ext-pp-directive.c [Clang] Adjust extension warnings for #warning 2022-07-23 14:10:11 +02:00
extension-warning.c Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
feature_tests.c Add __builtin_FILE_NAME() 2023-03-17 09:52:41 -04:00
feature_tests.cpp Add __builtin_FILE_NAME() 2023-03-17 09:52:41 -04:00
file_name_macro.c
file_test_windows.c Explicitly add -target for Windows builds in file_test_windows.c 2022-05-11 15:05:55 -07:00
file_test.c [test] Modify test to verify D126396 (Clean "./" from __FILE__ expansion) 2022-06-03 17:54:03 -07:00
file_to_include.h
first-line-indent.c [Preprocessor] Implement -fminimize-whitespace. 2021-07-25 23:30:57 -05:00
flt_eval_macro.cpp Revert "Currently the control of the eval-method is mixed with fast-math." 2023-03-10 14:44:06 -05:00
function_macro_file.c
function_macro_file.h
has_attribute_errors.cpp Lex arguments for __has_cpp_attribute and friends as expanded tokens 2021-10-17 07:54:48 -04:00
has_attribute.c Lex arguments for __has_cpp_attribute and friends as expanded tokens 2021-10-17 07:54:48 -04:00
has_attribute.cpp Lex arguments for __has_cpp_attribute and friends as expanded tokens 2021-10-17 07:54:48 -04:00
has_c_attribute.c Correct the __has_c_attribute value for fallthrough 2022-09-13 11:08:58 -04:00
has_c_attribute.cpp
has_include.c
hash_builtin.cpp [clang] Fix __has_builtin 2022-05-19 11:34:42 -04:00
hash_line.c [Preprocessor] Implement -fminimize-whitespace. 2021-07-25 23:30:57 -05:00
hash_space.c
header_is_main_file.c
header_lookup1.c
header-search-crash.c [clang][Lexer] Fix crash/assert clang::HeaderSearch::search_dir_nth 2023-03-16 02:19:11 -07:00
headermap-rel2.c
headermap-rel.c
hexagon-predefines.c [Hexagon] Add clang flags for v71, v71t, v73 2022-11-18 09:39:47 -08:00
hip-host-cpu-macros.cu [Driver][test] Remove unused/obsoleted REQUIRES: clang-driver 2022-04-12 13:29:46 -07:00
if_warning.c Warn if using elifdef & elifndef in not C2x & C++2b mode 2022-05-12 09:26:44 -04:00
ifdef-recover.c Warn if using elifdef & elifndef in not C2x & C++2b mode 2022-05-12 09:26:44 -04:00
ignore-pragmas.c
import_self.c
include-cycle.c
include-directive1.c
include-directive2.c
include-directive3.c
include-header-file-and-dir.c
include-header-missing-in-framework-with-headermap.c
include-header-missing-in-framework.c
include-leading-nonalpha-no-suggest.c
include-likely-typo.c
include-macros.c
include-next.c
include-nonalpha-no-crash.c
indent_macro.c
init-aarch64.c [AArch64][InlineAsm]Add Clang support for flag output constraints 2023-04-27 09:39:08 -07:00
init-arm.c Define _GNU_SOURCE for arm baremetal in C++ mode. 2022-11-03 13:58:47 -07:00
init-csky.c [Clang][CSKY] Add the CSKY target and compiler driver 2022-04-06 11:37:37 +08:00
init-loongarch.c [LoongArch] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros 2023-01-05 20:21:22 -05:00
init-mips.c Add support for floating-point option ffp-eval-method and for 2022-02-23 15:00:18 -08:00
init-ppc64.c [PPC] Undefine __ppc64__ to match GCC 2022-11-22 17:01:39 -08:00
init-ppc.c [clang][PowerPC] Remove remaining Darwin support 2023-03-28 17:12:49 -04:00
init-s390x.c Add support for floating-point option ffp-eval-method and for 2022-02-23 15:00:18 -08:00
init-v7k-compat.c Add support for floating-point option ffp-eval-method and for 2022-02-23 15:00:18 -08:00
init-ve.c [CLANG][PATCH][FPEnv] Add support for option -ffp-eval-method and extend #pragma float_control similarly 2021-08-16 18:34:29 +09:00
init-x86.c [Clang][MinGW][cygwin] Fix __declspec with -fdeclspec enabled 2022-10-03 10:58:45 +03:00
init.c [Hexagon][VE][WebAssembly] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros 2023-01-05 04:45:07 -05:00
invalid-__has_warning1.c
invalid-__has_warning2.c
is_target_arm64.c
is_target_arm.c
is_target_environment_version.c
is_target_os_darwin.c
is_target_unknown_environment.c [clang][pp] only __is_target_environment(unknown) should match unknown target triple environment 2022-11-02 13:49:04 -07:00
is_target_unknown.c [clang] Add __is_target_variant_{os,environment} builtins 2022-08-26 18:20:06 -04:00
is_target_variant.c [clang] Add __is_target_variant_{os,environment} builtins 2022-08-26 18:20:06 -04:00
is_target.c
iwithprefix.c [Driver] Fix architecture triplets and search paths for Linux x32 2021-04-01 09:47:56 +01:00
lang-std-sie.cpp Add explicit tests for the PS4/PS5 C/C++ standards version defaults. 2022-09-20 11:31:38 -07:00
lang-std.cpp [PS4/PS5] Canonicalize tests to use 'target=.*-(ps4|ps5)' 2022-12-01 07:21:07 -08:00
line-directive-output.c [Preprocessor] Implement -fminimize-whitespace. 2021-07-25 23:30:57 -05:00
line-directive-system-headers.c Add extension diagnostic for linemarker directives 2022-05-11 06:42:00 -04:00
line-directive.c Add extension diagnostic for linemarker directives 2022-05-11 06:42:00 -04:00
llvm-rc.rc [llvm-rc] Fix a new test to disambiguate macOS paths like /Users/... from options starting with a slash 2021-04-21 13:34:33 +03:00
llvm-windres.rc [llvm-rc] Add a GNU windres-like frontend to llvm-rc 2021-04-26 22:04:29 +03:00
macho-embedded-predefines.c
macro_arg_directive.c
macro_arg_directive.h
macro_arg_empty.c
macro_arg_keyword.c
macro_arg_slocentry_merge.c
macro_arg_slocentry_merge.h
macro_backslash.c
macro_disable.c
macro_expand_empty.c
macro_expand.c
macro_expandloc.c
macro_fn_comma_swallow2.c Revert "Suppress non-conforming GNU paste extension in all standard-conforming modes" 2021-01-27 10:59:57 -08:00
macro_fn_comma_swallow.c
macro_fn_disable_expand.c
macro_fn_lparen_scan2.c
macro_fn_lparen_scan.c
macro_fn_placemarker.c
macro_fn_preexpand.c
macro_fn_varargs_iso.c
macro_fn_varargs_named.c
macro_fn.c
macro_misc.c Warn if using elifdef & elifndef in not C2x & C++2b mode 2022-05-12 09:26:44 -04:00
macro_not_define.c
macro_paste_bad.c
macro_paste_bcpl_comment.c
macro_paste_c_block_comment.c
macro_paste_commaext.c
macro_paste_empty.c
macro_paste_hard.c
macro_paste_hashhash.c
macro_paste_identifier_error.c
macro_paste_msextensions.c Change the behavior of implicit int diagnostics 2022-05-04 08:35:47 -04:00
macro_paste_none.c
macro_paste_simple.c
macro_paste_spacing2.c
macro_paste_spacing.c
macro_raw_string.cpp Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
macro_redefined.c
macro_redefined.S [Lex] Use line markers in preprocessed assembly predefines file 2023-03-07 16:20:43 +00:00
macro_rescan2.c
macro_rescan_varargs.c
macro_rescan.c
macro_rparen_scan2.c
macro_rparen_scan.c
macro_space.c [Preprocessor] Implement -fminimize-whitespace. 2021-07-25 23:30:57 -05:00
macro_undef.c
macro_vaopt_check.cpp Warn if using elifdef & elifndef in not C2x & C++2b mode 2022-05-12 09:26:44 -04:00
macro_vaopt_expand.cpp Permit __VA_OPT__ in all language modes and allow it to be detected with #ifdef. 2021-01-27 12:34:43 -08:00
macro_vaopt_p1042r1.cpp [Clang] Fix __VA_OPT__ implementation so that it treats the concatenation of a non-placemaker token and placemaker token as a non-placemaker token 2023-02-17 14:57:32 -08:00
macro_variadic.cl Generalize calls to ImplicitlyDefineFunction 2022-04-30 10:03:51 -04:00
macro_with_initializer_list.cpp
macro-multiline.c
macro-reserved-cxx11.cpp
macro-reserved-ms.c
macro-reserved.c [NFC][Clang]Inclusive language: Replace uses of whitelist in clang/test 2021-11-30 15:06:04 -05:00
macro-reserved.cpp [NFC][Clang]Inclusive language: Replace uses of whitelist in clang/test 2021-11-30 15:06:04 -05:00
mi_opt2.c
mi_opt2.h
mi_opt.c
mi_opt.h
microsoft-ext.c
microsoft-header-search-fail.c [clang][lex] Fix failures with Microsoft header search rules 2022-03-23 14:49:17 +01:00
microsoft-header-search.c
microsoft-import.c
minimize-whitespace-messages.c [Preprocessor] Implement -fminimize-whitespace. 2021-07-25 23:30:57 -05:00
minimize-whitespace.c [Preprocessor] -E -P: Ensure newline after 8 skipped lines. 2021-07-28 22:50:54 -05:00
missing-include-range-check.h
missing-system-header.c
missing-system-header.h
mmx.c
multiple-inclusion-opt.cpp Keep multiple-include optimization for null directives 2023-04-27 13:44:11 -04:00
multiple-inclusion-opt.h Keep multiple-include optimization for null directives 2023-04-27 13:44:11 -04:00
non_fragile_feature1.m
non_fragile_feature.m
nonportable-include-with-hmap.c
objc-pp.m
ohos.c [LLVM][OHOS] Clang toolchain and targets 2023-03-20 12:53:24 +03:00
openmp-macro-expansion.c
optimize.c
output_paste_avoid.cpp
overflow.c
pic.c
pp-modules.c
pp-modules.h
pp-record.c
pp-record.h
pr2086.c
pr2086.h
pr13851.c
pr19649-signed-wchar_t.c
pr19649-unsigned-wchar_t.c
pragma_assume_nonnull.c Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
pragma_diagnostic_output.c
pragma_diagnostic_sections.cpp
pragma_diagnostic.c
pragma_microsoft.c [clang-cl] Ignore #pragma managed/unmanaged 2022-12-12 10:01:24 -05:00
pragma_microsoft.cpp [MSVC] Add support for pragma function 2022-05-13 06:39:47 -07:00
pragma_module.c
pragma_poison.c
pragma_sysheader.c Add support for #pragma system_header with -fms-extensions 2021-06-23 13:26:03 +02:00
pragma_unknown.c
pragma-captured.c
pragma-comment-elf.c Tidy up pragma comment lib handling and testing 2022-06-02 07:52:26 -07:00
pragma-missing-string-token.c [clang] fix out of bounds access in an empty string when lexing a _Pragma with missing string token 2022-02-02 11:16:11 -08:00
pragma-pushpop-macro.c
pragma.c
predefined-arch-macros-x86.c
predefined-arch-macros.c [X86] Add AMX_COMPLEX to Graniterapids 2023-04-06 13:19:44 +08:00
predefined-exceptions.m
predefined-macros-hlsl.hlsl [HLSL] Restrict to supported targets 2022-09-02 13:36:23 -05:00
predefined-macros.c [mips][clang] Do not define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros for MIPS-I 2023-01-12 09:08:05 -05:00
predefined-nullability.c
predefined-win-macros.c [AArch64][InlineAsm]Add Clang support for flag output constraints 2023-04-27 09:39:08 -07:00
print_empty_include.c [Preprocessor] Elide empty line(s) at start of file. 2021-08-25 12:48:59 -05:00
print_empty_include.h [Preprocessor] Elide empty line(s) at start of file. 2021-08-25 12:48:59 -05:00
print_line_count.c
print_line_empty_file.c
print_line_include.c [Preprocessor] Implement -fminimize-whitespace. 2021-07-25 23:30:57 -05:00
print_line_include.h
print_line_track.c [Preprocessor] Elide empty line(s) at start of file. 2021-08-25 12:48:59 -05:00
print-assembler.s
print-header-json.c Remove slash in check string to fix the test that is failng on windows 2022-12-07 16:17:29 -08:00
print-pragma-microsoft.c
pushable-diagnostics.c
riscv-cmodel.c
riscv-target-features.c [RISCV] Zvk (vector crypto) specification update to 0.5.1 (Zvbb/Zvbc/Zvkt/Zvkng/Zvksg) 2023-04-20 18:25:19 +01:00
search-path-usage.m [clang][deps] Modules don't contribute to search path usage 2022-03-16 12:17:52 +01:00
skip-empty-lines.c [test] Fix indention. NFC. 2021-08-25 12:48:59 -05:00
skipping_unclean.c
SOURCE_DATE_EPOCH.c [clang] Move getenv call for SOURCE_DATE_EPOCH out of frontend NFC 2022-10-26 12:42:56 -07:00
static_assert-already-defined.c Improve static_assert/_Static_assert diagnostics 2021-03-03 08:48:27 -05:00
static_assert.c Improve static_assert/_Static_assert diagnostics 2021-03-03 08:48:27 -05:00
stdint.c
stringize_misc.c
stringize_skipped.c
stringize_space.c [Preprocessor] Implement -fminimize-whitespace. 2021-07-25 23:30:57 -05:00
suggest-typoed-directive.c [Lex] Fix fixits for typo-corrections of preprocessing directives within skipped blocks 2022-06-10 13:32:19 -07:00
suggest-typoed-directive.S [clang] Avoid suggesting typoed directives in .S files 2022-05-16 15:46:59 -07:00
sycl-macro.cpp Introduce SYCL 2020 mode 2021-05-18 10:34:14 -04:00
sysroot-prefix.c
traditional-cpp.c
ucn-allowed-chars.c Implement P1949 2021-08-18 07:33:14 -04:00
ucn-pp-identifier.c [Clang] Fix a crash when encountering an ill-formed delimited UCN. 2023-01-03 20:57:52 +01:00
undef-error.c
unterminated.c
unwind-tables.c Fix -fno-unwind-tables -fasynchronous-unwind-tables to emit unwind tables 2021-09-23 16:15:40 -07:00
user_defined_system_framework.c Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
utf8-allowed-chars.c Implement P1949 2021-08-18 07:33:14 -04:00
warn-disabled-macro-expansion.c
warn-macro-undef.c
warn-macro-unused.c
warn-macro-unused.h
warning_tests.c
wasm-target-features.c [WebAssembly] Add new target feature in support of 'extended-const' proposal 2022-03-07 16:45:42 -08:00
wchar_t.c
Weverything_pragma.c Make wide multi-character character literals ill-formed 2021-08-20 11:10:53 -04:00
whitespace-ms-extensions.c [Preprocessor] Ensure newline after #pragma introduced by -fms-extensions. 2021-08-01 19:08:13 -05:00
woa-defaults.c
woa-wchar_t.c
x86_amx_target_features.c [clang] Change AMX macros to match names from GCC 2023-02-03 07:00:16 -07:00
x86_asm_flag_output.c
x86_seg_fs_gs.c
x86_target_features.c [X86] Add AMX_COMPLEX to Graniterapids 2023-04-06 13:19:44 +08:00