Esempio n. 1
0
void
operativeMachine::addAttrInNode (void)
{
  /* NOTE : constant nodes and expression nodes (unary, binary, 
     ternary, reference, others) haven't any attributes
  */

  nast_code 
    code = c_nnp->getCode ();    // The code of the nast_node


  // What node class belong to ?

  // declaration nodes
  if (isDecl (code) || isOthrDecl (code))
    addAttrInDecl ();

  // type nodes
  else if (isType (code) || isOthrType (code))
    addAttrInType ();

  // statement nodes
  else if (isStmt (code) || isOthrStmt (code))
    addAttrInStmt ();

  // other nodes
  else if (isOthr (code))
    addAttrInOthr ();

  else
    printWarning ("operativeMachine",
		  "The attribute doesn't belong to any node");

  return;
}
Esempio n. 2
0
std::string Pragma::toStr(const clang::SourceManager& sm) const {
	std::ostringstream ss;
	ss << "(" << utils::location(getStartLocation(), sm) 
		<< ", " << utils::location(getEndLocation(), sm) << "),\n\t";
	
	ss << (isStatement() ? "Stmt -> " : "Decl -> ") << "(";

	if(isStatement() && getStatement()) {
		
		ss << utils::location(getStatement()->getLocStart(), sm) << ", " <<
			  utils::location(getStatement()->getLocEnd(), sm);
	}
	else if(isDecl() && getDecl())
		ss << utils::location(getDecl()->getLocStart(), sm) << ", " <<
			  utils::location(getDecl()->getLocEnd(), sm);
	ss << ")";
	return ss.str();
}
Esempio n. 3
0
clang::Decl const* Pragma::getDecl() const {
	assert(!mTargetNode.isNull() && isDecl());
	return mTargetNode.get<clang::Decl const*> ();
}