<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi,<br><br>Does somebody know what can make the method getSpellingLineNumber from FullSourceLoc to generate a segmentation fault? <font style="font-size: 12pt;" size="3">I'm using clang 3.6.</font><font style="font-size: 12pt;" size="3"></font><br><br><a href="http://clang.llvm.org/doxygen/classclang_1_1FullSourceLoc.html#a52927fcf23cf662c209e5e996bf59917" target="_blank">http://clang.llvm.org/doxygen/classclang_1_1FullSourceLoc.html#a52927fcf23cf662c209e5e996bf59917</a><br><br>Before using this method, I have checked that the FullSourceLoc is valid. This is the code:<br><br> if(loc.isValid()){
<br> <br> if(!(loc.getFileID().isInvalid())){<br> <br> if(Context->getSourceManager().getFileEntryForID(loc.getFileID()) != NULL){<br><br> unsigned int = loc.getSpellingLineNumber();<br> }<br> }<br> }<br><br>I can't find anything special in the code which I'm using to check if my program works:<br><br> void DeleteNode( XMLNode* node ) {<br> node->_parent->DeleteChild( node );<br> }<br><br>And this is the tree:<br><br><font style="font-size: 10pt;" size="2">| | |-CXXMethodDecl 0x26b4090 <line:1576:5, line:1578:5> line:1576:10 DeleteNode 'void (class tinyxml2::XMLNode *)'</font><font style="font-size: 10pt;" size="2"><br></font><font style="font-size: 10pt;" size="2">| | | |-ParmVarDecl 0x26b4010 <col:22, col:31> col:31 used node 'class tinyxml2::XMLNode *'</font><font style="font-size: 10pt;" size="2"><br></font><font style="font-size: 10pt;" size="2">| | | |-CompoundStmt 0x26c9500 <col:38, line:1578:5></font><font style="font-size: 10pt;" size="2"><br></font><font style="font-size: 10pt;" size="2">| | | | `-CXXMemberCallExpr 0x26c94b8 <line:1577:9, col:42> 'void'</font><font style="font-size: 10pt;" size="2"><br></font><font style="font-size: 10pt;" size="2">| | | | |-MemberExpr 0x26c9460 <col:9, col:24> '<bound member function type>' ->DeleteChild 0x2699420</font><font style="font-size: 10pt;" size="2"><br></font><font style="font-size: 10pt;" size="2">| | | | | `-ImplicitCastExpr 0x26c9448 <col:9, col:15> 'class tinyxml2::XMLNode *' <LValueToRValue></font><font style="font-size: 10pt;" size="2"><br></font><font style="font-size: 10pt;" size="2">| | | | | `-MemberExpr 0x26c9418 <col:9, col:15> 'class tinyxml2::XMLNode *' lvalue ->_parent 0x269a310</font><font style="font-size: 10pt;" size="2"><br></font><font style="font-size: 10pt;" size="2">| | | | | `-ImplicitCastExpr 0x26c9400 <col:9> 'class tinyxml2::XMLNode *' <LValueToRValue></font><font style="font-size: 10pt;" size="2"><br></font><font style="font-size: 10pt;" size="2">| | | | | `-DeclRefExpr 0x26c93d8 <col:9> 'class tinyxml2::XMLNode *' lvalue ParmVar 0x26b4010 'node' 'class tinyxml2::XMLNode *'</font><font style="font-size: 10pt;" size="2"><br></font><font style="font-size: 12pt;" size="3"><br></font><font style="font-size: 12pt;" size="3">The object "loc" contains the location of the MemberExpr "_parent". </font><br><font style="font-size: 12pt;" size="3"></font><br>Thanks.<br> </div></body>
</html>