Re: r260077 - [OPENMP 4.5] Ccapture/codegen of private non-static data members.

2016-02-09 Thread Renato Golin via cfe-commits
Hi Alexey,

It's still broken on ARM:

http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/10409

cheers,
--renato


On 8 February 2016 at 14:25, Alexey Bataev via cfe-commits
 wrote:
> Ok, thanks a lot! Hope it will fix win-based buildbots completely.
>
> Best regards,
> Alexey Bataev
> =
> Software Engineer
> Intel Compiler Team
>
> 08.02.2016 17:11, NAKAMURA Takumi пишет:
>
> Thanks. It didn't pass with i686-mingw32.
>
>   // LAMBDA: call
>   // LAMBDA: call{{.*}} void [[OUTER_LAMBDA:@.+]](
>
>   call x86_thiscallcc void @_ZN2SSC1ERi(%struct.SS* %ss, i32*
> dereferenceable(4) @_ZZ4mainE5sivar)
>   call x86_thiscallcc void @"_ZZ4mainENK3$_0clEv"(%class.anon* %temp.lvalue)
>
> The latter LAMBDA hit "callcc void @_ZN2SSC1ERi("
>
> Fixed in r260093.
>
> I suggest like;
>   // LAMBDA: call{{.*}} void [[OUTER_LAMBDA:@.+]](%class.anon*
>
> On Mon, Feb 8, 2016 at 10:02 PM Alexey Bataev  wrote:
>>
>> Yes, I know, will be fixed in few minutes
>>
>> Best regards,
>> Alexey Bataev
>> =
>> Software Engineer
>> Intel Compiler Team
>>
>> 08.02.2016 15:43, NAKAMURA Takumi пишет:
>>
>> The test is incompatible to i686-pc-win32. See also
>> http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/5498
>>
>> On Mon, Feb 8, 2016 at 6:33 PM Alexey Bataev via cfe-commits
>>  wrote:
>>>
>>> Author: abataev
>>> Date: Mon Feb  8 03:29:13 2016
>>> New Revision: 260077
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=260077=rev
>>> Log:
>>> [OPENMP 4.5] Ccapture/codegen of private non-static data members.
>>> OpenMP 4.5 introduces privatization of non-static data members of current
>>> class in non-static member functions.
>>> To correctly handle such kind of privatization a new (pseudo)declaration
>>> VarDecl-based node is added. It allows to reuse an existing code for
>>> capturing variables in Lambdas/Block/Captured blocks of code for correct
>>> privatization and codegen.
>>>
>>> Modified:
>>> cfe/trunk/include/clang/AST/DeclOpenMP.h
>>> cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
>>> cfe/trunk/include/clang/Basic/DeclNodes.td
>>> cfe/trunk/include/clang/Sema/Sema.h
>>> cfe/trunk/include/clang/Serialization/ASTBitCodes.h
>>> cfe/trunk/lib/AST/DeclBase.cpp
>>> cfe/trunk/lib/AST/DeclOpenMP.cpp
>>> cfe/trunk/lib/AST/DeclPrinter.cpp
>>> cfe/trunk/lib/AST/StmtPrinter.cpp
>>> cfe/trunk/lib/CodeGen/CGDecl.cpp
>>> cfe/trunk/lib/Sema/SemaExpr.cpp
>>> cfe/trunk/lib/Sema/SemaExprMember.cpp
>>> cfe/trunk/lib/Sema/SemaOpenMP.cpp
>>> cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
>>> cfe/trunk/lib/Serialization/ASTCommon.cpp
>>> cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>>> cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
>>> cfe/trunk/test/OpenMP/parallel_private_codegen.cpp
>>> cfe/trunk/tools/libclang/CIndex.cpp
>>>
>>> Modified: cfe/trunk/include/clang/AST/DeclOpenMP.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclOpenMP.h?rev=260077=260076=260077=diff
>>>
>>> ==
>>> --- cfe/trunk/include/clang/AST/DeclOpenMP.h (original)
>>> +++ cfe/trunk/include/clang/AST/DeclOpenMP.h Mon Feb  8 03:29:13 2016
>>> @@ -87,6 +87,35 @@ public:
>>>static bool classofKind(Kind K) { return K == OMPThreadPrivate; }
>>>  };
>>>
>>> -}  // end namespace clang
>>> +/// Pseudo declaration for capturing of non-static data members in
>>> non-static
>>> +/// member functions.
>>> +///
>>> +/// Clang supports capturing of variables only, but OpenMP 4.5 allows to
>>> +/// privatize non-static members of current class in non-static member
>>> +/// functions. This pseudo-declaration allows properly handle this kind
>>> of
>>> +/// capture by wrapping captured expression into a variable-like
>>> declaration.
>>> +class OMPCapturedFieldDecl final : public VarDecl {
>>> +  friend class ASTDeclReader;
>>> +  void anchor() override;
>>> +
>>> +  OMPCapturedFieldDecl(ASTContext , DeclContext *DC, IdentifierInfo
>>> *Id,
>>> +   QualType Type)
>>> +  : VarDecl(OMPCapturedField, C, DC, SourceLocation(),
>>> SourceLocation(), Id,
>>> +Type, nullptr, SC_None) {
>>> +setImplicit();
>>> +  }
>>> +
>>> +public:
>>> +  static OMPCapturedFieldDecl *Create(ASTContext , DeclContext *DC,
>>> +  IdentifierInfo *Id, QualType T);
>>> +
>>> +  static OMPCapturedFieldDecl *CreateDeserialized(ASTContext ,
>>> unsigned ID);
>>> +
>>> +  // Implement isa/cast/dyncast/etc.
>>> +  static bool classof(const Decl *D) { return classofKind(D->getKind());
>>> }
>>> +  static bool classofKind(Kind K) { return K == OMPCapturedField; }
>>> +};
>>> +
>>> +} // end namespace clang
>>>
>>>  #endif
>>>
>>> Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
>>> URL:
>>> 

