diff options
author | Ryan Mitchell <rtmitchell@google.com> | 2021-04-21 17:44:55 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-04-21 17:44:55 +0000 |
commit | 31031a91f1da3e5acdc493e88d98589b5a6dce2f (patch) | |
tree | 364ecd3aba9f0b0566837153aa7a9148cbe908bb /tools/aapt2/link/XmlCompatVersioner.cpp | |
parent | 991791446c1e1a5dea9f4a8e716c4237865dd64e (diff) | |
parent | efcdb95fa7cf2da7d599e0bcda250514ac5ee048 (diff) |
Merge "Aapt2 ValueTransformer" into sc-dev
Diffstat (limited to 'tools/aapt2/link/XmlCompatVersioner.cpp')
-rw-r--r-- | tools/aapt2/link/XmlCompatVersioner.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/aapt2/link/XmlCompatVersioner.cpp b/tools/aapt2/link/XmlCompatVersioner.cpp index 6937ca961f06..957b64cd8dbb 100644 --- a/tools/aapt2/link/XmlCompatVersioner.cpp +++ b/tools/aapt2/link/XmlCompatVersioner.cpp @@ -23,9 +23,10 @@ namespace aapt { static xml::Attribute CopyAttr(const xml::Attribute& src, StringPool* out_string_pool) { + CloningValueTransformer cloner(out_string_pool); xml::Attribute dst{src.namespace_uri, src.name, src.value, src.compiled_attribute}; if (src.compiled_value != nullptr) { - dst.compiled_value.reset(src.compiled_value->Clone(out_string_pool)); + dst.compiled_value = src.compiled_value->Transform(cloner); } return dst; } @@ -34,6 +35,7 @@ static xml::Attribute CopyAttr(const xml::Attribute& src, StringPool* out_string // (came from a rule). static bool CopyAttribute(const xml::Attribute& src_attr, bool generated, xml::Element* dst_el, StringPool* out_string_pool) { + CloningValueTransformer cloner(out_string_pool); xml::Attribute* dst_attr = dst_el->FindAttribute(src_attr.namespace_uri, src_attr.name); if (dst_attr != nullptr) { if (generated) { @@ -41,7 +43,7 @@ static bool CopyAttribute(const xml::Attribute& src_attr, bool generated, xml::E dst_attr->value = src_attr.value; dst_attr->compiled_attribute = src_attr.compiled_attribute; if (src_attr.compiled_value != nullptr) { - dst_attr->compiled_value.reset(src_attr.compiled_value->Clone(out_string_pool)); + dst_attr->compiled_value = src_attr.compiled_value->Transform(cloner); } return true; } @@ -158,7 +160,8 @@ static inline std::unique_ptr<Item> CloneIfNotNull(const std::unique_ptr<Item>& if (src == nullptr) { return {}; } - return std::unique_ptr<Item>(src->Clone(out_string_pool)); + CloningValueTransformer cloner(out_string_pool); + return src->Transform(cloner); } std::vector<DegradeResult> DegradeToManyRule::Degrade(const xml::Element& src_el, |