<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert Zchn";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
span.HTMLVorformatiertZchn
        {mso-style-name:"HTML Vorformatiert Zchn";
        mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert";
        font-family:Consolas;
        color:black;}
span.E-MailFormatvorlage21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="DE" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Hi, thank you!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext"> Alexey Bataev <a.bataev@outlook.com>
<br>
<b>Sent:</b> Thursday, July 5, 2018 6:32 PM<br>
<b>To:</b> Cramer, Tim <Cramer@itc.rwth-aachen.de>; cfe-dev@lists.llvm.org<br>
<b>Subject:</b> Re: [cfe-dev] End location of OpenMP Clauses<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p>Hi, 'if' etc. clauses are correct, 'map' etc are not. I'll fix that, thanks for the report.<o:p></o:p></p>
<pre>-------------<o:p></o:p></pre>
<pre>Best regards,<o:p></o:p></pre>
<pre>Alexey Bataev<o:p></o:p></pre>
<div>
<p class="MsoNormal">05.07.2018 10:53, Cramer, Tim via cfe-dev пишет:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre>Hello everybody,<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>I have question regarding the source location of an OpenMP clause. Given the following code:<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>int main() {<o:p></o:p></pre>
<pre>  int n = 42;<o:p></o:p></pre>
<pre>  int m = 23;<o:p></o:p></pre>
<pre>  float f = 42.23;<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>  #pragma omp target parallel map(n) num_threads(2) if(1) shared(n,m) private(f)  default(shared) proc_bind(spread)<o:p></o:p></pre>
<pre>  {<o:p></o:p></pre>
<pre>    f = n / m;<o:p></o:p></pre>
<pre>  }<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>  return 0;<o:p></o:p></pre>
<pre>}<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>I get the following AST (snippet):<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>    |-OMPTargetParallelDirective 0x77aaf0 <line:6:11, col:116><o:p></o:p></pre>
<pre>    | |-OMPMapClause 0x7643a0 <col:31, col:38><o:p></o:p></pre>
<pre>    | | `-DeclRefExpr 0x764378 <col:35> 'int' lvalue Var 0x764168 'n' 'int'<o:p></o:p></pre>
<pre>    | |-OMPNum_threadsClause 0x764420 <col:38, col:51><o:p></o:p></pre>
<pre>    | | `-IntegerLiteral 0x764400 <col:50> 'int' 2<o:p></o:p></pre>
<pre>    | |-OMPIfClause 0x764468 <col:53, col:57><o:p></o:p></pre>
<pre>    | | `-IntegerLiteral 0x764448 <col:56> 'int' 1<o:p></o:p></pre>
<pre>    | |-OMPSharedClause 0x7644f0 <col:59, col:71><o:p></o:p></pre>
<pre>    | | |-DeclRefExpr 0x7644a0 <col:66> 'int' lvalue Var 0x764168 'n' 'int'<o:p></o:p></pre>
<pre>    | | `-DeclRefExpr 0x7644c8 <col:68> 'int' lvalue Var 0x764218 'm' 'int'<o:p></o:p></pre>
<pre>    | |-OMPPrivateClause 0x7645e0 <col:71, col:83><o:p></o:p></pre>
<pre>    | | `-DeclRefExpr 0x764518 <col:79> 'float' lvalue Var 0x7642c8 'f' 'float'<o:p></o:p></pre>
<pre>    | |-OMPDefaultClause 0x764608 <col:83, col:99><o:p></o:p></pre>
<pre>    | |-OMPProc_bindClause 0x764620 <col:99, col:116><o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>As you can see, the end of the clauses 'map', 'num_threads', 'shared', 'private' point just before the start of the next token (clause). In contrast, the end of the clauses 'if', 'default' and 'proc_bind' points just before the right paren. The problem is that "clang::OMPClause::getLocEnd()" returns different locations, depending on the clause kind. I guess this does not look like intended. <o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>My question is: Where should "clang::OMPClause::getLocEnd()" point to? After or before the left paren?<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>A quick look into "lib/Parse/ParseOpenMP.cpp" shows that in one case "Tok.getLocation()" is used and in the other cases "T.getCloseLocation()". What is correct?<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Best regards,<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Tim Cramer<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>