Re: r260077 - [OPENMP 4.5] Ccapture/codegen of private non-static data members.

2016-02-09 Thread Alexey Bataev via cfe-commits
Renato,
Will be fixed ASAP

Best regards,
Alexey Bataev
=
Software Engineer
Intel Compiler Team

09.02.2016 14:07, Renato Golin пишет:
> Hi Alexey,
>
> It's still broken on ARM:
>
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/10409
>
> cheers,
> --renato
>
>
> On 8 February 2016 at 14:25, Alexey Bataev via cfe-commits
>  wrote:
>> Ok, thanks a lot! Hope it will fix win-based buildbots completely.
>>
>> Best regards,
>> Alexey Bataev
>> =
>> Software Engineer
>> Intel Compiler Team
>>
>> 08.02.2016 17:11, NAKAMURA Takumi пишет:
>>
>> Thanks. It didn't pass with i686-mingw32.
>>
>>// LAMBDA: call
>>// LAMBDA: call{{.*}} void [[OUTER_LAMBDA:@.+]](
>>
>>call x86_thiscallcc void @_ZN2SSC1ERi(%struct.SS* %ss, i32*
>> dereferenceable(4) @_ZZ4mainE5sivar)
>>call x86_thiscallcc void @"_ZZ4mainENK3$_0clEv"(%class.anon* %temp.lvalue)
>>
>> The latter LAMBDA hit "callcc void @_ZN2SSC1ERi("
>>
>> Fixed in r260093.
>>
>> I suggest like;
>>// LAMBDA: call{{.*}} void [[OUTER_LAMBDA:@.+]](%class.anon*
>>
>> On Mon, Feb 8, 2016 at 10:02 PM Alexey Bataev  wrote:
>>> Yes, I know, will be fixed in few minutes
>>>
>>> Best regards,
>>> Alexey Bataev
>>> =
>>> Software Engineer
>>> Intel Compiler Team
>>>
>>> 08.02.2016 15:43, NAKAMURA Takumi пишет:
>>>
>>> The test is incompatible to i686-pc-win32. See also
>>> http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/5498
>>>
>>> On Mon, Feb 8, 2016 at 6:33 PM Alexey Bataev via cfe-commits
>>>  wrote:
 Author: abataev
 Date: Mon Feb  8 03:29:13 2016
 New Revision: 260077

 URL: http://llvm.org/viewvc/llvm-project?rev=260077=rev
 Log:
 [OPENMP 4.5] Ccapture/codegen of private non-static data members.
 OpenMP 4.5 introduces privatization of non-static data members of current
 class in non-static member functions.
 To correctly handle such kind of privatization a new (pseudo)declaration
 VarDecl-based node is added. It allows to reuse an existing code for
 capturing variables in Lambdas/Block/Captured blocks of code for correct
 privatization and codegen.

 Modified:
  cfe/trunk/include/clang/AST/DeclOpenMP.h
  cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
  cfe/trunk/include/clang/Basic/DeclNodes.td
  cfe/trunk/include/clang/Sema/Sema.h
  cfe/trunk/include/clang/Serialization/ASTBitCodes.h
  cfe/trunk/lib/AST/DeclBase.cpp
  cfe/trunk/lib/AST/DeclOpenMP.cpp
  cfe/trunk/lib/AST/DeclPrinter.cpp
  cfe/trunk/lib/AST/StmtPrinter.cpp
  cfe/trunk/lib/CodeGen/CGDecl.cpp
  cfe/trunk/lib/Sema/SemaExpr.cpp
  cfe/trunk/lib/Sema/SemaExprMember.cpp
  cfe/trunk/lib/Sema/SemaOpenMP.cpp
  cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
  cfe/trunk/lib/Serialization/ASTCommon.cpp
  cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
  cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
  cfe/trunk/test/OpenMP/parallel_private_codegen.cpp
  cfe/trunk/tools/libclang/CIndex.cpp

 Modified: cfe/trunk/include/clang/AST/DeclOpenMP.h
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclOpenMP.h?rev=260077=260076=260077=diff

 ==
 --- cfe/trunk/include/clang/AST/DeclOpenMP.h (original)
 +++ cfe/trunk/include/clang/AST/DeclOpenMP.h Mon Feb  8 03:29:13 2016
 @@ -87,6 +87,35 @@ public:
 static bool classofKind(Kind K) { return K == OMPThreadPrivate; }
   };

 -}  // end namespace clang
 +/// Pseudo declaration for capturing of non-static data members in
 non-static
 +/// member functions.
 +///
 +/// Clang supports capturing of variables only, but OpenMP 4.5 allows to
 +/// privatize non-static members of current class in non-static member
 +/// functions. This pseudo-declaration allows properly handle this kind
 of
 +/// capture by wrapping captured expression into a variable-like
 declaration.
 +class OMPCapturedFieldDecl final : public VarDecl {
 +  friend class ASTDeclReader;
 +  void anchor() override;
 +
 +  OMPCapturedFieldDecl(ASTContext , DeclContext *DC, IdentifierInfo
 *Id,
 +   QualType Type)
 +  : VarDecl(OMPCapturedField, C, DC, SourceLocation(),
 SourceLocation(), Id,
 +Type, nullptr, SC_None) {
 +setImplicit();
 +  }
 +
 +public:
 +  static OMPCapturedFieldDecl *Create(ASTContext , DeclContext *DC,
 +  IdentifierInfo *Id, QualType T);
 +
 +  static OMPCapturedFieldDecl *CreateDeserialized(ASTContext ,
 unsigned ID);
 +
 +  // Implement isa/cast/dyncast/etc.
 +  static bool 

Re: r260077 - [OPENMP 4.5] Ccapture/codegen of private non-static data members.

2016-02-08 Thread NAKAMURA Takumi via cfe-commits
The test is incompatible to i686-pc-win32. See also
http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/5498

On Mon, Feb 8, 2016 at 6:33 PM Alexey Bataev via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: abataev
> Date: Mon Feb  8 03:29:13 2016
> New Revision: 260077
>
> URL: http://llvm.org/viewvc/llvm-project?rev=260077=rev
> Log:
> [OPENMP 4.5] Ccapture/codegen of private non-static data members.
> OpenMP 4.5 introduces privatization of non-static data members of current
> class in non-static member functions.
> To correctly handle such kind of privatization a new (pseudo)declaration
> VarDecl-based node is added. It allows to reuse an existing code for
> capturing variables in Lambdas/Block/Captured blocks of code for correct
> privatization and codegen.
>
> Modified:
> cfe/trunk/include/clang/AST/DeclOpenMP.h
> cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
> cfe/trunk/include/clang/Basic/DeclNodes.td
> cfe/trunk/include/clang/Sema/Sema.h
> cfe/trunk/include/clang/Serialization/ASTBitCodes.h
> cfe/trunk/lib/AST/DeclBase.cpp
> cfe/trunk/lib/AST/DeclOpenMP.cpp
> cfe/trunk/lib/AST/DeclPrinter.cpp
> cfe/trunk/lib/AST/StmtPrinter.cpp
> cfe/trunk/lib/CodeGen/CGDecl.cpp
> cfe/trunk/lib/Sema/SemaExpr.cpp
> cfe/trunk/lib/Sema/SemaExprMember.cpp
> cfe/trunk/lib/Sema/SemaOpenMP.cpp
> cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
> cfe/trunk/lib/Serialization/ASTCommon.cpp
> cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
> cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
> cfe/trunk/test/OpenMP/parallel_private_codegen.cpp
> cfe/trunk/tools/libclang/CIndex.cpp
>
> Modified: cfe/trunk/include/clang/AST/DeclOpenMP.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclOpenMP.h?rev=260077=260076=260077=diff
>
> ==
> --- cfe/trunk/include/clang/AST/DeclOpenMP.h (original)
> +++ cfe/trunk/include/clang/AST/DeclOpenMP.h Mon Feb  8 03:29:13 2016
> @@ -87,6 +87,35 @@ public:
>static bool classofKind(Kind K) { return K == OMPThreadPrivate; }
>  };
>
> -}  // end namespace clang
> +/// Pseudo declaration for capturing of non-static data members in
> non-static
> +/// member functions.
> +///
> +/// Clang supports capturing of variables only, but OpenMP 4.5 allows to
> +/// privatize non-static members of current class in non-static member
> +/// functions. This pseudo-declaration allows properly handle this kind of
> +/// capture by wrapping captured expression into a variable-like
> declaration.
> +class OMPCapturedFieldDecl final : public VarDecl {
> +  friend class ASTDeclReader;
> +  void anchor() override;
> +
> +  OMPCapturedFieldDecl(ASTContext , DeclContext *DC, IdentifierInfo *Id,
> +   QualType Type)
> +  : VarDecl(OMPCapturedField, C, DC, SourceLocation(),
> SourceLocation(), Id,
> +Type, nullptr, SC_None) {
> +setImplicit();
> +  }
> +
> +public:
> +  static OMPCapturedFieldDecl *Create(ASTContext , DeclContext *DC,
> +  IdentifierInfo *Id, QualType T);
> +
> +  static OMPCapturedFieldDecl *CreateDeserialized(ASTContext , unsigned
> ID);
> +
> +  // Implement isa/cast/dyncast/etc.
> +  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
> +  static bool classofKind(Kind K) { return K == OMPCapturedField; }
> +};
> +
> +} // end namespace clang
>
>  #endif
>
> Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=260077=260076=260077=diff
>
> ==
> --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
> +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Mon Feb  8 03:29:13
> 2016
> @@ -1434,6 +1434,8 @@ DEF_TRAVERSE_DECL(OMPThreadPrivateDecl,
>}
>  })
>
> +DEF_TRAVERSE_DECL(OMPCapturedFieldDecl, { TRY_TO(TraverseVarHelper(D)); })
> +
>  // A helper method for TemplateDecl's children.
>  template 
>  bool RecursiveASTVisitor::TraverseTemplateParameterListHelper(
>
> Modified: cfe/trunk/include/clang/Basic/DeclNodes.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DeclNodes.td?rev=260077=260076=260077=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/DeclNodes.td (original)
> +++ cfe/trunk/include/clang/Basic/DeclNodes.td Mon Feb  8 03:29:13 2016
> @@ -51,6 +51,7 @@ def Named : Decl<1>;
>  : DDecl;
>  def ImplicitParam : DDecl;
>  def ParmVar : DDecl;
> +def OMPCapturedField : DDecl;
>def NonTypeTemplateParm : DDecl;
>def Template : DDecl;
>  def RedeclarableTemplate : DDecl;
>
> Modified: cfe/trunk/include/clang/Sema/Sema.h
> URL:
> 

Re: r260077 - [OPENMP 4.5] Ccapture/codegen of private non-static data members.

2016-02-08 Thread NAKAMURA Takumi via cfe-commits
Thanks. It didn't pass with i686-mingw32.

  // LAMBDA: call
  // LAMBDA: call{{.*}} void [[OUTER_LAMBDA:@.+]](

  call x86_thiscallcc void @_ZN2SSC1ERi(%struct.SS* %ss, i32*
dereferenceable(4) @_ZZ4mainE5sivar)
  call x86_thiscallcc void @"_ZZ4mainENK3$_0clEv"(%class.anon* %temp.lvalue)

The latter LAMBDA hit "callcc void @_ZN2SSC1ERi("

Fixed in r260093.

I suggest like;
  // LAMBDA: call{{.*}} void [[OUTER_LAMBDA:@.+]](%class.anon*

On Mon, Feb 8, 2016 at 10:02 PM Alexey Bataev  wrote:

> Yes, I know, will be fixed in few minutes
>
> Best regards,
> Alexey Bataev
> =
> Software Engineer
> Intel Compiler Team
>
> 08.02.2016 15:43, NAKAMURA Takumi пишет:
>
> The test is incompatible to i686-pc-win32. See also
> http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/5498
>
> On Mon, Feb 8, 2016 at 6:33 PM Alexey Bataev via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: abataev
>> Date: Mon Feb  8 03:29:13 2016
>> New Revision: 260077
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=260077=rev
>> Log:
>> [OPENMP 4.5] Ccapture/codegen of private non-static data members.
>> OpenMP 4.5 introduces privatization of non-static data members of current
>> class in non-static member functions.
>> To correctly handle such kind of privatization a new (pseudo)declaration
>> VarDecl-based node is added. It allows to reuse an existing code for
>> capturing variables in Lambdas/Block/Captured blocks of code for correct
>> privatization and codegen.
>>
>> Modified:
>> cfe/trunk/include/clang/AST/DeclOpenMP.h
>> cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
>> cfe/trunk/include/clang/Basic/DeclNodes.td
>> cfe/trunk/include/clang/Sema/Sema.h
>> cfe/trunk/include/clang/Serialization/ASTBitCodes.h
>> cfe/trunk/lib/AST/DeclBase.cpp
>> cfe/trunk/lib/AST/DeclOpenMP.cpp
>> cfe/trunk/lib/AST/DeclPrinter.cpp
>> cfe/trunk/lib/AST/StmtPrinter.cpp
>> cfe/trunk/lib/CodeGen/CGDecl.cpp
>> cfe/trunk/lib/Sema/SemaExpr.cpp
>> cfe/trunk/lib/Sema/SemaExprMember.cpp
>> cfe/trunk/lib/Sema/SemaOpenMP.cpp
>> cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
>> cfe/trunk/lib/Serialization/ASTCommon.cpp
>> cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>> cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
>> cfe/trunk/test/OpenMP/parallel_private_codegen.cpp
>> cfe/trunk/tools/libclang/CIndex.cpp
>>
>> Modified: cfe/trunk/include/clang/AST/DeclOpenMP.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclOpenMP.h?rev=260077=260076=260077=diff
>>
>> ==
>> --- cfe/trunk/include/clang/AST/DeclOpenMP.h (original)
>> +++ cfe/trunk/include/clang/AST/DeclOpenMP.h Mon Feb  8 03:29:13 2016
>> @@ -87,6 +87,35 @@ public:
>>static bool classofKind(Kind K) { return K == OMPThreadPrivate; }
>>  };
>>
>> -}  // end namespace clang
>> +/// Pseudo declaration for capturing of non-static data members in
>> non-static
>> +/// member functions.
>> +///
>> +/// Clang supports capturing of variables only, but OpenMP 4.5 allows to
>> +/// privatize non-static members of current class in non-static member
>> +/// functions. This pseudo-declaration allows properly handle this kind
>> of
>> +/// capture by wrapping captured expression into a variable-like
>> declaration.
>> +class OMPCapturedFieldDecl final : public VarDecl {
>> +  friend class ASTDeclReader;
>> +  void anchor() override;
>> +
>> +  OMPCapturedFieldDecl(ASTContext , DeclContext *DC, IdentifierInfo
>> *Id,
>> +   QualType Type)
>> +  : VarDecl(OMPCapturedField, C, DC, SourceLocation(),
>> SourceLocation(), Id,
>> +Type, nullptr, SC_None) {
>> +setImplicit();
>> +  }
>> +
>> +public:
>> +  static OMPCapturedFieldDecl *Create(ASTContext , DeclContext *DC,
>> +  IdentifierInfo *Id, QualType T);
>> +
>> +  static OMPCapturedFieldDecl *CreateDeserialized(ASTContext ,
>> unsigned ID);
>> +
>> +  // Implement isa/cast/dyncast/etc.
>> +  static bool classof(const Decl *D) { return classofKind(D->getKind());
>> }
>> +  static bool classofKind(Kind K) { return K == OMPCapturedField; }
>> +};
>> +
>> +} // end namespace clang
>>
>>  #endif
>>
>> Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=260077=260076=260077=diff
>>
>> ==
>> --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
>> +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Mon Feb  8 03:29:13
>> 2016
>> @@ -1434,6 +1434,8 @@ DEF_TRAVERSE_DECL(OMPThreadPrivateDecl,
>>}
>>  })
>>
>> +DEF_TRAVERSE_DECL(OMPCapturedFieldDecl, { TRY_TO(TraverseVarHelper(D));
>> })
>> +
>>  // A helper method for TemplateDecl's children.
>>  template 
>>  bool 

