当前位置: 首页>>代码示例>>C++>>正文


C++ NodeManager::getLangBasic方法代码示例

本文整理汇总了C++中NodeManager::getLangBasic方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeManager::getLangBasic方法的具体用法?C++ NodeManager::getLangBasic怎么用?C++ NodeManager::getLangBasic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NodeManager的用法示例。


在下文中一共展示了NodeManager::getLangBasic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: autoReturnType

	insieme::core::TypePtr autoReturnType(NodeManager& nodeMan, const CompoundStmtPtr& body) {
		auto debug = false;
		if(debug) { std::cout << "{{{{{{ autoReturnType ----\n"; }

		// find all returns
		TypePtr newReturnType = nodeMan.getLangBasic().getUnit();
		auto returns = analysis::getFreeNodes(body, NT_ReturnStmt, toVector(NT_LambdaExpr, NT_JobExpr, NT_ReturnStmt));
		if(debug) { std::cout << "{{{{{{{{{{{{{ Returns: " << returns << "\n"; }

		// if no returns, unit is fine
		if(!returns.empty()) {
			auto typeList = ::transform(returns, [](const NodePtr& ret) { return ret.as<ReturnStmtPtr>()->getReturnExpr()->getType(); });
			if(debug) { std::cout << "{{{{{{{{{{{{{ typeList: " << typeList << "\n"; }

			newReturnType = types::getSmallestCommonSuperType(typeList);
			if(debug) { std::cout << "{{{{{{{{{{{{{ returnType: " << newReturnType << "\n"; }

			assert_true(newReturnType) << "Return type deduction, multiple return types have no common supertype.";
		}

		return newReturnType;
	}
开发者ID:zmanchun,项目名称:insieme,代码行数:22,代码来源:type_utils.cpp

示例2:

	std::map<NodePtr,precedence_container> create_precedence_map(NodeManager& nm)
	{

		auto& lang = nm.getLangBasic();
		auto& refs = nm.getLangExtension<lang::ReferenceExtension>();

		std::map<NodePtr, precedence_container> m;

		m[refs.getGenPostInc()] = {2,0};
		m[refs.getGenPostDec()] = {2,0};
		m[lang.getBoolLNot()] = {3,1};
		m[lang.getSignedIntNot()] = {3,1};
		m[lang.getUnsignedIntNot()] = {3,1};
		m[refs.getGenPreInc()] = {3,1};
		m[refs.getGenPreDec()] = {3,1};
		m[lang.getSignedIntMul()] = {5,0};
		m[lang.getGenMul()] = {5,0};
		m[lang.getUnsignedIntMul()] = {5,0};
		m[lang.getRealMul()] = {5,0};
		m[lang.getCharMul()] = {5,0};
		m[lang.getSignedIntMod()] = {5,0};
		m[lang.getGenMod()] = {5,0};
		m[lang.getUnsignedIntMod()] = {5,0};
		m[lang.getCharMod()] = {5,0};
		m[lang.getSignedIntDiv()] = {5,0};
		m[lang.getGenDiv()] = {5,0};
		m[lang.getUnsignedIntDiv()] = {5,0};
		m[lang.getRealDiv()] = {5,0};
		m[lang.getCharDiv()] = {5,0};
		m[lang.getSignedIntAdd()] = {6,0};
		m[lang.getGenAdd()] = {6,0};
		m[lang.getUnsignedIntAdd()] = {6,0};
		m[lang.getRealAdd()] = {6,0};
		m[lang.getCharAdd()] = {6,0};
		m[lang.getSignedIntSub()] = {6,0};
		m[lang.getGenSub()] = {6,0};
		m[lang.getUnsignedIntSub()] = {6,0};
		m[lang.getRealSub()] = {6,0};
		m[lang.getCharSub()] = {6,0};
		m[lang.getSignedIntLShift()] = {7,0};
		m[lang.getGenLShift()] = {7,0};
		m[lang.getSignedIntRShift()] = {7,0};
		m[lang.getGenRShift()] = {7,0};
		m[lang.getUnsignedIntLShift()] = {7,0};
		m[lang.getUnsignedIntRShift()] = {7,0};
		m[lang.getSignedIntLt()] = {8,0};
		m[lang.getGenLt()] = {8,0};
		m[lang.getRealLt()] = {8,0};
		m[lang.getUnsignedIntLt()] = {8,0};
		m[lang.getCharLt()] = {8,0};
		m[lang.getSignedIntLe()] = {8,0};
		m[lang.getGenLe()] = {8,0};
		m[lang.getRealLe()] = {8,0};
		m[lang.getUnsignedIntLe()] = {8,0};
		m[lang.getCharLe()] = {8,0};
		m[lang.getSignedIntGt()] = {8,0};
		m[lang.getGenGt()] = {8,0};
		m[lang.getRealGt()] = {8,0};
		m[lang.getUnsignedIntGt()] = {8,0};
		m[lang.getCharGt()] = {8,0};
		m[lang.getSignedIntGe()] = {8,0};
		m[lang.getGenGe()] = {8,0};
		m[lang.getRealGe()] = {8,0};
		m[lang.getUnsignedIntGe()] = {8,0};
		m[lang.getCharGe()] = {8,0};
		m[lang.getSignedIntEq()] = {9,0};
		m[lang.getGenEq()] = {9,0};
		m[lang.getRealEq()] = {9,0};
		m[lang.getUnsignedIntEq()] = {9,0};
		m[lang.getCharEq()] = {9,0};
		m[lang.getBoolEq()] = {9,0};
		m[lang.getTypeEq()] = {9,0};
		m[lang.getSignedIntNe()] = {9,0};
		m[lang.getGenNe()] = {9,0};
		m[lang.getUnsignedIntNe()] = {9,0};
		m[lang.getCharNe()] = {9,0};
		m[lang.getBoolNe()] = {9,0};
		m[lang.getRealNe()] = {9,0};
		m[lang.getSignedIntAnd()] = {10,0};
		m[lang.getGenAnd()] = {10,0};
		m[lang.getUnsignedIntAnd()] = {10,0};
		m[lang.getBoolAnd()] = {10,0};
		m[lang.getSignedIntXor()] = {11,0};
		m[lang.getGenXor()] = {11,0};
		m[lang.getUnsignedIntXor()] = {11,0};
		m[lang.getBoolXor()] = {11,0};
		m[lang.getSignedIntOr()] = {12,0};
		m[lang.getGenOr()] = {12,0};
		m[lang.getUnsignedIntOr()] = {12,0};
		m[lang.getBoolOr()] = {12,0};
		m[lang.getBoolLAnd()] = {13,0};
		m[lang.getBoolLOr()] = {14,0};

		return m;
	}
开发者ID:zmanchun,项目名称:insieme,代码行数:95,代码来源:parentheses.cpp

示例3: buildArrayCreate

	ExpressionPtr buildArrayCreate(NodeManager& mgr, size_t size, const ExpressionList& list) {
		auto& basic = mgr.getLangBasic();
		IRBuilder builder(mgr);
		auto sizeType = builder.numericType(Literal::get(mgr, basic.getUIntInf(), toString(size)));
		return buildArrayCreate(sizeType, list);
	}
开发者ID:zmanchun,项目名称:insieme,代码行数:6,代码来源:array.cpp


注:本文中的NodeManager::getLangBasic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。