Store missing profile files into a Make variable

Bug: http://b/72642679

Store missing profile files and the modules that refer to them in the
SOONG_MODULES_MISSING_PGO_PROFILE_FILE variable passed to Make.  The
contents of this variable will be written to
$DIST_DIR/pgo_profile_file_missing.txt as part of the 'dist' target.

Test: 'm dist' and verify creation of pgo_profile_file_missing.txt.
Change-Id: I237cd0398be418be2b7db6fa65ece5ef347ecbc1
diff --git a/cc/pgo.go b/cc/pgo.go
index 758c3d6..3ce67be 100644
--- a/cc/pgo.go
+++ b/cc/pgo.go
@@ -38,6 +38,10 @@
 const profileUseInstrumentFormat = "-fprofile-use=%s"
 const profileUseSamplingFormat = "-fprofile-sample-use=%s"
 
+func recordMissingProfileFile(ctx ModuleContext, missing string) {
+	getNamedMapForConfig(ctx.Config(), modulesMissingProfileFile).Store(missing, true)
+}
+
 type PgoProperties struct {
 	Pgo struct {
 		Instrumentation    *bool
@@ -96,6 +100,10 @@
 		}
 	}
 
+	// Record that this module's profile file is absent
+	missing := *props.Pgo.Profile_file + ":" + ctx.ModuleDir() + "/Android.bp:" + ctx.ModuleName()
+	recordMissingProfileFile(ctx, missing)
+
 	return android.OptionalPathForPath(nil)
 }