Start using "struct Objects" to store object Paths
So that we can represent other files that get generated along with the
objects, like the gcno coverage information, and per-file clang-tidy
runs.
Test: Soong's build.ninja identical before/after
Change-Id: I5c553a153c436d5403549f62c73fe79c5f101779
diff --git a/cc/builder.go b/cc/builder.go
index 60aad0b..0006ed3 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -182,11 +182,27 @@
stripAddGnuDebuglink bool
}
+type Objects struct {
+ objFiles android.Paths
+}
+
+func (a Objects) Copy() Objects {
+ return Objects{
+ objFiles: append(android.Paths{}, a.objFiles...),
+ }
+}
+
+func (a Objects) Append(b Objects) Objects {
+ return Objects{
+ objFiles: append(a.objFiles, b.objFiles...),
+ }
+}
+
// Generate rules for compiling multiple .c, .cpp, or .S files to individual .o files
func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles android.Paths,
- flags builderFlags, deps android.Paths) (objFiles android.Paths) {
+ flags builderFlags, deps android.Paths) Objects {
- objFiles = make(android.Paths, len(srcFiles))
+ objFiles := make(android.Paths, len(srcFiles))
cflags := flags.globalFlags + " " + flags.cFlags + " " + flags.conlyFlags
cppflags := flags.globalFlags + " " + flags.cFlags + " " + flags.cppFlags
@@ -250,7 +266,9 @@
})
}
- return objFiles
+ return Objects{
+ objFiles: objFiles,
+ }
}
// Generate a rule for compiling multiple .o files to a static library (.a)