Black-list for clang LibTooling Cflags.
Add a list of flags which are not understood by clang LibTooling tools
and filter them out of the Cflags the tools are invoked with.
Test: In frameworks/av, make libmedia vendor_available (this invokes
header-abi-dumper on this module), mm -j64.
Bug: 62447349
Change-Id: I46f017212b89f4331145c999103d0ed44da0abaf
diff --git a/cc/cc.go b/cc/cc.go
index 43825ca..867b196 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -97,21 +97,23 @@
}
type Flags struct {
- GlobalFlags []string // Flags that apply to C, C++, and assembly source files
- ArFlags []string // Flags that apply to ar
- AsFlags []string // Flags that apply to assembly source files
- CFlags []string // Flags that apply to C and C++ source files
- ConlyFlags []string // Flags that apply to C source files
- CppFlags []string // Flags that apply to C++ source files
- YaccFlags []string // Flags that apply to Yacc source files
- protoFlags []string // Flags that apply to proto source files
- aidlFlags []string // Flags that apply to aidl source files
- rsFlags []string // Flags that apply to renderscript source files
- LdFlags []string // Flags that apply to linker command lines
- libFlags []string // Flags to add libraries early to the link order
- TidyFlags []string // Flags that apply to clang-tidy
- SAbiFlags []string // Flags that apply to header-abi-dumper
- YasmFlags []string // Flags that apply to yasm assembly source files
+ GlobalFlags []string // Flags that apply to C, C++, and assembly source files
+ ArFlags []string // Flags that apply to ar
+ AsFlags []string // Flags that apply to assembly source files
+ CFlags []string // Flags that apply to C and C++ source files
+ ToolingCFlags []string // Flags that apply to C and C++ source files parsed by clang LibTooling tools
+ ConlyFlags []string // Flags that apply to C source files
+ CppFlags []string // Flags that apply to C++ source files
+ ToolingCppFlags []string // Flags that apply to C++ source files parsed by clang LibTooling tools
+ YaccFlags []string // Flags that apply to Yacc source files
+ protoFlags []string // Flags that apply to proto source files
+ aidlFlags []string // Flags that apply to aidl source files
+ rsFlags []string // Flags that apply to renderscript source files
+ LdFlags []string // Flags that apply to linker command lines
+ libFlags []string // Flags to add libraries early to the link order
+ TidyFlags []string // Flags that apply to clang-tidy
+ SAbiFlags []string // Flags that apply to header-abi-dumper
+ YasmFlags []string // Flags that apply to yasm assembly source files
// Global include flags that apply to C, C++, and assembly source files
// These must be after any module include flags, which will be in GlobalFlags.
@@ -507,9 +509,6 @@
if c.coverage != nil {
flags = c.coverage.flags(ctx, flags)
}
- if c.sabi != nil {
- flags = c.sabi.flags(ctx, flags)
- }
for _, feature := range c.features {
flags = feature.flags(ctx, flags)
}
@@ -527,7 +526,10 @@
}
flags.GlobalFlags = append(flags.GlobalFlags, deps.Flags...)
c.flags = flags
-
+ // We need access to all the flags seen by a source file.
+ if c.sabi != nil {
+ flags = c.sabi.flags(ctx, flags)
+ }
// Optimization to reduce size of build.ninja
// Replace the long list of flags for each file with a module-local variable
ctx.Variable(pctx, "cflags", strings.Join(flags.CFlags, " "))