https://github.com/kadircet created https://github.com/llvm/llvm-project/pull/100135
This is an option set by certain tools (clangd and ASTUnit). Sometimes there are crashes in clang unique to this configuration and it's really hard to provide reproducers without invoking the tool. From 5c7564d00dc964611d98b86e4650b172331e7196 Mon Sep 17 00:00:00 2001 From: Kadir Cetinkaya <kadir...@google.com> Date: Tue, 23 Jul 2024 16:46:21 +0200 Subject: [PATCH] [clang][Driver] Add flag for setting SkipFunctionBodies This is an option set by certain tools (clangd and ASTUnit). Sometimes there are crashes in clang unique to this configuration and it's really hard to provide reproducers without invoking the tool. --- clang/include/clang/Driver/Options.td | 3 +++ clang/test/Frontend/skip-function-bodies.cc | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 clang/test/Frontend/skip-function-bodies.cc diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 69269cf7537b0..130b2bd68c8b4 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -7525,6 +7525,9 @@ def code_completion_brief_comments : Flag<["-"], "code-completion-brief-comments def code_completion_with_fixits : Flag<["-"], "code-completion-with-fixits">, HelpText<"Include code completion results which require small fix-its.">, MarshallingInfoFlag<FrontendOpts<"CodeCompleteOpts.IncludeFixIts">>; +def skip_function_bodies : Flag<["-"], "skip-function-bodies">, + HelpText<"Skip function bodies when possible">, + MarshallingInfoFlag<FrontendOpts<"SkipFunctionBodies">>; def disable_free : Flag<["-"], "disable-free">, HelpText<"Disable freeing of memory on exit">, MarshallingInfoFlag<FrontendOpts<"DisableFree">>; diff --git a/clang/test/Frontend/skip-function-bodies.cc b/clang/test/Frontend/skip-function-bodies.cc new file mode 100644 index 0000000000000..dd5ad21424bac --- /dev/null +++ b/clang/test/Frontend/skip-function-bodies.cc @@ -0,0 +1,8 @@ +// Trivial check to ensure skip-function-bodies flag is propagated. +// +// RUN: %clang_cc1 -verify -skip-function-bodies -pedantic-errors %s + +int f() { + // normally this should emit some diags, but we're skipping it! + this is garbage; +} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits