[PATCH] D67837: [CUDA][HIP] Fix host/device check with -fopenmp

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 8 06:33:10 PDT 2019


ABataev added inline comments.


================
Comment at: lib/Sema/SemaCUDA.cpp:616
       if (getLangOpts().CUDAIsDevice) {
-        return IsKnownEmitted(*this, dyn_cast<FunctionDecl>(CurContext))
+        return (getEmissionStatus(dyn_cast<FunctionDecl>(CurContext)) ==
+                FunctionEmissionStatus::Emitted)
----------------
I assume, better to use `cast` here, not `dyn_cast`


================
Comment at: lib/Sema/SemaCUDA.cpp:645
 
-      return IsKnownEmitted(*this, dyn_cast<FunctionDecl>(CurContext))
+      return (getEmissionStatus(dyn_cast<FunctionDecl>(CurContext)) ==
+              FunctionEmissionStatus::Emitted)
----------------
Same here, just `cast`


================
Comment at: lib/Sema/SemaOpenMP.cpp:1627-1628
+  if (Caller) {
+    auto CallerS = getEmissionStatus(Caller);
+    auto CalleeS = getEmissionStatus(Callee);
+    assert(CallerS != FunctionEmissionStatus::CUDADiscarded &&
----------------
Better to use real type instead of `auto` here


================
Comment at: lib/Sema/SemaOpenMP.cpp:1670-1671
+  if (Caller) {
+    auto CallerS = getEmissionStatus(Caller);
+    auto CalleeS = getEmissionStatus(Callee);
+    assert(
----------------
Real types instead of `auto`


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

https://reviews.llvm.org/D67837





More information about the cfe-commits mailing list