forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang] Factor out OpenACC part of
Sema
(llvm#84184)
This patch moves OpenACC parts of `Sema` into a separate class `SemaOpenACC` that is placed in a separate header `Sema/SemaOpenACC.h`. This patch is intended to be a model of factoring things out of `Sema`, so I picked a small OpenACC part. Goals are the following: 1) Split `Sema` into manageable parts. 2) Make dependencies between parts visible. 3) Improve Clang development cycle by avoiding recompiling unrelated parts of the compiler. 4) Avoid compile-time regressions. 5) Avoid notational regressions in the code that uses Sema.
- Loading branch information
Showing
7 changed files
with
125 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
//===----- SemaOpenACC.h - Semantic Analysis for OpenACC constructs -------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
/// \file | ||
/// This file declares semantic analysis for OpenACC constructs and | ||
/// clauses. | ||
/// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_CLANG_SEMA_SEMAOPENACC_H | ||
#define LLVM_CLANG_SEMA_SEMAOPENACC_H | ||
|
||
#include "clang/AST/DeclGroup.h" | ||
#include "clang/Basic/OpenACCKinds.h" | ||
#include "clang/Basic/SourceLocation.h" | ||
#include "clang/Sema/Ownership.h" | ||
|
||
namespace clang { | ||
|
||
class ASTContext; | ||
class DiagnosticEngine; | ||
class LangOptions; | ||
class Sema; | ||
|
||
class SemaOpenACC { | ||
public: | ||
SemaOpenACC(Sema &S); | ||
|
||
ASTContext &getASTContext() const; | ||
DiagnosticsEngine &getDiagnostics() const; | ||
const LangOptions &getLangOpts() const; | ||
|
||
Sema &SemaRef; | ||
|
||
/// Called after parsing an OpenACC Clause so that it can be checked. | ||
bool ActOnClause(OpenACCClauseKind ClauseKind, SourceLocation StartLoc); | ||
|
||
/// Called after the construct has been parsed, but clauses haven't been | ||
/// parsed. This allows us to diagnose not-implemented, as well as set up any | ||
/// state required for parsing the clauses. | ||
void ActOnConstruct(OpenACCDirectiveKind K, SourceLocation StartLoc); | ||
|
||
/// Called after the directive, including its clauses, have been parsed and | ||
/// parsing has consumed the 'annot_pragma_openacc_end' token. This DOES | ||
/// happen before any associated declarations or statements have been parsed. | ||
/// This function is only called when we are parsing a 'statement' context. | ||
bool ActOnStartStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc); | ||
|
||
/// Called after the directive, including its clauses, have been parsed and | ||
/// parsing has consumed the 'annot_pragma_openacc_end' token. This DOES | ||
/// happen before any associated declarations or statements have been parsed. | ||
/// This function is only called when we are parsing a 'Decl' context. | ||
bool ActOnStartDeclDirective(OpenACCDirectiveKind K, SourceLocation StartLoc); | ||
/// Called when we encounter an associated statement for our construct, this | ||
/// should check legality of the statement as it appertains to this Construct. | ||
StmtResult ActOnAssociatedStmt(OpenACCDirectiveKind K, StmtResult AssocStmt); | ||
|
||
/// Called after the directive has been completely parsed, including the | ||
/// declaration group or associated statement. | ||
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, | ||
SourceLocation StartLoc, | ||
SourceLocation EndLoc, StmtResult AssocStmt); | ||
/// Called after the directive has been completely parsed, including the | ||
/// declaration group or associated statement. | ||
DeclGroupRef ActOnEndDeclDirective(); | ||
}; | ||
|
||
} // namespace clang | ||
|
||
#endif // LLVM_CLANG_SEMA_SEMAOPENACC_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.