Simple refactoring of prefix related functions.
Rename the two prefix-in-list funcs so that their usages are clearer.
Also find and replace all the code that essentially does either.
This introduces additional loops in some places, but I think the added
readability and simplicity outweighs the performance degradation, which
should be negligible anyway.
Test: m nothing
Test: TreeHugger
Change-Id: I37e2276ca0c815105ed0031f23c0b1264b480e4f
diff --git a/cc/library.go b/cc/library.go
index 0bddab5..bca9a96 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -281,11 +281,9 @@
}
func (f *flagExporter) reexportFlags(flags ...string) {
- for _, flag := range flags {
- if strings.HasPrefix(flag, "-I") || strings.HasPrefix(flag, "-isystem") {
- panic(fmt.Errorf("Exporting invalid flag %q: "+
- "use reexportDirs or reexportSystemDirs to export directories", flag))
- }
+ if android.PrefixInList(flags, "-I") || android.PrefixInList(flags, "-isystem") {
+ panic(fmt.Errorf("Exporting invalid flag %q: "+
+ "use reexportDirs or reexportSystemDirs to export directories", flag))
}
f.flags = append(f.flags, flags...)
}