Re: r260077 - [OPENMP 4.5] Ccapture/codegen of private non-static data members.

2016-02-08 Thread Alexey Bataev via cfe-commits
Yes, I know, will be fixed in few minutes

Best regards,
Alexey Bataev
=
Software Engineer
Intel Compiler Team

08.02.2016 15:43, NAKAMURA Takumi пишет:
The test is incompatible to i686-pc-win32. See also 
http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/5498

On Mon, Feb 8, 2016 at 6:33 PM Alexey Bataev via cfe-commits 
> wrote:
Author: abataev
Date: Mon Feb  8 03:29:13 2016
New Revision: 260077

URL: http://llvm.org/viewvc/llvm-project?rev=260077=rev
Log:
[OPENMP 4.5] Ccapture/codegen of private non-static data members.
OpenMP 4.5 introduces privatization of non-static data members of current class 
in non-static member functions.
To correctly handle such kind of privatization a new (pseudo)declaration 
VarDecl-based node is added. It allows to reuse an existing code for capturing 
variables in Lambdas/Block/Captured blocks of code for correct privatization 
and codegen.

Modified:
cfe/trunk/include/clang/AST/DeclOpenMP.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/Basic/DeclNodes.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/lib/AST/DeclBase.cpp
cfe/trunk/lib/AST/DeclOpenMP.cpp
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprMember.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Serialization/ASTCommon.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
cfe/trunk/test/OpenMP/parallel_private_codegen.cpp
cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang/AST/DeclOpenMP.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclOpenMP.h?rev=260077=260076=260077=diff
==
--- cfe/trunk/include/clang/AST/DeclOpenMP.h (original)
+++ cfe/trunk/include/clang/AST/DeclOpenMP.h Mon Feb  8 03:29:13 2016
@@ -87,6 +87,35 @@ public:
   static bool classofKind(Kind K) { return K == OMPThreadPrivate; }
 };

-}  // end namespace clang
+/// Pseudo declaration for capturing of non-static data members in non-static
+/// member functions.
+///
+/// Clang supports capturing of variables only, but OpenMP 4.5 allows to
+/// privatize non-static members of current class in non-static member
+/// functions. This pseudo-declaration allows properly handle this kind of
+/// capture by wrapping captured expression into a variable-like declaration.
+class OMPCapturedFieldDecl final : public VarDecl {
+  friend class ASTDeclReader;
+  void anchor() override;
+
+  OMPCapturedFieldDecl(ASTContext , DeclContext *DC, IdentifierInfo *Id,
+   QualType Type)
+  : VarDecl(OMPCapturedField, C, DC, SourceLocation(), SourceLocation(), 
Id,
+Type, nullptr, SC_None) {
+setImplicit();
+  }
+
+public:
+  static OMPCapturedFieldDecl *Create(ASTContext , DeclContext *DC,
+  IdentifierInfo *Id, QualType T);
+
+  static OMPCapturedFieldDecl *CreateDeserialized(ASTContext , unsigned ID);
+
+  // Implement isa/cast/dyncast/etc.
+  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
+  static bool classofKind(Kind K) { return K == OMPCapturedField; }
+};
+
+} // end namespace clang

 #endif

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=260077=260076=260077=diff
==
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Mon Feb  8 03:29:13 2016
@@ -1434,6 +1434,8 @@ DEF_TRAVERSE_DECL(OMPThreadPrivateDecl,
   }
 })

