Proceess post parse passes once for each type and expression

Type::recursivePass is called separately for different packages, and that
leads to processing passes multiply times for the same type.

Change adds an option to "lock" type or constant expression
after processing post parse passes once.

Fixes: 65126148

Test: mma
Test: manually check using completion flag for each pass

Change-Id: I6b3d75150cc0a4eb65c5972b87c650af4e55b7d5
diff --git a/ConstantExpression.cpp b/ConstantExpression.cpp
index d4df274..b6a6824 100644
--- a/ConstantExpression.cpp
+++ b/ConstantExpression.cpp
@@ -440,6 +440,8 @@
 
 status_t ConstantExpression::recursivePass(const std::function<status_t(ConstantExpression*)>& func,
                                            std::unordered_set<const ConstantExpression*>* visited) {
+    if (mIsPostParseCompleted) return OK;
+
     if (visited->find(this) != visited->end()) return OK;
     visited->insert(this);
 
@@ -455,6 +457,11 @@
     return OK;
 }
 
+void ConstantExpression::setPostParseCompleted() {
+    CHECK(!mIsPostParseCompleted);
+    mIsPostParseCompleted = true;
+}
+
 std::vector<ConstantExpression*> LiteralConstantExpression::getConstantExpressions() const {
     return {};
 }