[PATCH] D77252: [OpenMP] Try to find an existing base for `omp begin/end declare variant`

Johannes Doerfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 1 16:21:27 PDT 2020


jdoerfert created this revision.
jdoerfert added reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim, aaron.ballman.
Herald added subscribers: guansong, bollu, yaxunl.
Herald added a project: clang.

If we have a function definition in `omp begin/end declare variant` it
is a specialization of a base function with the same name and
"compatible" type. Before, we just created a declaration for the base.
With this patch we try to find an existing declaration first and only
create a new one if we did not find any with a compatible type. This is
preferable as we can tolerate slight mismatches, especially if the
specialized version is "more constrained", e.g., constexpr.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77252

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/AST/ast-dump-openmp-begin-declare-variant_10.c
  clang/test/AST/ast-dump-openmp-begin-declare-variant_11.c
  clang/test/AST/ast-dump-openmp-begin-declare-variant_12.c
  clang/test/AST/ast-dump-openmp-begin-declare-variant_2.c
  clang/test/AST/ast-dump-openmp-begin-declare-variant_3.c
  clang/test/AST/ast-dump-openmp-begin-declare-variant_4.c
  clang/test/AST/ast-dump-openmp-begin-declare-variant_5.c
  clang/test/AST/ast-dump-openmp-begin-declare-variant_6.c
  clang/test/AST/ast-dump-openmp-begin-declare-variant_7.c
  clang/test/AST/ast-dump-openmp-begin-declare-variant_8.c
  clang/test/AST/ast-dump-openmp-begin-declare-variant_9.c
  clang/test/AST/ast-dump-openmp-begin-declare-variant_addr_1.c
  clang/test/AST/ast-dump-openmp-begin-declare-variant_namespace_1.cpp
  clang/test/AST/ast-dump-openmp-begin-declare-variant_template_1.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77252.254333.patch
Type: text/x-patch
Size: 238933 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200401/4fa9035e/attachment-0001.bin>


More information about the cfe-commits mailing list