本文整理汇总了C++中SgLocatedNode::get_startOfConstruct方法的典型用法代码示例。如果您正苦于以下问题:C++ SgLocatedNode::get_startOfConstruct方法的具体用法?C++ SgLocatedNode::get_startOfConstruct怎么用?C++ SgLocatedNode::get_startOfConstruct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SgLocatedNode
的用法示例。
在下文中一共展示了SgLocatedNode::get_startOfConstruct方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isSgLocatedNode
// This function is not requied since the base class function is available and is preferred (for conformity).
std::string
CompassAnalyses::FunctionDefinitionPrototype::CheckerOutput::getString() const
{
ROSE_ASSERT(getNodeArray().size() <= 1);
// Default implementation for getString
SgLocatedNode* locatedNode = isSgLocatedNode(getNode());
std::string sourceCodeLocation;
if (locatedNode != NULL)
{
Sg_File_Info* start = locatedNode->get_startOfConstruct();
Sg_File_Info* end = locatedNode->get_endOfConstruct();
sourceCodeLocation = (end ? Compass::formatStandardSourcePosition(start, end)
: Compass::formatStandardSourcePosition(start));
}
else
{
// Else this could be a SgInitializedName or SgTemplateArgument (not yet moved to be a SgLocatedNode)
Sg_File_Info* start = getNode()->get_file_info();
ROSE_ASSERT(start != NULL);
sourceCodeLocation = Compass::formatStandardSourcePosition(start);
}
std::string nodeName = getNode()->class_name();
// The short description used here needs to be put into a separate function (can this be part of what is filled in by the script?)
// return loc + ": " + nodeName + ": variable requiring static constructor initialization";
return m_checkerName + ": " + sourceCodeLocation + ": " + nodeName + ": " + m_shortDescription + ".\n\"" + what + "\" does not have a prototype";
} //CompassAnalyses::FunctionDefinitionPrototype::CheckerOutput::getString()
示例2: preOrderVisit
// Start marking nodes as frontend-specific once we enter an AST that's frontend-specific.
void preOrderVisit(SgNode *node) {
SgLocatedNode *located = isSgLocatedNode(node);
if (located) {
bool in_fes_ast = fes_ast!=NULL ||
is_frontend_specific(located->get_file_info()) ||
is_frontend_specific(located->generateMatchingFileInfo()) ||
is_frontend_specific(located->get_startOfConstruct()) ||
is_frontend_specific(located->get_endOfConstruct());
if (in_fes_ast) {
if (!fes_ast)
fes_ast = node;
fix(located, located->get_file_info());
fix(located, located->generateMatchingFileInfo());
fix(located, located->get_startOfConstruct());
fix(located, located->get_endOfConstruct());
}
}
}
示例3: visit
void visit(SgNode *node) {
SgLocatedNode *located = isSgLocatedNode(node);
if (located) {
fix(located, located->get_file_info());
fix(located, located->generateMatchingFileInfo());
fix(located, located->get_startOfConstruct());
fix(located, located->get_endOfConstruct());
}
}
示例4: isSgLocatedNode
std::string
Compass::OutputViolationBase::getString() const
{
ROSE_ASSERT(getNodeArray().size() <= 1);
// Default implementation for getString
SgLocatedNode* locatedNode = isSgLocatedNode(getNode());
std::string sourceCodeLocation;
if (locatedNode != NULL)
{
Sg_File_Info* start = locatedNode->get_startOfConstruct();
Sg_File_Info* end = locatedNode->get_endOfConstruct();
sourceCodeLocation = (end ? Compass::formatStandardSourcePosition(start, end)
: Compass::formatStandardSourcePosition(start));
}
else
{
// Else this could be a SgInitializedName or SgTemplateArgument (not yet moved to be a SgLocatedNode)
if (getNode()) {
// std::cerr << "Node : " << getNode()->class_name() << std::endl;
Sg_File_Info* start = getNode()->get_file_info();
// tps : 22Jan 2009 - commented the following out because it does not work with binaries
//ROSE_ASSERT(start != NULL);
if (start)
sourceCodeLocation = Compass::formatStandardSourcePosition(start);
}
}
// tps Jan 23 2009: getNode() can be NULL because it could be a binary node
// added a test for this
std::string nodeName = "unknown";
if (getNode())
getNode()->class_name();
// The short description used here needs to be put into a separate function (can this be part of what is filled in by the script?)
// return loc + ": " + nodeName + ": variable requiring static constructor initialization";
// return m_checkerName + ": " + sourceCodeLocation + ": " + nodeName + ": " + m_shortDescription;
return m_checkerName + ": " + sourceCodeLocation + ": " + m_shortDescription;
}
示例5: isSgLocatedNode
static std::string
sourcePositionInformation (SgNode* node)
{
// DQ (8/31/2013): Adding source position information for DOT output.
string ss;
SgLocatedNode* locatedNode = isSgLocatedNode(node);
if (locatedNode != NULL)
{
Sg_File_Info* fileInfo = locatedNode->get_file_info();
if (fileInfo != NULL)
{
bool hasSpecialMode = false;
if (fileInfo->isCompilerGenerated() == true)
{
ss += "compiler generated\\n";
hasSpecialMode = true;
}
else
{
if (fileInfo->isFrontendSpecific() == true)
{
ss += "front-end specific\\n";
hasSpecialMode = true;
}
else
{
if (fileInfo->isTransformation() == true)
{
ss += "is part of transformation\\n";
hasSpecialMode = true;
}
else
{
// ss += "???\\n";
}
}
}
if (hasSpecialMode == true)
{
if (fileInfo->isOutputInCodeGeneration() == true)
{
ss += "IS output in generated code\\n";
}
else
{
ss += "is NOT output in generated code\\n";
}
}
else
{
// DQ (9/1/2013): Name a few cases were we want to output the end of the IR node construct's source position range.
// bool outputEndOfConstruct = (isSgAggregateInitializer(node) != NULL || isSgScopeStatement(node) != NULL);
bool outputEndOfConstruct = true; // (isSgAggregateInitializer(node) != NULL || isSgStatement(node) != NULL);
if (outputEndOfConstruct == true)
{
// Output the end of the range represented by the IR node's source position.
ss += generateFileLineColumnString(locatedNode->get_startOfConstruct());
ss += generateFileLineColumnString(locatedNode->get_endOfConstruct());
}
else
{
// For an SgStatement this is the startOfConstruct, but for an SgExpression this is the operator position (or sometimes equal to the startOfConstruct).
ss += generateFileLineColumnString(fileInfo);
}
}
}
else
{
ss += "no source position available\\n";
}
}
else
{
// DQ (9/1/2013): We could handle the source position of some other IR nodes (e.g. output name of the file for SgFile).
SgFile* file = isSgFile(node);
if (file != NULL)
{
ROSE_ASSERT(file->get_file_info() != NULL);
ss += generateFileLineColumnString(file->get_file_info());
}
}
return ss;
}