[clang] [lld] [llvm] Add _Coroutine unit tests (PR #116561)

2024-11-17 Thread Abdur Javaid via cfe-commits

https://github.com/abdurj created 
https://github.com/llvm/llvm-project/pull/116561

Adds a simple FileCheck test for _Coroutine. For some reason, we broke a 
previous test but we can figure this out later.

## Testing:
`ninja -C build check-clang`

>From ec2e4574378f4b248277789c4951781a7244be6e Mon Sep 17 00:00:00 2001
From: SongRe <49730299+son...@users.noreply.github.com>
Date: Fri, 15 Nov 2024 23:13:45 -0500
Subject: [PATCH 1/2] Add new _Coroutine Keyword  (#1)

* _Coroutine recognized by editor as its own type
---
 .gitignore   |  1 +
 clang/include/clang/AST/Decl.h   |  2 +-
 clang/include/clang/AST/Type.h   |  8 +++-
 clang/include/clang/Basic/Specifiers.h   |  1 +
 clang/include/clang/Basic/TokenKinds.def |  1 +
 clang/include/clang/Sema/DeclSpec.h  |  3 ++-
 clang/lib/AST/Type.cpp   | 11 +++
 clang/lib/Index/USRGeneration.cpp|  3 +++
 clang/lib/Parse/ParseDecl.cpp|  3 +++
 clang/lib/Parse/ParseDeclCXX.cpp | 10 --
 clang/lib/Parse/Parser.cpp   |  1 +
 clang/lib/Sema/DeclSpec.cpp  |  2 ++
 clang/lib/Sema/SemaCodeComplete.cpp  | 12 +++-
 clang/lib/Sema/SemaDecl.cpp  |  8 
 clang/lib/Sema/SemaTemplateVariadic.cpp  |  1 +
 clang/lib/Sema/SemaType.cpp  |  1 +
 clang/utils/ClangVisualizers/clang.natvis|  4 ++--
 lld/test/MachO/compact-unwind-generated.test |  1 +
 llvm/test/tools/opt-viewer/lit.local.cfg |  2 ++
 19 files changed, 67 insertions(+), 8 deletions(-)

diff --git a/.gitignore b/.gitignore
index 0e7c6c79001338..06ad856af2d175 100644
--- a/.gitignore
+++ b/.gitignore
@@ -71,3 +71,4 @@ pythonenv*
 /clang/utils/analyzer/projects/*/RefScanBuildResults
 # automodapi puts generated documentation files here.
 /lldb/docs/python_api/
+llvm-project.code-workspace
\ No newline at end of file
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index 8c39ef3d5a9fa6..6d5dba6c88c5e8 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -3768,7 +3768,7 @@ class TagDecl : public TypeDecl,
 
   bool isStruct() const { return getTagKind() == TagTypeKind::Struct; }
   bool isInterface() const { return getTagKind() == TagTypeKind::Interface; }
-  bool isClass() const { return getTagKind() == TagTypeKind::Class; }
+  bool isClass() const { return getTagKind() == TagTypeKind::Class || 
getTagKind() == TagTypeKind::Coroutine; }
   bool isUnion() const { return getTagKind() == TagTypeKind::Union; }
   bool isEnum() const { return getTagKind() == TagTypeKind::Enum; }
 
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 1ed5c22361ca68..8bcd6172668b6d 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -6859,6 +6859,9 @@ enum class ElaboratedTypeKeyword {
   /// \c typename T::type.
   Typename,
 
+  /// The "Coroutine" keyword also introduces elaborated-type specifier
+  Coroutine,
+
   /// No keyword precedes the qualified type name.
   None
 };
@@ -6878,7 +6881,10 @@ enum class TagTypeKind {
   Class,
 
   /// The "enum" keyword.
-  Enum
+  Enum,
+
+  /// The "_Coroutine" keyword.
+  Coroutine
 };
 
 /// A helper class for Type nodes having an ElaboratedTypeKeyword.
diff --git a/clang/include/clang/Basic/Specifiers.h 
b/clang/include/clang/Basic/Specifiers.h
index 9c089908fdc130..d39523cd90a009 100644
--- a/clang/include/clang/Basic/Specifiers.h
+++ b/clang/include/clang/Basic/Specifiers.h
@@ -79,6 +79,7 @@ namespace clang {
 TST_enum,
 TST_union,
 TST_struct,
+TST_coroutine,
 TST_class, // C++ class type
 TST_interface, // C++ (Microsoft-specific) __interface type
 TST_typename,  // Typedef, C++ class-name or enum name, etc.
diff --git a/clang/include/clang/Basic/TokenKinds.def 
b/clang/include/clang/Basic/TokenKinds.def
index 2c692c999bdff5..deac64dca22598 100644
--- a/clang/include/clang/Basic/TokenKinds.def
+++ b/clang/include/clang/Basic/TokenKinds.def
@@ -336,6 +336,7 @@ KEYWORD(_Atomic , KEYALL|KEYNOOPENCL)
 KEYWORD(_Bool   , KEYNOCXX)
 KEYWORD(_Complex, KEYALL)
 KEYWORD(_Generic, KEYALL)
+KEYWORD(_Coroutine  , KEYALL)
 // Note, C2y removed support for _Imaginary; we retain it as a keyword because
 // 1) it's a reserved identifier, so we're allowed to steal it, 2) there's no
 // good way to specify a keyword in earlier but not later language modes within
diff --git a/clang/include/clang/Sema/DeclSpec.h 
b/clang/include/clang/Sema/DeclSpec.h
index 06243f2624876f..67be14d7ffa539 100644
--- a/clang/include/clang/Sema/DeclSpec.h
+++ b/clang/include/clang/Sema/DeclSpec.h
@@ -303,6 +303,7 @@ class DeclSpec {
   static const TST TST_struct = clang::TST_struct;
   static const TST TST_interface = clang::T

[clang] [lld] [llvm] Add _Coroutine unit tests (PR #116561)

2024-11-17 Thread Abdur Javaid via cfe-commits

https://github.com/abdurj closed 
https://github.com/llvm/llvm-project/pull/116561
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [lld] [llvm] When (PR #126173)

2025-02-06 Thread Abdur Javaid via cfe-commits

https://github.com/abdurj closed 
https://github.com/llvm/llvm-project/pull/126173
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [lld] [llvm] Fix monitor (PR #132880)

2025-03-24 Thread Abdur Javaid via cfe-commits

https://github.com/abdurj closed 
https://github.com/llvm/llvm-project/pull/132880
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits