hqlcppc.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*##############################################################################
  2. Copyright (C) 2011 HPCC Systems.
  3. All rights reserved. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ############################################################################## */
  14. #include "platform.h"
  15. #include "jlib.hpp"
  16. #include "jexcept.hpp"
  17. #include "jmisc.hpp"
  18. #include "hql.hpp"
  19. #include "hqlexpr.hpp"
  20. #include "hqlfunc.hpp"
  21. #include "hqlcpputil.hpp"
  22. #include "hqlstmt.hpp"
  23. #include "hqlwcpp.hpp"
  24. #include "hqlcpp.ipp"
  25. IHqlExpression * convertAddressToValue(IHqlExpression * address, ITypeInfo * columnType)
  26. {
  27. if (isTypePassedByAddress(columnType) && !columnType->isReference())
  28. {
  29. Owned<ITypeInfo> refType = makeReferenceModifier(LINK(columnType));
  30. assertex(address->getOperator() == no_externalcall || refType == address->queryType());
  31. return createValue(no_implicitcast, LINK(refType), LINK(address));
  32. }
  33. Owned<ITypeInfo> pointerType = makePointerType(LINK(columnType));
  34. assertex(address->getOperator() == no_externalcall || pointerType == address->queryType());
  35. IHqlExpression * temp = createValue(no_implicitcast, LINK(pointerType), LINK(address));
  36. return createValue(no_deref, LINK(columnType), temp);
  37. }