Browse Source

HPCC-7990 Compilation error using DICTIONARY with spanMultipleCpp

Need to generate (and use) an accessor function to get the address of
the generated dictionary hash/compare helper object.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 năm trước cách đây
mục cha
commit
9e18da82a0
1 tập tin đã thay đổi với 17 bổ sung5 xóa
  1. 17 5
      ecl/hqlcpp/hqlhtcpp.cpp

+ 17 - 5
ecl/hqlcpp/hqlhtcpp.cpp

@@ -5297,14 +5297,18 @@ void HqlCppTranslator::buildHashOfExprsClass(BuildCtx & ctx, const char * name,
 }
 
 
-void HqlCppTranslator::buildDictionaryHashClass(BuildCtx &ctx, IHqlExpression *record, IHqlExpression *dictionary, StringBuffer &lookupHelperName)
+void HqlCppTranslator::buildDictionaryHashClass(BuildCtx &ctx, IHqlExpression *record, IHqlExpression *dictionary, StringBuffer &funcName)
 {
     BuildCtx declarectx(*code, declareAtom);
-    appendUniqueId(lookupHelperName.append("lu"), getConsistentUID(record));
     OwnedHqlExpr attr = createAttribute(lookupAtom, LINK(record));
     HqlExprAssociation * match = declarectx.queryMatchExpr(attr);
-    if (!match)
+    if (match)
+        match->queryExpr()->toString(funcName);
+    else
     {
+        StringBuffer lookupHelperName;
+        appendUniqueId(lookupHelperName.append("lu"), getConsistentUID(record));
+
         BuildCtx classctx(declarectx);
         beginNestedClass(classctx, lookupHelperName, "IHThorHashLookupInfo");
         HqlExprArray keyedFields;
@@ -5322,8 +5326,16 @@ void HqlCppTranslator::buildDictionaryHashClass(BuildCtx &ctx, IHqlExpression *r
         buildHashOfExprsClass(classctx, "Hash", keyedList, dictRef, false);
         buildCompareMember(classctx, "Compare", keyedList, dictRef);
         endNestedClass();
-        OwnedHqlExpr temp = createVariable(lookupHelperName, makeVoidType());
-        declarectx.associateExpr(attr, temp);
+
+        if (queryOptions().spanMultipleCpp)
+        {
+            createAccessFunctions(funcName, declarectx, BuildCtx::NormalPrio, "IHThorHashLookupInfo", lookupHelperName);
+            funcName.append("()");
+        }
+        else
+            funcName.append(lookupHelperName);
+        OwnedHqlExpr func = createVariable(funcName, makeVoidType());
+        declarectx.associateExpr(attr, func);
     }
 }