Add clang_verify property for cc.

This property is to support cflags "-Xclang -verify" build pass in Soong. The behaviors of clang_verify:
- append cflags "-Xclang -verify"
- append "&& touch $out" to the clang command line

Bug: 311284462
Test: go test -run TestClangVerify

Change-Id: Ic5825e2d649da4c3c5ed6da916e9804d7e3c03da
This commit is contained in:
kellyhung
2024-05-19 21:16:07 +08:00
parent 46469d6a03
commit d62ea30647
5 changed files with 53 additions and 6 deletions

View File

@@ -120,6 +120,10 @@ type BaseCompilerProperties struct {
// ban targeting bpf in cc rules instead use bpf_rules. (b/323415017)
Bpf_target *bool
// Add "-Xclang -verify" to the cflags and appends "touch $out" to
// the clang command line.
Clang_verify bool
Yacc *YaccProperties
Lex *LexProperties
@@ -390,6 +394,11 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
flags.Yacc = compiler.Properties.Yacc
flags.Lex = compiler.Properties.Lex
flags.ClangVerify = compiler.Properties.Clang_verify
if compiler.Properties.Clang_verify {
flags.Local.CFlags = append(flags.Local.CFlags, "-Xclang", "-verify")
}
// Include dir cflags
localIncludeDirs := android.PathsForModuleSrc(ctx, compiler.Properties.Local_include_dirs)
if len(localIncludeDirs) > 0 {