Fznamznon added inline comments.

================
Comment at: clang/lib/Sema/Sema.cpp:1468
   }
-  S.DeviceDeferredDiags.erase(It);
 
----------------
This particular change causes duplication of deferred diagnostics.
Consider the following example (please correct me if I'm doing something wrong, 
I'm not an expert in OpenMP):

```
int foobar1() { throw 1; } // error is expected here

// let's try to use foobar1 in the code where exceptions aren't allowed
#pragma omp declare target    
int (*B)() = &foobar1;        
#pragma omp end declare target

// and in some other place let's use foobar1 in device code again
#pragma omp declare target    
int a = foobar1();            
#pragma omp end declare target

```
Then diagnostic for `foobar1`  will be duplicated for each use of `foobar1` 
under `target` directive.
I first experienced this behavior not with OpenMP, so I suppose reproducer can 
be done for each programming model which uses deferred diagnostics.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70172/new/

https://reviews.llvm.org/D70172



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to