aboutsummaryrefslogtreecommitdiff
path: root/android/namespace.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/namespace.go')
-rw-r--r--android/namespace.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/android/namespace.go b/android/namespace.go
index d0e90b002..a856a84e6 100644
--- a/android/namespace.go
+++ b/android/namespace.go
@@ -24,6 +24,7 @@ import (
"sync"
"github.com/google/blueprint"
+ "github.com/google/blueprint/syncmap"
)
func init() {
@@ -85,7 +86,7 @@ type NameResolver struct {
sortedNamespaces sortedNamespaces
// Map from dir to namespace. Will have duplicates if two dirs are part of the same namespace.
- namespacesByDir sync.Map // if generics were supported, this would be sync.Map[string]*Namespace
+ namespacesByDir syncmap.SyncMap[string, *Namespace]
// func telling whether to export a namespace to Kati
namespaceExportFilter func(*Namespace) bool
@@ -113,7 +114,6 @@ func NewNameResolver(config NameResolverConfig) *NameResolver {
}
r := &NameResolver{
- namespacesByDir: sync.Map{},
namespaceExportFilter: namespaceExportFilter,
}
r.rootNamespace = r.newNamespace(".")
@@ -167,11 +167,7 @@ func (r *NameResolver) addNamespace(namespace *Namespace) (err error) {
// non-recursive check for namespace
func (r *NameResolver) namespaceAt(path string) (namespace *Namespace, found bool) {
- mapVal, found := r.namespacesByDir.Load(path)
- if !found {
- return nil, false
- }
- return mapVal.(*Namespace), true
+ return r.namespacesByDir.Load(path)
}
// recursive search upward for a namespace
@@ -223,6 +219,7 @@ func (r *NameResolver) NewModule(ctx blueprint.NamespaceContext, moduleGroup blu
// inform the module whether its namespace is one that we want to export to Make
amod.base().commonProperties.NamespaceExportedToMake = ns.exportToKati
amod.base().commonProperties.DebugName = module.Name()
+ amod.base().commonProperties.DebugNamespace = ns.Path
}
return ns, nil