+DEF_TRAVERSE_DECL(OMPCapturedFieldDecl, { TRY_TO(TraverseVarHelper(D)); })
+
 // A helper method for TemplateDecl's children.
 template 
 bool RecursiveASTVisitor::TraverseTemplateParameterListHelper(

Modified: cfe/trunk/include/clang/Basic/DeclNodes.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DeclNodes.td?rev=260077=260076=260077=diff
==
--- cfe/trunk/include/clang/Basic/DeclNodes.td (original)
+++ cfe/trunk/include/clang/Basic/DeclNodes.td Mon Feb  8 03:29:13 2016
@@ -51,6 +51,7 @@ def Named : Decl<1>;
 : DDecl;
 def ImplicitParam : DDecl;
 def ParmVar : DDecl;
+def OMPCapturedField : DDecl;
   def NonTypeTemplateParm : DDecl;
   def Template : DDecl;
 def RedeclarableTemplate : DDecl;

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 

Re: r260077 - [OPENMP 4.5] Ccapture/codegen of private non-static data members.

2016-02-08 Thread Alexey Bataev via cfe-commits
Ok, thanks a lot! Hope it will fix win-based buildbots completely.

Best regards,
Alexey Bataev
=
Software Engineer
Intel Compiler Team

08.02.2016 17:11, NAKAMURA Takumi пишет:
Thanks. It didn't pass with i686-mingw32.

  // LAMBDA: call
  // LAMBDA: call{{.*}} void [[OUTER_LAMBDA:@.+]](

  call x86_thiscallcc void @_ZN2SSC1ERi(%struct.SS* %ss, i32* 
dereferenceable(4) @_ZZ4mainE5sivar)
  call x86_thiscallcc void @"_ZZ4mainENK3$_0clEv"(%class.anon* %temp.lvalue)

The latter LAMBDA hit "callcc void @_ZN2SSC1ERi("

Fixed in r260093.

I suggest like;
  // LAMBDA: call{{.*}} void 
[[OUTER_LAMBDA:@.+]](%class.anon*

On Mon, Feb 8, 2016 at 10:02 PM Alexey Bataev 
> wrote:
Yes, I know, will be fixed in few minutes

Best regards,
Alexey Bataev
=
Software Engineer
Intel Compiler Team

08.02.2016 15:43, NAKAMURA Takumi пишет:
The test is incompatible to i686-pc-win32. See also 
http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/5498

On Mon, Feb 8, 2016 at 6:33 PM Alexey Bataev via cfe-commits 
> wrote:
Author: abataev
Date: Mon Feb  8 03:29:13 2016
New Revision: 260077

URL: http://llvm.org/viewvc/llvm-project?rev=260077=rev
Log:
[OPENMP 4.5] Ccapture/codegen of private non-static data members.
OpenMP 4.5 introduces privatization of non-static data members of current class 
in non-static member functions.
To correctly handle such kind of privatization a new (pseudo)declaration 
VarDecl-based node is added. It allows to reuse an existing code for capturing 
variables in Lambdas/Block/Captured blocks of code for correct privatization 
and codegen.

Modified:
cfe/trunk/include/clang/AST/DeclOpenMP.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/Basic/DeclNodes.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/lib/AST/DeclBase.cpp
cfe/trunk/lib/AST/DeclOpenMP.cpp
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprMember.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Serialization/ASTCommon.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
cfe/trunk/test/OpenMP/parallel_private_codegen.cpp
cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang/AST/DeclOpenMP.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclOpenMP.h?rev=260077=260076=260077=diff
==
--- cfe/trunk/include/clang/AST/DeclOpenMP.h (original)
+++ cfe/trunk/include/clang/AST/DeclOpenMP.h Mon Feb  8 03:29:13 2016
@@ -87,6 +87,35 @@ public:
   static bool classofKind(Kind K) { return K == OMPThreadPrivate; }
 };

-}  // end namespace clang
+/// Pseudo declaration for capturing of non-static data members in non-static
+/// member functions.
+///
+/// Clang supports capturing of variables only, but OpenMP 4.5 allows to
+/// privatize non-static members of current class in non-static member
+/// functions. This pseudo-declaration allows properly handle this kind of
+/// capture by wrapping captured expression into a variable-like declaration.
+class OMPCapturedFieldDecl final : public VarDecl {
+  friend class ASTDeclReader;
+  void anchor() override;
+
+  OMPCapturedFieldDecl(ASTContext , DeclContext *DC, IdentifierInfo *Id,
+   QualType Type)
+  : VarDecl(OMPCapturedField, C, DC, SourceLocation(), SourceLocation(), 
Id,
+Type, nullptr, SC_None) {
+setImplicit();
+  }
+
+public:
+  static OMPCapturedFieldDecl *Create(ASTContext , DeclContext *DC,
+  IdentifierInfo *Id, QualType T);
+
+  static OMPCapturedFieldDecl *CreateDeserialized(ASTContext , unsigned ID);
+
+  // Implement isa/cast/dyncast/etc.
+  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
+  static bool classofKind(Kind K) { return K == OMPCapturedField; }
+};
+
+} // end namespace clang

 #endif

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=260077=260076=260077=diff
==
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Mon Feb  8 03:29:13 2016
@@ -1434,6 +1434,8 @@ DEF_TRAVERSE_DECL(OMPThreadPrivateDecl,
   }
 })

+DEF_TRAVERSE_DECL(OMPCapturedFieldDecl, { TRY_TO(TraverseVarHelper(D)); })
+
 // A helper method for TemplateDecl's children.
 template 
 bool