refactor: add AidlToken::Append
While parsing qualified_name, parser allocates AidlToken for each
identifier to concat them into a single AidlToken.
With Append() method, we can avoid those allocations.
Bug: n/a
Test: atest aidl_unittests
Change-Id: I41cdf880c79d57c9efd9f511075a96f3da164aea
diff --git a/parser.h b/parser.h
index 0d39342..db39f61 100644
--- a/parser.h
+++ b/parser.h
@@ -43,6 +43,11 @@
const std::string& GetText() const { return text_; }
const std::string& GetComments() const { return comments_; }
+ template <typename T>
+ void Append(T&& text) {
+ text_ += std::forward<T>(text);
+ }
+
private:
std::string text_;
std::string comments_;