Skip to content

Conversation

@kparzysz
Copy link
Contributor

@kparzysz kparzysz commented Dec 5, 2024

This will be used to print the original directive source from the AST after splitting compound directives.

This will be used to print the original directive source from the AST
after splitting compound directives.
@github-actions
Copy link

github-actions bot commented Dec 5, 2024

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 5f1cc61eaf6df0f74dfe6871d089f5a1f2e405ad 283b0b527836bee29cf633964fa0474f931a9bfc --extensions cpp,h -- clang/include/clang-c/Index.h clang/include/clang/AST/RecursiveASTVisitor.h clang/include/clang/AST/StmtOpenMP.h clang/include/clang/AST/TextNodeDumper.h clang/include/clang/Sema/SemaOpenMP.h clang/include/clang/Serialization/ASTBitCodes.h clang/lib/AST/StmtOpenMP.cpp clang/lib/AST/StmtPrinter.cpp clang/lib/AST/StmtProfile.cpp clang/lib/AST/TextNodeDumper.cpp clang/lib/CodeGen/CGStmt.cpp clang/lib/Sema/SemaExceptionSpec.cpp clang/lib/Sema/SemaOpenMP.cpp clang/lib/Sema/TreeTransform.h clang/lib/Serialization/ASTReaderStmt.cpp clang/lib/Serialization/ASTWriterStmt.cpp clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
View the diff from clang-format here.
diff --git a/clang/include/clang/AST/StmtOpenMP.h b/clang/include/clang/AST/StmtOpenMP.h
index 0d05dfd795..df43f348b4 100644
--- a/clang/include/clang/AST/StmtOpenMP.h
+++ b/clang/include/clang/AST/StmtOpenMP.h
@@ -1613,9 +1613,9 @@ public:
   /// \param DKind The OpenMP directive kind.
   /// \param NumClauses Number of clauses.
   ///
-  static OMPCompoundRootDirective *
-  CreateEmpty(const ASTContext &C, OpenMPDirectiveKind DKind,
-              unsigned NumClauses, EmptyShell);
+  static OMPCompoundRootDirective *CreateEmpty(const ASTContext &C,
+                                               OpenMPDirectiveKind DKind,
+                                               unsigned NumClauses, EmptyShell);
 
   static bool classof(const Stmt *T) {
     return T->getStmtClass() == OMPCompoundRootDirectiveClass;
diff --git a/clang/lib/AST/StmtOpenMP.cpp b/clang/lib/AST/StmtOpenMP.cpp
index f86bbff57d..a1add69be5 100644
--- a/clang/lib/AST/StmtOpenMP.cpp
+++ b/clang/lib/AST/StmtOpenMP.cpp
@@ -269,9 +269,10 @@ OMPCompoundRootDirective *OMPCompoundRootDirective::Create(
   return Dir;
 }
 
-OMPCompoundRootDirective *OMPCompoundRootDirective::CreateEmpty(
-    const ASTContext &C, OpenMPDirectiveKind DKind, unsigned NumClauses,
-    EmptyShell) {
+OMPCompoundRootDirective *
+OMPCompoundRootDirective::CreateEmpty(const ASTContext &C,
+                                      OpenMPDirectiveKind DKind,
+                                      unsigned NumClauses, EmptyShell) {
   return createEmptyDirective<OMPCompoundRootDirective>(
       C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1, DKind);
 }
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index a19a692edb..9518614c2e 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -23312,8 +23312,8 @@ static bool checkScanScope(Sema &S, Scope *CurrentS, SourceLocation Loc);
 StmtResult SemaOpenMP::ActOnOpenMPCompoundRootDirective(
     OpenMPDirectiveKind DKind, ArrayRef<OMPClause *> Clauses, Stmt *AStmt,
     Stmt *UStmt, SourceLocation StartLoc, SourceLocation EndLoc) {
-  return OMPCompoundRootDirective::Create(
-      getASTContext(), StartLoc, EndLoc, DKind, Clauses, AStmt, UStmt);
+  return OMPCompoundRootDirective::Create(getASTContext(), StartLoc, EndLoc,
+                                          DKind, Clauses, AStmt, UStmt);
 }
 
 StmtResult SemaOpenMP::ActOnOpenMPOpaqueBlockDirective(

That statement will be ignored for all purposes, except for regenerating
the original source code.
Copy link
Member

@jdoerfert jdoerfert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me. I left one comment and I believe you can verify what is best yourself.

OMPCompoundRootDirective *D) {
// This function should never be found in a template. Directive splitting
// only happens in non-template functions.
llvm_unreachable("TransformOMPCompoundRootDirective in a template");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure llvm_unreachable is the right kind of error here. Maybe it is. Is there precedent?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants