[clang] [clang] Factor out OpenACC part of `Sema` (PR #84184)
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 11 08:34:07 PDT 2024
================
@@ -63,17 +67,17 @@ void Sema::ActOnOpenACCConstruct(OpenACCDirectiveKind K,
// here as these constructs do not take any arguments.
break;
default:
- Diag(StartLoc, diag::warn_acc_construct_unimplemented) << K;
+ SemaRef.Diag(StartLoc, diag::warn_acc_construct_unimplemented) << K;
----------------
sam-mccall wrote:
Agreed. Is there a better way than this?
```
class SemaComponent {
Sema &S;
protected:
SemaComponent(Sema &S) : S(S) {}
Sema& sema() { return S; }
SemaDiagnosticBuilder Diag(...) { return sema().Diag(...); }
// ...
};
class SemaOpenACC : public SemaComponent {
public:
using SemaComponent::SemaComponent;
...
}
```
Accessing `sema()` would be a marker of crossing component boundaries, which is worthy of some scrutiny.
This requires some agreement on what common functionality is. On the other hand it forces some discussion/review of this definition which seems useful.
It requires SemaOpenACC.h to depend on Sema.h (which personally I think is reasonable, based on what clients will do).
It also requires a bunch of boilerplate, which is sad.
https://github.com/llvm/llvm-project/pull/84184
More information about the cfe-commits
mailing list