Skip to content

Commit 5c7564d

Browse files
committed
[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.
1 parent fde27bd commit 5c7564d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7525,6 +7525,9 @@ def code_completion_brief_comments : Flag<["-"], "code-completion-brief-comments
75257525
def code_completion_with_fixits : Flag<["-"], "code-completion-with-fixits">,
75267526
HelpText<"Include code completion results which require small fix-its.">,
75277527
MarshallingInfoFlag<FrontendOpts<"CodeCompleteOpts.IncludeFixIts">>;
7528+
def skip_function_bodies : Flag<["-"], "skip-function-bodies">,
7529+
HelpText<"Skip function bodies when possible">,
7530+
MarshallingInfoFlag<FrontendOpts<"SkipFunctionBodies">>;
75287531
def disable_free : Flag<["-"], "disable-free">,
75297532
HelpText<"Disable freeing of memory on exit">,
75307533
MarshallingInfoFlag<FrontendOpts<"DisableFree">>;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Trivial check to ensure skip-function-bodies flag is propagated.
2+
//
3+
// RUN: %clang_cc1 -verify -skip-function-bodies -pedantic-errors %s
4+
5+
int f() {
6+
// normally this should emit some diags, but we're skipping it!
7+
this is garbage;
8+
}

0 commit comments

Comments
 (0)