[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-26 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 added a comment.

In D147989#4299722 , @aaron.ballman 
wrote:

> LGTM! Do you need someone to land this on your behalf? If so, what name and 
> email address would you like used for patch attribution?

Yes, I need someone who can commit it for me. 
Username: ipriyanshi1708
Email address: priyanshiagarwal1...@gmail.com
Please commit it for me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-26 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 added a comment.

In D147989#4295928 , @aaron.ballman 
wrote:

> The issue is that `GetDiagnosticTypeSpecifierID()` is called for more 
> diagnostics than just `warn_declspec_attribute_ignored`. You need to also 
> update the `err_constexpr_tag` and 
> `err_standalone_class_nested_name_specifier` to add `enum class` and `enum 
> struct` as well.

Okay! Thanks. I have updated the code now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-26 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 517207.
ipriyanshi1708 added a comment.

Fixed the code


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/test/SemaCXX/attr-declspec-ignored.cpp

Index: clang/test/SemaCXX/attr-declspec-ignored.cpp
===
--- clang/test/SemaCXX/attr-declspec-ignored.cpp
+++ clang/test/SemaCXX/attr-declspec-ignored.cpp
@@ -9,6 +9,10 @@
   // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
   __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
   // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+  // expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum struct ES {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum struct" to apply attribute to type declaration}} \
+  // expected-warning{{attribute 'aligned' is ignored, place it after "enum struct" to apply attribute to type declaration}}
 
   // Test that we get the same warnings for type declarations nested in a record.
   struct X {
@@ -20,7 +24,11 @@
 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
 __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
-
+__attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
+__attribute__((visibility("hidden")))  __attribute__((aligned)) enum struct ES {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum struct" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum struct" to apply attribute to type declaration}}
+  
 // Also test [[]] attribute syntax. (On a non-nested declaration, these
 // generate a hard "misplaced attributes" error, which we test for
 // elsewhere.)
@@ -32,6 +40,10 @@
 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] enum H {H}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
+[[gnu::visibility("hidden")]]  [[gnu::aligned]] enum class I {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
+[[gnu::visibility("hidden")]]  [[gnu::aligned]] enum struct J {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum struct" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum struct" to apply attribute to type declaration}}
   };
 }
 
@@ -40,16 +52,22 @@
   __attribute__((visibility("hidden")))  __attribute__((aligned)) struct B {} b;
   __attribute__((visibility("hidden")))  __attribute__((aligned)) union C {} c;
   __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D} d;
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {} ec;
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum struct ES {} es;
 
   struct X {
 __attribute__((visibility("hidden")))  __attribute__((aligned)) class A {} a;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) struct B {} b;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) union C {} 

[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-25 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 marked an inline comment as done.
ipriyanshi1708 added a comment.

In D147989#4293278 , @aaron.ballman 
wrote:

> Oops, I spoke too soon -- it looks like the precommit CI failure is related 
> to this patch. This is what I get when I tested locally:
>
>   Assertion failed: NextVal != ArgumentEnd && "Value for integer select 
> modifier was" " larger than the number of options in the diagnostic string!", 
> file F:\source\llvm-project\clang\lib\Basic\Diagnostic.cpp, line 623
>   PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ 
> and include the crash backtrace, preprocessed source, and associated run 
> script.
>   Stack dump:
>   0.  Program arguments: 
> f:\\source\\llvm-project\\llvm\\out\\build\\x64-debug\\bin\\clang.exe -cc1 
> -internal-isystem 
> f:\\source\\llvm-project\\llvm\\out\\build\\x64-debug\\lib\\clang\\17\\include
>  -nostdsysteminc -std=c++11 -triple x86_64-unknown-unknown 
> F:\\source\\llvm-project\\clang\\test\\CXX\\drs\\dr16xx.cpp -verify 
> -fexceptions -fcxx-exceptions -pedantic-errors
>   1.  F:\source\llvm-project\clang\test\CXX\drs\dr16xx.cpp:91:3: current 
> parser token 'template'
>   2.  F:\source\llvm-project\clang\test\CXX\drs\dr16xx.cpp:71:1: parsing 
> namespace 'dr1638'
>   Exception Code: 0x8003
>#0 0x7ff6625ea26c HandleAbort 
> F:\source\llvm-project\llvm\lib\Support\Windows\Signals.inc:419:0
>#1 0x7ffa9b23bc31 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x6bc31)
>#2 0x7ffa9b23d889 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x6d889)
>#3 0x7ffa9b2430bf (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x730bf)
>#4 0x7ffa9b241091 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x71091)
>#5 0x7ffa9b243a1f (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x73a1f)
>#6 0x7ff662a19b8c HandleSelectModifier 
> F:\source\llvm-project\clang\lib\Basic\Diagnostic.cpp:622:0
>#7 0x7ff662a17137 clang::Diagnostic::FormatDiagnostic(char const *, 
> char const *, class llvm::SmallVectorImpl &) const 
> F:\source\llvm-project\clang\lib\Basic\Diagnostic.cpp:1005:0
>#8 0x7ff662a16518 clang::Diagnostic::FormatDiagnostic(class 
> llvm::SmallVectorImpl &) const 
> F:\source\llvm-project\clang\lib\Basic\Diagnostic.cpp:805:0
>#9 0x7ff663e5bcc9 clang::TextDiagnosticBuffer::HandleDiagnostic(enum 
> clang::DiagnosticsEngine::Level, class clang::Diagnostic const &) 
> F:\source\llvm-project\clang\lib\Frontend\TextDiagnosticBuffer.cpp:30:0
>   #10 0x7ff663ef2d71 
> clang::VerifyDiagnosticConsumer::HandleDiagnostic(enum 
> clang::DiagnosticsEngine::Level, class clang::Diagnostic const &) 
> F:\source\llvm-project\clang\lib\Frontend\VerifyDiagnosticConsumer.cpp:757:0
>   #11 0x7ff662a0b66f clang::DiagnosticIDs::EmitDiag(class 
> clang::DiagnosticsEngine &, enum clang::DiagnosticIDs::Level) const 
> F:\source\llvm-project\clang\lib\Basic\DiagnosticIDs.cpp:839:0
>   #12 0x7ff662a0b597 clang::DiagnosticIDs::ProcessDiag(class 
> clang::DiagnosticsEngine &) const 
> F:\source\llvm-project\clang\lib\Basic\DiagnosticIDs.cpp:831:0
>   #13 0x7ff662a267ef clang::DiagnosticsEngine::ProcessDiag(void) 
> F:\source\llvm-project\clang\include\clang\Basic\Diagnostic.h:1038:0
>   #14 0x7ff662a15f64 
> clang::DiagnosticsEngine::EmitCurrentDiagnostic(bool) 
> F:\source\llvm-project\clang\lib\Basic\Diagnostic.cpp:549:0
>   #15 0x7ff667b47cbc clang::Sema::EmitCurrentDiagnostic(unsigned int) 
> F:\source\llvm-project\clang\lib\Sema\Sema.cpp:1575:0
>   #16 0x7ff667b89d97 
> clang::Sema::ImmediateDiagBuilder::~ImmediateDiagBuilder(void) 
> F:\source\llvm-project\clang\include\clang\Sema\Sema.h:1726:0
>   #17 0x7ff667b8e9e8 clang::Sema::ImmediateDiagBuilder::`scalar deleting 
> dtor'(unsigned int) 
> (f:\source\llvm-project\llvm\out\build\x64-debug\bin\clang.exe+0x81fe9e8)
>   #18 0x7ff667b72b06 std::_Destroy_in_place clang::Sema::ImmediateDiagBuilder>(class clang::Sema::ImmediateDiagBuilder &) 
> C:\Program Files\Microsoft Visual 
> Studio\2022\Professional\VC\Tools\MSVC\14.35.32215\include\xmemory:300:0
>   #19 0x7ff667bac5b4 std::_Optional_destruct_base clang::Sema::ImmediateDiagBuilder, 0>::reset(void) C:\Program Files\Microsoft 
> Visual 
> Studio\2022\Professional\VC\Tools\MSVC\14.35.32215\include\optional:133:0
>   #20 0x7ff667b53424 
> clang::Sema::SemaDiagnosticBuilder::~SemaDiagnosticBuilder(void) 
> F:\source\llvm-project\clang\lib\Sema\Sema.cpp:1859:0
>   #21 0x7ff668618b4a clang::Sema::ParsedFreeStandingDeclSpec(class 
> clang::Scope *, enum clang::AccessSpecifier, class clang::DeclSpec &, class 
> clang::ParsedAttributesView const &, class llvm::MutableArrayRef clang::TemplateParameterList *>, bool, class clang::RecordDecl *&) 
> F:\source\llvm-project\clang\lib\Sema\SemaDecl.cpp:5151:0
>   #22 0x7ff668618545 clang::Sema::ParsedFreeStandingDeclSpec(class 
> clang::Scope *, enum clang::AccessSpecifier, class clang::DeclSpec &, class 
> 

[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-22 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 516037.
ipriyanshi1708 marked 4 inline comments as done.
ipriyanshi1708 added a comment.

Removed unwanted changes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/test/SemaCXX/attr-declspec-ignored.cpp

Index: clang/test/SemaCXX/attr-declspec-ignored.cpp
===
--- clang/test/SemaCXX/attr-declspec-ignored.cpp
+++ clang/test/SemaCXX/attr-declspec-ignored.cpp
@@ -9,6 +9,10 @@
   // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
   __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
   // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+  // expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum struct ES {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum struct" to apply attribute to type declaration}} \
+  // expected-warning{{attribute 'aligned' is ignored, place it after "enum struct" to apply attribute to type declaration}}
 
   // Test that we get the same warnings for type declarations nested in a record.
   struct X {
@@ -20,7 +24,11 @@
 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
 __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
-
+__attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
+__attribute__((visibility("hidden")))  __attribute__((aligned)) enum struct ES {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum struct" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum struct" to apply attribute to type declaration}}
+  
 // Also test [[]] attribute syntax. (On a non-nested declaration, these
 // generate a hard "misplaced attributes" error, which we test for
 // elsewhere.)
@@ -32,6 +40,10 @@
 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] enum H {H}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
+[[gnu::visibility("hidden")]]  [[gnu::aligned]] enum class I {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
+[[gnu::visibility("hidden")]]  [[gnu::aligned]] enum struct J {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum struct" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum struct" to apply attribute to type declaration}}
   };
 }
 
@@ -40,16 +52,22 @@
   __attribute__((visibility("hidden")))  __attribute__((aligned)) struct B {} b;
   __attribute__((visibility("hidden")))  __attribute__((aligned)) union C {} c;
   __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D} d;
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {} ec;
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum struct ES {} es;
 
   struct X {
 __attribute__((visibility("hidden")))  __attribute__((aligned)) class A {} a;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) struct B {} b;
 

[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-22 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 516036.
ipriyanshi1708 added a comment.

Added case for enum struct


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Sema/attr-declspec-ignored.c
  clang/test/SemaCXX/attr-declspec-ignored.cpp

Index: clang/test/SemaCXX/attr-declspec-ignored.cpp
===
--- clang/test/SemaCXX/attr-declspec-ignored.cpp
+++ clang/test/SemaCXX/attr-declspec-ignored.cpp
@@ -9,6 +9,10 @@
   // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
   __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
   // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+  // expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum struct ES {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum struct" to apply attribute to type declaration}} \
+  // expected-warning{{attribute 'aligned' is ignored, place it after "enum struct" to apply attribute to type declaration}}
 
   // Test that we get the same warnings for type declarations nested in a record.
   struct X {
@@ -20,7 +24,11 @@
 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
 __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
-
+__attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
+__attribute__((visibility("hidden")))  __attribute__((aligned)) enum struct ES {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum struct" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum struct" to apply attribute to type declaration}}
+  
 // Also test [[]] attribute syntax. (On a non-nested declaration, these
 // generate a hard "misplaced attributes" error, which we test for
 // elsewhere.)
@@ -32,6 +40,10 @@
 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] enum H {H}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
+[[gnu::visibility("hidden")]]  [[gnu::aligned]] enum class I {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
+[[gnu::visibility("hidden")]]  [[gnu::aligned]] enum struct J {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum struct" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum struct" to apply attribute to type declaration}}
   };
 }
 
@@ -40,16 +52,22 @@
   __attribute__((visibility("hidden")))  __attribute__((aligned)) struct B {} b;
   __attribute__((visibility("hidden")))  __attribute__((aligned)) union C {} c;
   __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D} d;
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {} ec;
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum struct ES {} es;
 
   struct X {
 __attribute__((visibility("hidden")))  __attribute__((aligned)) class A {} a;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) struct B {} b;
 

[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-20 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 marked 3 inline comments as done.
ipriyanshi1708 added a comment.

In D147989#4283666 , @samtebbs wrote:

> This looks good to me now, nice work. Let's wait a few days for others' input 
> to be safe.

okay! Thank You Sir.




Comment at: clang/lib/Sema/SemaDecl.cpp:5051
+return 5;
+  else
+return 4;

samtebbs wrote:
> Instead of returning 4 here, I think it's best to just delegate to the other 
> `GetDiagnosticTypeSpecifierID` function. That way, if the IDs change for 
> whatever reason they only have to updated in one place. This could be done 
> cleanly by just making the call below be at the top level of the function 
> (i.e. not inside an `else` block).
Ya that can be done. I will do it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-19 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 515196.
ipriyanshi1708 marked an inline comment as done.
ipriyanshi1708 added a comment.

Updated the logic in a better way


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Sema/attr-declspec-ignored.c
  clang/test/SemaCXX/attr-declspec-ignored.cpp

Index: clang/test/SemaCXX/attr-declspec-ignored.cpp
===
--- clang/test/SemaCXX/attr-declspec-ignored.cpp
+++ clang/test/SemaCXX/attr-declspec-ignored.cpp
@@ -9,6 +9,8 @@
   // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
   __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
   // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+  // expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
 
   // Test that we get the same warnings for type declarations nested in a record.
   struct X {
@@ -20,7 +22,9 @@
 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
 __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
-
+__attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
+  
 // Also test [[]] attribute syntax. (On a non-nested declaration, these
 // generate a hard "misplaced attributes" error, which we test for
 // elsewhere.)
@@ -32,6 +36,8 @@
 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] enum H {H}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
+[[gnu::visibility("hidden")]]  [[gnu::aligned]] enum class I {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
   };
 }
 
@@ -40,16 +46,19 @@
   __attribute__((visibility("hidden")))  __attribute__((aligned)) struct B {} b;
   __attribute__((visibility("hidden")))  __attribute__((aligned)) union C {} c;
   __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D} d;
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {} ec;
 
   struct X {
 __attribute__((visibility("hidden")))  __attribute__((aligned)) class A {} a;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) struct B {} b;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) union C {} c;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D} d;
+__attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {} ec;
 
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] class E {} e;
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] struct F {} f;
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] union G {} g;
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] enum H {H} h;
+[[gnu::visibility("hidden")]]  [[gnu::aligned]] enum class I {} i;
   };
 }
Index: clang/test/Sema/attr-declspec-ignored.c
===
--- clang/test/Sema/attr-declspec-ignored.c
+++ clang/test/Sema/attr-declspec-ignored.c
@@ -19,4 +19,4 @@
 
 __attribute__((visibility("hidden")))  __attribute__((aligned)) struct D {} d;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) union E {} e;
-__attribute__((visibility("hidden")))  __attribute__((aligned)) enum F {F} f;

[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-19 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 514931.
ipriyanshi1708 marked an inline comment as done.
ipriyanshi1708 added a comment.

Updated the logic


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Sema/attr-declspec-ignored.c
  clang/test/SemaCXX/attr-declspec-ignored.cpp

Index: clang/test/SemaCXX/attr-declspec-ignored.cpp
===
--- clang/test/SemaCXX/attr-declspec-ignored.cpp
+++ clang/test/SemaCXX/attr-declspec-ignored.cpp
@@ -9,6 +9,8 @@
   // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
   __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
   // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+  // expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
 
   // Test that we get the same warnings for type declarations nested in a record.
   struct X {
@@ -20,7 +22,9 @@
 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
 __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
-
+__attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
+  
 // Also test [[]] attribute syntax. (On a non-nested declaration, these
 // generate a hard "misplaced attributes" error, which we test for
 // elsewhere.)
@@ -32,6 +36,8 @@
 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] enum H {H}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
+[[gnu::visibility("hidden")]]  [[gnu::aligned]] enum class I {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
   };
 }
 
@@ -40,16 +46,19 @@
   __attribute__((visibility("hidden")))  __attribute__((aligned)) struct B {} b;
   __attribute__((visibility("hidden")))  __attribute__((aligned)) union C {} c;
   __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D} d;
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {} ec;
 
   struct X {
 __attribute__((visibility("hidden")))  __attribute__((aligned)) class A {} a;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) struct B {} b;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) union C {} c;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D} d;
+__attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {} ec;
 
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] class E {} e;
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] struct F {} f;
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] union G {} g;
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] enum H {H} h;
+[[gnu::visibility("hidden")]]  [[gnu::aligned]] enum class I {} i;
   };
 }
Index: clang/test/Sema/attr-declspec-ignored.c
===
--- clang/test/Sema/attr-declspec-ignored.c
+++ clang/test/Sema/attr-declspec-ignored.c
@@ -19,4 +19,4 @@
 
 __attribute__((visibility("hidden")))  __attribute__((aligned)) struct D {} d;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) union E {} e;
-__attribute__((visibility("hidden")))  __attribute__((aligned)) enum F {F} f;

[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-19 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 514911.
ipriyanshi1708 added a comment.

Removed spurious whitespace changes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Sema/attr-declspec-ignored.c
  clang/test/SemaCXX/attr-declspec-ignored.cpp

Index: clang/test/SemaCXX/attr-declspec-ignored.cpp
===
--- clang/test/SemaCXX/attr-declspec-ignored.cpp
+++ clang/test/SemaCXX/attr-declspec-ignored.cpp
@@ -9,6 +9,8 @@
   // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
   __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
   // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+  // expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
 
   // Test that we get the same warnings for type declarations nested in a record.
   struct X {
@@ -20,7 +22,9 @@
 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
 __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
-
+__attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
+  
 // Also test [[]] attribute syntax. (On a non-nested declaration, these
 // generate a hard "misplaced attributes" error, which we test for
 // elsewhere.)
@@ -32,6 +36,8 @@
 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] enum H {H}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
+[[gnu::visibility("hidden")]]  [[gnu::aligned]] enum class I {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
   };
 }
 
@@ -40,16 +46,19 @@
   __attribute__((visibility("hidden")))  __attribute__((aligned)) struct B {} b;
   __attribute__((visibility("hidden")))  __attribute__((aligned)) union C {} c;
   __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D} d;
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {} ec;
 
   struct X {
 __attribute__((visibility("hidden")))  __attribute__((aligned)) class A {} a;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) struct B {} b;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) union C {} c;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D} d;
+__attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {} ec;
 
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] class E {} e;
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] struct F {} f;
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] union G {} g;
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] enum H {H} h;
+[[gnu::visibility("hidden")]]  [[gnu::aligned]] enum class I {} i;
   };
 }
Index: clang/test/Sema/attr-declspec-ignored.c
===
--- clang/test/Sema/attr-declspec-ignored.c
+++ clang/test/Sema/attr-declspec-ignored.c
@@ -19,4 +19,4 @@
 
 __attribute__((visibility("hidden")))  __attribute__((aligned)) struct D {} d;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) union E {} e;
-__attribute__((visibility("hidden")))  __attribute__((aligned)) enum F {F} f;
+__attribute__((visibility("hidden")))  

[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-19 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 514909.
ipriyanshi1708 added a comment.

Updated the test file


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Sema/attr-declspec-ignored.c
  clang/test/SemaCXX/attr-declspec-ignored.cpp

Index: clang/test/SemaCXX/attr-declspec-ignored.cpp
===
--- clang/test/SemaCXX/attr-declspec-ignored.cpp
+++ clang/test/SemaCXX/attr-declspec-ignored.cpp
@@ -9,6 +9,8 @@
   // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
   __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
   // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+  // expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
 
   // Test that we get the same warnings for type declarations nested in a record.
   struct X {
@@ -20,7 +22,9 @@
 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
 __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
-
+__attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
+  
 // Also test [[]] attribute syntax. (On a non-nested declaration, these
 // generate a hard "misplaced attributes" error, which we test for
 // elsewhere.)
@@ -32,6 +36,8 @@
 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] enum H {H}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
+[[gnu::visibility("hidden")]]  [[gnu::aligned]] enum class I {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
+// expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
   };
 }
 
@@ -40,16 +46,19 @@
   __attribute__((visibility("hidden")))  __attribute__((aligned)) struct B {} b;
   __attribute__((visibility("hidden")))  __attribute__((aligned)) union C {} c;
   __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D} d;
+  __attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {} ec;
 
   struct X {
 __attribute__((visibility("hidden")))  __attribute__((aligned)) class A {} a;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) struct B {} b;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) union C {} c;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) enum D {D} d;
+__attribute__((visibility("hidden")))  __attribute__((aligned)) enum class EC {} ec;
 
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] class E {} e;
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] struct F {} f;
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] union G {} g;
 [[gnu::visibility("hidden")]]  [[gnu::aligned]] enum H {H} h;
+[[gnu::visibility("hidden")]]  [[gnu::aligned]] enum class I {} i;
   };
 }
Index: clang/test/Sema/attr-declspec-ignored.c
===
--- clang/test/Sema/attr-declspec-ignored.c
+++ clang/test/Sema/attr-declspec-ignored.c
@@ -19,4 +19,4 @@
 
 __attribute__((visibility("hidden")))  __attribute__((aligned)) struct D {} d;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) union E {} e;
-__attribute__((visibility("hidden")))  __attribute__((aligned)) enum F {F} f;
+__attribute__((visibility("hidden")))  __attribute__((aligned)) 

[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-14 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 added a comment.

In D147989#4257721 , @aaron.ballman 
wrote:

> Thank you for working on this!
>
> The changes are missing test coverage; please be sure to add that, along with 
> a release note about the fix. I think there's likely more work to be done 
> here as well, considering this behavior: https://godbolt.org/z/sdK3Gef75 
> (notice the suggested location for the fix-it -- that also needs to be fixed 
> for this)

Can you please provide me guidance for writing tests for enum class. As I have 
tried but I am not getting any idea on how to write new tests for enum class.




Comment at: clang/lib/Sema/SemaDecl.cpp:5041
   case DeclSpec::TST_enum:
 return 4;
   default:

jrtc27 wrote:
> Why not just always pass the full DeclSpec and handle the class case here, 
> maybe with a bool to allow other users to not need to treat enum class as 
> different?
Ya, we can do that too. But like GetDiagnosticTypeSpecifierID() is also called 
in many other places in the file so if I pass the full DeclSpec in this 
function will not disturb those calls?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-14 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 513549.
ipriyanshi1708 marked 5 inline comments as done.
ipriyanshi1708 added a comment.

Improved the logic


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Sema/attr-declspec-ignored.c


Index: clang/test/Sema/attr-declspec-ignored.c
===
--- clang/test/Sema/attr-declspec-ignored.c
+++ clang/test/Sema/attr-declspec-ignored.c
@@ -19,4 +19,4 @@
 
 __attribute__((visibility("hidden")))  __attribute__((aligned)) struct D {} d;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) union E {} e;
-__attribute__((visibility("hidden")))  __attribute__((aligned)) enum F {F} f;
+__attribute__((visibility("hidden")))  __attribute__((aligned)) enum F {F} f;
\ No newline at end of file
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -5043,7 +5043,20 @@
 llvm_unreachable("unexpected type specifier");
   }
 }
-
+static unsigned GetDiagnosticTypeSpecifierID(const DeclSpec ){
+  if (DS.getTypeSpecType() == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+return 5;
+  else
+return 4;
+}
+  }
+  else{
+return GetDiagnosticTypeSpecifierID(DS.getTypeSpecType());
+  }
+  return 0;
+}
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
 /// no declarator (e.g. "struct foo;") is parsed. It also accepts template
 /// parameters to cope with template friend declarations.
@@ -5300,11 +5313,11 @@
 TypeSpecType == DeclSpec::TST_enum) {
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
+<< AL << GetDiagnosticTypeSpecifierID(DS);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+<< AL << GetDiagnosticTypeSpecifierID(DS);
+}
   }
 
   return TagD;
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3421,7 +3421,7 @@
   InGroup;
 def warn_declspec_attribute_ignored : Warning<
   "attribute %0 is ignored, place it after "
-  "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
+  "\"%select{class|struct|interface|union|enum|enum class}1\" to apply 
attribute to "
   "type declaration">, InGroup;
 def warn_attribute_precede_definition : Warning<
   "attribute declaration must precede definition">,
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -193,6 +193,8 @@
 
 Bug Fixes to Attribute Support
 ^^
+- Fixed a bug where attribute annotations on type specifiers (enums, classes, 
structs, unions, and scoped enums) were not properly ignored, resulting in 
misleading warning messages. Now, such attribute annotations are correctly 
ignored.
+(`#61660 `_)
 
 Bug Fixes to C++ Support
 


Index: clang/test/Sema/attr-declspec-ignored.c
===
--- clang/test/Sema/attr-declspec-ignored.c
+++ clang/test/Sema/attr-declspec-ignored.c
@@ -19,4 +19,4 @@
 
 __attribute__((visibility("hidden")))  __attribute__((aligned)) struct D {} d;
 __attribute__((visibility("hidden")))  __attribute__((aligned)) union E {} e;
-__attribute__((visibility("hidden")))  __attribute__((aligned)) enum F {F} f;
+__attribute__((visibility("hidden")))  __attribute__((aligned)) enum F {F} f;
\ No newline at end of file
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -5043,7 +5043,20 @@
 llvm_unreachable("unexpected type specifier");
   }
 }
-
+static unsigned GetDiagnosticTypeSpecifierID(const DeclSpec ){
+  if (DS.getTypeSpecType() == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+return 5;
+  else
+return 4;
+}
+  }
+  else{
+return GetDiagnosticTypeSpecifierID(DS.getTypeSpecType());
+  }
+  return 0;
+}
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
 /// 

[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-11 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 512445.
ipriyanshi1708 added a comment.

Applied C++ Overloading


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -5043,7 +5043,18 @@
 llvm_unreachable("unexpected type specifier");
   }
 }
-
+static unsigned GetDiagnosticTypeSpecifierID(const DeclSpec ){
+  if (DS.getTypeSpecType() == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+  return 5;
+}
+  }
+  else{
+return GetDiagnosticTypeSpecifierID(DS.getTypeSpecType());
+  }
+  return 0;
+}
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
 /// no declarator (e.g. "struct foo;") is parsed. It also accepts template
 /// parameters to cope with template friend declarations.
@@ -5300,11 +5311,11 @@
 TypeSpecType == DeclSpec::TST_enum) {
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
+<< AL << GetDiagnosticTypeSpecifierID(DS);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+<< AL << GetDiagnosticTypeSpecifierID(DS);
+}
   }
 
   return TagD;
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3421,7 +3421,7 @@
   InGroup;
 def warn_declspec_attribute_ignored : Warning<
   "attribute %0 is ignored, place it after "
-  "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
+  "\"%select{class|struct|interface|union|enum|enum class}1\" to apply 
attribute to "
   "type declaration">, InGroup;
 def warn_attribute_precede_definition : Warning<
   "attribute declaration must precede definition">,
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -193,6 +193,8 @@
 
 Bug Fixes to Attribute Support
 ^^
+- Fixed a bug where attribute annotations on type specifiers (enums, classes, 
structs, unions, and scoped enums) were not properly ignored, resulting in 
misleading warning messages. Now, such attribute annotations are correctly 
ignored.
+(`#61660 `_)
 
 Bug Fixes to C++ Support
 


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -5043,7 +5043,18 @@
 llvm_unreachable("unexpected type specifier");
   }
 }
-
+static unsigned GetDiagnosticTypeSpecifierID(const DeclSpec ){
+  if (DS.getTypeSpecType() == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+  return 5;
+}
+  }
+  else{
+return GetDiagnosticTypeSpecifierID(DS.getTypeSpecType());
+  }
+  return 0;
+}
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
 /// no declarator (e.g. "struct foo;") is parsed. It also accepts template
 /// parameters to cope with template friend declarations.
@@ -5300,11 +5311,11 @@
 TypeSpecType == DeclSpec::TST_enum) {
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
+<< AL << GetDiagnosticTypeSpecifierID(DS);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+<< AL << GetDiagnosticTypeSpecifierID(DS);
+}
   }
 
   return TagD;
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3421,7 +3421,7 @@
   InGroup;
 def warn_declspec_attribute_ignored : Warning<
   "attribute %0 is ignored, place it after "
-  "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
+  "\"%select{class|struct|interface|union|enum|enum class}1\" to apply attribute to "
   "type declaration">, InGroup;
 def 

[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-11 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 added a comment.

In D147989#4257947 , @samtebbs wrote:

> Thanks for the input Aaron and Martin. This is looking good. With the 
> suggested changes and some formatting 
>  I think it 
> will be ready.

Okay! I will update it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-11 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 512437.
ipriyanshi1708 added a comment.

Added the Release note for the fix


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -5043,7 +5043,18 @@
 llvm_unreachable("unexpected type specifier");
   }
 }
-
+static unsigned GetDiagnosticTypeSpecifierIDWithAttrs(DeclSpec::TST T, const 
DeclSpec ){
+  if (T == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+  return 5;
+}
+  }
+  else{
+return GetDiagnosticTypeSpecifierID(T);
+  }
+  return 0;
+}
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
 /// no declarator (e.g. "struct foo;") is parsed. It also accepts template
 /// parameters to cope with template friend declarations.
@@ -5300,11 +5311,11 @@
 TypeSpecType == DeclSpec::TST_enum) {
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
+<< AL << GetDiagnosticTypeSpecifierIDWithAttrs(TypeSpecType,DS);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+<< AL << GetDiagnosticTypeSpecifierIDWithAttrs(TypeSpecType,DS);
+}
   }
 
   return TagD;
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3421,7 +3421,7 @@
   InGroup;
 def warn_declspec_attribute_ignored : Warning<
   "attribute %0 is ignored, place it after "
-  "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
+  "\"%select{class|struct|interface|union|enum|enum class}1\" to apply 
attribute to "
   "type declaration">, InGroup;
 def warn_attribute_precede_definition : Warning<
   "attribute declaration must precede definition">,
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -193,6 +193,8 @@
 
 Bug Fixes to Attribute Support
 ^^
+- Fixed a bug where attribute annotations on type specifiers (enums, classes, 
structs, unions, and scoped enums) were not properly ignored, resulting in 
misleading warning messages. Now, such attribute annotations are correctly 
ignored.
+(`#61660 `_)
 
 Bug Fixes to C++ Support
 


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -5043,7 +5043,18 @@
 llvm_unreachable("unexpected type specifier");
   }
 }
-
+static unsigned GetDiagnosticTypeSpecifierIDWithAttrs(DeclSpec::TST T, const DeclSpec ){
+  if (T == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+  return 5;
+}
+  }
+  else{
+return GetDiagnosticTypeSpecifierID(T);
+  }
+  return 0;
+}
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
 /// no declarator (e.g. "struct foo;") is parsed. It also accepts template
 /// parameters to cope with template friend declarations.
@@ -5300,11 +5311,11 @@
 TypeSpecType == DeclSpec::TST_enum) {
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
+<< AL << GetDiagnosticTypeSpecifierIDWithAttrs(TypeSpecType,DS);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+<< AL << GetDiagnosticTypeSpecifierIDWithAttrs(TypeSpecType,DS);
+}
   }
 
   return TagD;
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3421,7 +3421,7 @@
   InGroup;
 def warn_declspec_attribute_ignored : Warning<
   "attribute %0 is ignored, place it after "
-  "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
+  "\"%select{class|struct|interface|union|enum|enum 

[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-11 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 added a comment.

In D147989#4257721 , @aaron.ballman 
wrote:

> Thank you for working on this!
>
> The changes are missing test coverage; please be sure to add that, along with 
> a release note about the fix. I think there's likely more work to be done 
> here as well, considering this behavior: https://godbolt.org/z/sdK3Gef75 
> (notice the suggested location for the fix-it -- that also needs to be fixed 
> for this)

Thanks for reviewing. I am working on tests now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-11 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 512421.
ipriyanshi1708 added a comment.

Removed the spurious whitespace changes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/DeclSpec.h
  clang/lib/Sema/SemaDecl.cpp


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -5043,7 +5043,18 @@
 llvm_unreachable("unexpected type specifier");
   }
 }
-
+static unsigned GetDiagnosticTypeSpecifierIDWithAttrs(DeclSpec::TST T, const 
DeclSpec ){
+  if (T == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+  return 5;
+}
+  }
+  else{
+return GetDiagnosticTypeSpecifierID(T);
+  }
+  return 0;
+}
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
 /// no declarator (e.g. "struct foo;") is parsed. It also accepts template
 /// parameters to cope with template friend declarations.
@@ -5300,11 +5311,11 @@
 TypeSpecType == DeclSpec::TST_enum) {
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
+<< AL << GetDiagnosticTypeSpecifierIDWithAttrs(TypeSpecType,DS);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+<< AL << GetDiagnosticTypeSpecifierIDWithAttrs(TypeSpecType,DS);
+}
   }
 
   return TagD;
Index: clang/include/clang/Sema/DeclSpec.h
===
--- clang/include/clang/Sema/DeclSpec.h
+++ clang/include/clang/Sema/DeclSpec.h
@@ -271,7 +271,7 @@
 TSC_imaginary,
 TSC_complex
   };
-
+  
   // Import type specifier type enumeration and constants.
   typedef TypeSpecifierType TST;
   static const TST TST_unspecified = clang::TST_unspecified;
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3421,7 +3421,7 @@
   InGroup;
 def warn_declspec_attribute_ignored : Warning<
   "attribute %0 is ignored, place it after "
-  "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
+  "\"%select{class|struct|interface|union|enum|enum class}1\" to apply 
attribute to "
   "type declaration">, InGroup;
 def warn_attribute_precede_definition : Warning<
   "attribute declaration must precede definition">,


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -5043,7 +5043,18 @@
 llvm_unreachable("unexpected type specifier");
   }
 }
-
+static unsigned GetDiagnosticTypeSpecifierIDWithAttrs(DeclSpec::TST T, const DeclSpec ){
+  if (T == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+  return 5;
+}
+  }
+  else{
+return GetDiagnosticTypeSpecifierID(T);
+  }
+  return 0;
+}
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
 /// no declarator (e.g. "struct foo;") is parsed. It also accepts template
 /// parameters to cope with template friend declarations.
@@ -5300,11 +5311,11 @@
 TypeSpecType == DeclSpec::TST_enum) {
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
+<< AL << GetDiagnosticTypeSpecifierIDWithAttrs(TypeSpecType,DS);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+<< AL << GetDiagnosticTypeSpecifierIDWithAttrs(TypeSpecType,DS);
+}
   }
 
   return TagD;
Index: clang/include/clang/Sema/DeclSpec.h
===
--- clang/include/clang/Sema/DeclSpec.h
+++ clang/include/clang/Sema/DeclSpec.h
@@ -271,7 +271,7 @@
 TSC_imaginary,
 TSC_complex
   };
-
+  
   // Import type specifier type enumeration and constants.
   typedef TypeSpecifierType TST;
   static const TST TST_unspecified = clang::TST_unspecified;
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3421,7 +3421,7 @@
   

[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-11 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 512419.
ipriyanshi1708 added a comment.

Implemented the required changes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/DeclSpec.h
  clang/lib/Sema/SemaDecl.cpp


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -55,7 +55,6 @@
 
 using namespace clang;
 using namespace sema;
-
 Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType) {
   if (OwnedType) {
 Decl *Group[2] = { OwnedType, Ptr };
@@ -5043,7 +5042,18 @@
 llvm_unreachable("unexpected type specifier");
   }
 }
-
+static unsigned GetDiagnosticTypeSpecifierIDWithAttrs(DeclSpec::TST T, const 
DeclSpec ){
+  if (T == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+  return 5;
+}
+  }
+  else{
+return GetDiagnosticTypeSpecifierID(T);
+  }
+  return 0;
+}
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
 /// no declarator (e.g. "struct foo;") is parsed. It also accepts template
 /// parameters to cope with template friend declarations.
@@ -5300,11 +5310,11 @@
 TypeSpecType == DeclSpec::TST_enum) {
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
+<< AL << GetDiagnosticTypeSpecifierIDWithAttrs(TypeSpecType,DS);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+<< AL << GetDiagnosticTypeSpecifierIDWithAttrs(TypeSpecType,DS);
+}
   }
 
   return TagD;
Index: clang/include/clang/Sema/DeclSpec.h
===
--- clang/include/clang/Sema/DeclSpec.h
+++ clang/include/clang/Sema/DeclSpec.h
@@ -271,7 +271,6 @@
 TSC_imaginary,
 TSC_complex
   };
-
   // Import type specifier type enumeration and constants.
   typedef TypeSpecifierType TST;
   static const TST TST_unspecified = clang::TST_unspecified;
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3421,7 +3421,7 @@
   InGroup;
 def warn_declspec_attribute_ignored : Warning<
   "attribute %0 is ignored, place it after "
-  "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
+  "\"%select{class|struct|interface|union|enum|enum class}1\" to apply 
attribute to "
   "type declaration">, InGroup;
 def warn_attribute_precede_definition : Warning<
   "attribute declaration must precede definition">,


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -55,7 +55,6 @@
 
 using namespace clang;
 using namespace sema;
-
 Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType) {
   if (OwnedType) {
 Decl *Group[2] = { OwnedType, Ptr };
@@ -5043,7 +5042,18 @@
 llvm_unreachable("unexpected type specifier");
   }
 }
-
+static unsigned GetDiagnosticTypeSpecifierIDWithAttrs(DeclSpec::TST T, const DeclSpec ){
+  if (T == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+  return 5;
+}
+  }
+  else{
+return GetDiagnosticTypeSpecifierID(T);
+  }
+  return 0;
+}
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
 /// no declarator (e.g. "struct foo;") is parsed. It also accepts template
 /// parameters to cope with template friend declarations.
@@ -5300,11 +5310,11 @@
 TypeSpecType == DeclSpec::TST_enum) {
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
+<< AL << GetDiagnosticTypeSpecifierIDWithAttrs(TypeSpecType,DS);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
-<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+<< AL << GetDiagnosticTypeSpecifierIDWithAttrs(TypeSpecType,DS);
+}
   }
 
   return TagD;
Index: clang/include/clang/Sema/DeclSpec.h
===
--- clang/include/clang/Sema/DeclSpec.h
+++ clang/include/clang/Sema/DeclSpec.h
@@ -271,7 +271,6 @@
 TSC_imaginary,
 TSC_complex
   };
-
   // 

[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-11 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 512349.
ipriyanshi1708 edited the summary of this revision.
ipriyanshi1708 added a comment.

Updated the summary


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/DeclSpec.h
  clang/lib/Sema/SemaDecl.cpp


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -55,7 +55,7 @@
 
 using namespace clang;
 using namespace sema;
-
+bool isEnumClass = false;
 Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType) {
   if (OwnedType) {
 Decl *Group[2] = { OwnedType, Ptr };
@@ -5028,6 +5028,9 @@
 }
 
 static unsigned GetDiagnosticTypeSpecifierID(DeclSpec::TST T) {
+  if (isEnumClass) {
+return 5;
+  }else{
   switch (T) {
   case DeclSpec::TST_class:
 return 0;
@@ -5042,6 +5045,7 @@
   default:
 llvm_unreachable("unexpected type specifier");
   }
+  }
 }
 
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
@@ -5298,13 +5302,19 @@
 TypeSpecType == DeclSpec::TST_interface ||
 TypeSpecType == DeclSpec::TST_union ||
 TypeSpecType == DeclSpec::TST_enum) {
+   if (TypeSpecType == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+isEnumClass = true;
+}
+  }
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+}
   }
 
   return TagD;
Index: clang/include/clang/Sema/DeclSpec.h
===
--- clang/include/clang/Sema/DeclSpec.h
+++ clang/include/clang/Sema/DeclSpec.h
@@ -271,7 +271,6 @@
 TSC_imaginary,
 TSC_complex
   };
-
   // Import type specifier type enumeration and constants.
   typedef TypeSpecifierType TST;
   static const TST TST_unspecified = clang::TST_unspecified;
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3421,7 +3421,7 @@
   InGroup;
 def warn_declspec_attribute_ignored : Warning<
   "attribute %0 is ignored, place it after "
-  "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
+  "\"%select{class|struct|interface|union|enum|enum class}1\" to apply 
attribute to "
   "type declaration">, InGroup;
 def warn_attribute_precede_definition : Warning<
   "attribute declaration must precede definition">,


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -55,7 +55,7 @@
 
 using namespace clang;
 using namespace sema;
-
+bool isEnumClass = false;
 Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType) {
   if (OwnedType) {
 Decl *Group[2] = { OwnedType, Ptr };
@@ -5028,6 +5028,9 @@
 }
 
 static unsigned GetDiagnosticTypeSpecifierID(DeclSpec::TST T) {
+  if (isEnumClass) {
+return 5;
+  }else{
   switch (T) {
   case DeclSpec::TST_class:
 return 0;
@@ -5042,6 +5045,7 @@
   default:
 llvm_unreachable("unexpected type specifier");
   }
+  }
 }
 
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
@@ -5298,13 +5302,19 @@
 TypeSpecType == DeclSpec::TST_interface ||
 TypeSpecType == DeclSpec::TST_union ||
 TypeSpecType == DeclSpec::TST_enum) {
+   if (TypeSpecType == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+isEnumClass = true;
+}
+  }
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+}
   }
 
   return TagD;
Index: clang/include/clang/Sema/DeclSpec.h
===
--- clang/include/clang/Sema/DeclSpec.h
+++ clang/include/clang/Sema/DeclSpec.h
@@ -271,7 +271,6 @@
 TSC_imaginary,
 TSC_complex
   };
-
   // Import type specifier type enumeration and constants.
   typedef TypeSpecifierType TST;
   

[PATCH] D147989: [clang] Fix Attribute Placement

2023-04-11 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 512344.
ipriyanshi1708 retitled this revision from "Fix Attribute Placememt" to 
"[clang] Fix Attribute Placement".
ipriyanshi1708 added a comment.

Updated the title


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/DeclSpec.h
  clang/lib/Sema/SemaDecl.cpp


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -55,7 +55,7 @@
 
 using namespace clang;
 using namespace sema;
-
+bool isEnumClass = false;
 Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType) {
   if (OwnedType) {
 Decl *Group[2] = { OwnedType, Ptr };
@@ -5028,6 +5028,9 @@
 }
 
 static unsigned GetDiagnosticTypeSpecifierID(DeclSpec::TST T) {
+  if (isEnumClass) {
+return 5;
+  }else{
   switch (T) {
   case DeclSpec::TST_class:
 return 0;
@@ -5042,6 +5045,7 @@
   default:
 llvm_unreachable("unexpected type specifier");
   }
+  }
 }
 
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
@@ -5298,13 +5302,19 @@
 TypeSpecType == DeclSpec::TST_interface ||
 TypeSpecType == DeclSpec::TST_union ||
 TypeSpecType == DeclSpec::TST_enum) {
+   if (TypeSpecType == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+isEnumClass = true;
+}
+  }
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+}
   }
 
   return TagD;
Index: clang/include/clang/Sema/DeclSpec.h
===
--- clang/include/clang/Sema/DeclSpec.h
+++ clang/include/clang/Sema/DeclSpec.h
@@ -271,7 +271,6 @@
 TSC_imaginary,
 TSC_complex
   };
-
   // Import type specifier type enumeration and constants.
   typedef TypeSpecifierType TST;
   static const TST TST_unspecified = clang::TST_unspecified;
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3421,7 +3421,7 @@
   InGroup;
 def warn_declspec_attribute_ignored : Warning<
   "attribute %0 is ignored, place it after "
-  "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
+  "\"%select{class|struct|interface|union|enum|enum class}1\" to apply 
attribute to "
   "type declaration">, InGroup;
 def warn_attribute_precede_definition : Warning<
   "attribute declaration must precede definition">,


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -55,7 +55,7 @@
 
 using namespace clang;
 using namespace sema;
-
+bool isEnumClass = false;
 Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType) {
   if (OwnedType) {
 Decl *Group[2] = { OwnedType, Ptr };
@@ -5028,6 +5028,9 @@
 }
 
 static unsigned GetDiagnosticTypeSpecifierID(DeclSpec::TST T) {
+  if (isEnumClass) {
+return 5;
+  }else{
   switch (T) {
   case DeclSpec::TST_class:
 return 0;
@@ -5042,6 +5045,7 @@
   default:
 llvm_unreachable("unexpected type specifier");
   }
+  }
 }
 
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
@@ -5298,13 +5302,19 @@
 TypeSpecType == DeclSpec::TST_interface ||
 TypeSpecType == DeclSpec::TST_union ||
 TypeSpecType == DeclSpec::TST_enum) {
+   if (TypeSpecType == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+isEnumClass = true;
+}
+  }
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+}
   }
 
   return TagD;
Index: clang/include/clang/Sema/DeclSpec.h
===
--- clang/include/clang/Sema/DeclSpec.h
+++ clang/include/clang/Sema/DeclSpec.h
@@ -271,7 +271,6 @@
 TSC_imaginary,
 TSC_complex
   };
-
   // Import type specifier type enumeration 

[PATCH] D147989: Fix Attribute Placememt

2023-04-11 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 512343.
ipriyanshi1708 added a comment.

Removed extra lines


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/DeclSpec.h
  clang/lib/Sema/SemaDecl.cpp


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -55,7 +55,7 @@
 
 using namespace clang;
 using namespace sema;
-
+bool isEnumClass = false;
 Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType) {
   if (OwnedType) {
 Decl *Group[2] = { OwnedType, Ptr };
@@ -5028,6 +5028,9 @@
 }
 
 static unsigned GetDiagnosticTypeSpecifierID(DeclSpec::TST T) {
+  if (isEnumClass) {
+return 5;
+  }else{
   switch (T) {
   case DeclSpec::TST_class:
 return 0;
@@ -5042,6 +5045,7 @@
   default:
 llvm_unreachable("unexpected type specifier");
   }
+  }
 }
 
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
@@ -5298,13 +5302,19 @@
 TypeSpecType == DeclSpec::TST_interface ||
 TypeSpecType == DeclSpec::TST_union ||
 TypeSpecType == DeclSpec::TST_enum) {
+   if (TypeSpecType == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+isEnumClass = true;
+}
+  }
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+}
   }
 
   return TagD;
Index: clang/include/clang/Sema/DeclSpec.h
===
--- clang/include/clang/Sema/DeclSpec.h
+++ clang/include/clang/Sema/DeclSpec.h
@@ -271,7 +271,6 @@
 TSC_imaginary,
 TSC_complex
   };
-
   // Import type specifier type enumeration and constants.
   typedef TypeSpecifierType TST;
   static const TST TST_unspecified = clang::TST_unspecified;
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3421,7 +3421,7 @@
   InGroup;
 def warn_declspec_attribute_ignored : Warning<
   "attribute %0 is ignored, place it after "
-  "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
+  "\"%select{class|struct|interface|union|enum|enum class}1\" to apply 
attribute to "
   "type declaration">, InGroup;
 def warn_attribute_precede_definition : Warning<
   "attribute declaration must precede definition">,


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -55,7 +55,7 @@
 
 using namespace clang;
 using namespace sema;
-
+bool isEnumClass = false;
 Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType) {
   if (OwnedType) {
 Decl *Group[2] = { OwnedType, Ptr };
@@ -5028,6 +5028,9 @@
 }
 
 static unsigned GetDiagnosticTypeSpecifierID(DeclSpec::TST T) {
+  if (isEnumClass) {
+return 5;
+  }else{
   switch (T) {
   case DeclSpec::TST_class:
 return 0;
@@ -5042,6 +5045,7 @@
   default:
 llvm_unreachable("unexpected type specifier");
   }
+  }
 }
 
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
@@ -5298,13 +5302,19 @@
 TypeSpecType == DeclSpec::TST_interface ||
 TypeSpecType == DeclSpec::TST_union ||
 TypeSpecType == DeclSpec::TST_enum) {
+   if (TypeSpecType == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+isEnumClass = true;
+}
+  }
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+}
   }
 
   return TagD;
Index: clang/include/clang/Sema/DeclSpec.h
===
--- clang/include/clang/Sema/DeclSpec.h
+++ clang/include/clang/Sema/DeclSpec.h
@@ -271,7 +271,6 @@
 TSC_imaginary,
 TSC_complex
   };
-
   // Import type specifier type enumeration and constants.
   typedef TypeSpecifierType TST;
   static const TST TST_unspecified = 

[PATCH] D147989: Fix Attribute Placememt

2023-04-10 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 512340.
ipriyanshi1708 added a comment.



1. Updating D147989 : Fix Attribute Placememt 
#
2. Enter a brief description of the changes included in this update.

Fixes https://github.com/llvm/llvm-project/issues/61660


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147989

Files:
  clang/lib/Sema/SemaDecl.cpp


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -5314,7 +5314,6 @@
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-
 }
   }
 


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -5314,7 +5314,6 @@
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-
 }
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147989: Fix Attribute Placememt

2023-04-10 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 created this revision.
Herald added a project: All.
ipriyanshi1708 added a reviewer: samtebbs.
ipriyanshi1708 published this revision for review.
Herald added a project: clang.

Fixed the error message for attribute placement. Earlier it was showing 'place 
it after "enum"' but it should be 'place it after "enum class"' which I have 
fixed in this patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147989

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/DeclSpec.h
  clang/lib/Sema/SemaDecl.cpp


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -55,7 +55,7 @@
 
 using namespace clang;
 using namespace sema;
-
+bool isEnumClass = false;
 Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType) {
   if (OwnedType) {
 Decl *Group[2] = { OwnedType, Ptr };
@@ -5028,6 +5028,9 @@
 }
 
 static unsigned GetDiagnosticTypeSpecifierID(DeclSpec::TST T) {
+  if (isEnumClass) {
+return 5;
+  }else{
   switch (T) {
   case DeclSpec::TST_class:
 return 0;
@@ -5042,6 +5045,7 @@
   default:
 llvm_unreachable("unexpected type specifier");
   }
+  }
 }
 
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
@@ -5298,13 +5302,20 @@
 TypeSpecType == DeclSpec::TST_interface ||
 TypeSpecType == DeclSpec::TST_union ||
 TypeSpecType == DeclSpec::TST_enum) {
+   if (TypeSpecType == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+isEnumClass = true;
+}
+  }
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+
+}
   }
 
   return TagD;
Index: clang/include/clang/Sema/DeclSpec.h
===
--- clang/include/clang/Sema/DeclSpec.h
+++ clang/include/clang/Sema/DeclSpec.h
@@ -271,7 +271,6 @@
 TSC_imaginary,
 TSC_complex
   };
-
   // Import type specifier type enumeration and constants.
   typedef TypeSpecifierType TST;
   static const TST TST_unspecified = clang::TST_unspecified;
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3421,7 +3421,7 @@
   InGroup;
 def warn_declspec_attribute_ignored : Warning<
   "attribute %0 is ignored, place it after "
-  "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
+  "\"%select{class|struct|interface|union|enum|enum class}1\" to apply 
attribute to "
   "type declaration">, InGroup;
 def warn_attribute_precede_definition : Warning<
   "attribute declaration must precede definition">,


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -55,7 +55,7 @@
 
 using namespace clang;
 using namespace sema;
-
+bool isEnumClass = false;
 Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType) {
   if (OwnedType) {
 Decl *Group[2] = { OwnedType, Ptr };
@@ -5028,6 +5028,9 @@
 }
 
 static unsigned GetDiagnosticTypeSpecifierID(DeclSpec::TST T) {
+  if (isEnumClass) {
+return 5;
+  }else{
   switch (T) {
   case DeclSpec::TST_class:
 return 0;
@@ -5042,6 +5045,7 @@
   default:
 llvm_unreachable("unexpected type specifier");
   }
+  }
 }
 
 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
@@ -5298,13 +5302,20 @@
 TypeSpecType == DeclSpec::TST_interface ||
 TypeSpecType == DeclSpec::TST_union ||
 TypeSpecType == DeclSpec::TST_enum) {
+   if (TypeSpecType == DeclSpec::TST_enum) {
+if (const EnumDecl *ED = dyn_cast(DS.getRepAsDecl())) {
+  if (ED->isScopedUsingClassTag())
+isEnumClass = true;
+}
+  }
   for (const ParsedAttr  : DS.getAttributes())
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
   for (const ParsedAttr  : DeclAttrs)
 Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
 << AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
-}
+
+}
   }
 
   return TagD;
Index: clang/include/clang/Sema/DeclSpec.h
===
--- clang/include/clang/Sema/DeclSpec.h
+++ clang/include/clang/Sema/DeclSpec.h
@@ -271,7 

[PATCH] D147141: [clang][documentation][enhancement]Documented Optimization Flags

2023-03-29 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 created this revision.
Herald added a project: All.
ipriyanshi1708 added reviewers: samtebbs, aaron.ballman.
ipriyanshi1708 published this revision for review.
Herald added a project: clang.

Fixes https://github.com/llvm/llvm-project/issues/53681 . Optimization flags 
are not documented in the Clang documentation. So I have added information 
about Optimization flags in the documentation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147141

Files:
  clang/docs/UsersManual.rst


Index: clang/docs/UsersManual.rst
===
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -2199,6 +2199,41 @@
   link-time optimizations like whole program inter-procedural basic block
   reordering.
 
+Optimization Flags
+--
+
+The optimization flags control the level of optimization that the compiler 
performs on the code. For example, ``-O1`` enables a set of optimizations that 
are designed to improve code performance while still maintaining debugging 
capabilities. ``-Og`` enables optimizations that do not interfere with 
debugging, while ``-Ofast`` enables more aggressive optimizations that may 
sacrifice some debugging capabilities in exchange for maximum performance.
+
+You can use these optimization flags with the Clang compiler by specifying 
them on the command line when invoking the compiler. For example, to compile a 
C++ source file with the ``-O2`` optimization level, you would run the 
following command:
+
+  .. code-block:: console
+
+   $ clang++ -O2 myfile.cpp -o myfile
+
+Here are some common optimization flags with basic descriptions for different 
versions of the Clang compiler:
+
+Clang 3.8 and earlier:
+""
+
+1. ``-O0``: no optimization
+2. ``-O1``: basic optimization, such as function inlining and constant 
propagation
+3. ``-O2``: more aggressive optimization, such as loop unrolling and 
instruction scheduling
+4. ``-O3``: even more aggressive optimization, such as loop vectorization and 
function cloning
+5. ``-Os``: optimize for code size rather than execution speed
+6. ``-Ofast``: enable all optimizations that do not violate strict standards 
compliance
+
+Clang 3.9 and later:
+
+
+1. ``-O0``: no optimization
+2. ``-O1``: basic optimization, such as function inlining and constant 
propagation
+3. ``-O2``: more aggressive optimization, such as loop unrolling and 
instruction scheduling
+4. ``-O3``: even more aggressive optimization, such as loop vectorization and 
function cloning
+5. ``-Os``: optimize for code size rather than execution speed
+6. ``-Ofast``: enable all optimizations that do not violate strict standards 
compliance
+7. ``-Oz``: like -Os, but with more aggressive optimization for code size
+8. ``-Og``: optimize for debuggability, with minimal optimization that does 
not interfere with debugging
+
 Profile Guided Optimization
 ---
 


Index: clang/docs/UsersManual.rst
===
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -2199,6 +2199,41 @@
   link-time optimizations like whole program inter-procedural basic block
   reordering.
 
+Optimization Flags
+--
+
+The optimization flags control the level of optimization that the compiler performs on the code. For example, ``-O1`` enables a set of optimizations that are designed to improve code performance while still maintaining debugging capabilities. ``-Og`` enables optimizations that do not interfere with debugging, while ``-Ofast`` enables more aggressive optimizations that may sacrifice some debugging capabilities in exchange for maximum performance.
+
+You can use these optimization flags with the Clang compiler by specifying them on the command line when invoking the compiler. For example, to compile a C++ source file with the ``-O2`` optimization level, you would run the following command:
+
+  .. code-block:: console
+
+   $ clang++ -O2 myfile.cpp -o myfile
+
+Here are some common optimization flags with basic descriptions for different versions of the Clang compiler:
+
+Clang 3.8 and earlier:
+""
+
+1. ``-O0``: no optimization
+2. ``-O1``: basic optimization, such as function inlining and constant propagation
+3. ``-O2``: more aggressive optimization, such as loop unrolling and instruction scheduling
+4. ``-O3``: even more aggressive optimization, such as loop vectorization and function cloning
+5. ``-Os``: optimize for code size rather than execution speed
+6. ``-Ofast``: enable all optimizations that do not violate strict standards compliance
+
+Clang 3.9 and later:
+
+
+1. ``-O0``: no optimization
+2. ``-O1``: basic optimization, such as function inlining and constant propagation
+3. ``-O2``: more aggressive optimization, such as loop unrolling and instruction scheduling
+4. ``-O3``: even more aggressive 

[PATCH] D146644: [documentation]Fixed Random Typos

2023-03-27 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 added a comment.

Yes, I am OK with that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146644

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146644: [documentation]Fixed Random Typos

2023-03-24 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 added a comment.

Greetings Sir,

Thank you for accepting my revision. Please do commit it as I am
contributing for the first time and I don't have commit access.

Thanks & Regards
Priyanshi Agarwal


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146644

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146644: [documentation]Fixed Random Typos

2023-03-23 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 updated this revision to Diff 507961.
ipriyanshi1708 added a comment.

Fixed one more Typo


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146644

Files:
  llvm/include/llvm/Support/CommandLine.h
  llvm/lib/Support/FileUtilities.cpp
  llvm/test/DebugInfo/macro_link.ll
  llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp


Index: llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
===
--- llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
+++ llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
@@ -7,7 +7,7 @@
 
//===--===//
 //
 // This tool verifies Control Flow Integrity (CFI) instrumentation by static
-// binary anaylsis. See the design document in /docs/CFIVerify.rst for more
+// binary analysis. See the design document in /docs/CFIVerify.rst for more
 // information.
 //
 // This tool is currently incomplete. It currently only does disassembly for
Index: llvm/test/DebugInfo/macro_link.ll
===
--- llvm/test/DebugInfo/macro_link.ll
+++ llvm/test/DebugInfo/macro_link.ll
@@ -1,6 +1,6 @@
 ; RUN: llvm-link %s %s -S -o -| FileCheck %s
 
-; This test checks that DIMacro and DIMacroFile comaprison works correctly.
+; This test checks that DIMacro and DIMacroFile comparison works correctly.
 
 ; CHECK: !llvm.dbg.cu = !{[[CU1:![0-9]*]], [[CU2:![0-9]*]]}
 
Index: llvm/lib/Support/FileUtilities.cpp
===
--- llvm/lib/Support/FileUtilities.cpp
+++ llvm/lib/Support/FileUtilities.cpp
@@ -169,7 +169,7 @@
 
 /// DiffFilesWithTolerance - Compare the two files specified, returning 0 if 
the
 /// files match, 1 if they are different, and 2 if there is a file error.  This
-/// function differs from DiffFiles in that you can specify an absolete and
+/// function differs from DiffFiles in that you can specify an absolute and
 /// relative FP error that is allowed to exist.  If you specify a string to 
fill
 /// in for the error option, it will set the string to an error message if an
 /// error occurs, allowing the caller to distinguish between a failed diff and 
a
Index: llvm/include/llvm/Support/CommandLine.h
===
--- llvm/include/llvm/Support/CommandLine.h
+++ llvm/include/llvm/Support/CommandLine.h
@@ -220,7 +220,7 @@
   static SubCommand ();
 
   // Get the special subcommand that can be used to put an option into all
-  // subcomands.
+  // subcommands.
   static SubCommand ();
 
   void reset();


Index: llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
===
--- llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
+++ llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
@@ -7,7 +7,7 @@
 //===--===//
 //
 // This tool verifies Control Flow Integrity (CFI) instrumentation by static
-// binary anaylsis. See the design document in /docs/CFIVerify.rst for more
+// binary analysis. See the design document in /docs/CFIVerify.rst for more
 // information.
 //
 // This tool is currently incomplete. It currently only does disassembly for
Index: llvm/test/DebugInfo/macro_link.ll
===
--- llvm/test/DebugInfo/macro_link.ll
+++ llvm/test/DebugInfo/macro_link.ll
@@ -1,6 +1,6 @@
 ; RUN: llvm-link %s %s -S -o -| FileCheck %s
 
-; This test checks that DIMacro and DIMacroFile comaprison works correctly.
+; This test checks that DIMacro and DIMacroFile comparison works correctly.
 
 ; CHECK: !llvm.dbg.cu = !{[[CU1:![0-9]*]], [[CU2:![0-9]*]]}
 
Index: llvm/lib/Support/FileUtilities.cpp
===
--- llvm/lib/Support/FileUtilities.cpp
+++ llvm/lib/Support/FileUtilities.cpp
@@ -169,7 +169,7 @@
 
 /// DiffFilesWithTolerance - Compare the two files specified, returning 0 if the
 /// files match, 1 if they are different, and 2 if there is a file error.  This
-/// function differs from DiffFiles in that you can specify an absolete and
+/// function differs from DiffFiles in that you can specify an absolute and
 /// relative FP error that is allowed to exist.  If you specify a string to fill
 /// in for the error option, it will set the string to an error message if an
 /// error occurs, allowing the caller to distinguish between a failed diff and a
Index: llvm/include/llvm/Support/CommandLine.h
===
--- llvm/include/llvm/Support/CommandLine.h
+++ llvm/include/llvm/Support/CommandLine.h
@@ -220,7 +220,7 @@
   static SubCommand ();
 
   // Get the special subcommand that can be used to put an option into all
-  // subcomands.
+  // subcommands.
   static 

[PATCH] D146644: [documentation]Fixed Random Typos

2023-03-22 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
ipriyanshi1708 added reviewers: samtebbs, aaron.ballman.
ipriyanshi1708 published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Fixes https://github.com/llvm/llvm-project/issues/56747


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146644

Files:
  llvm/lib/Support/FileUtilities.cpp
  llvm/test/DebugInfo/macro_link.ll
  llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp


Index: llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
===
--- llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
+++ llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
@@ -7,7 +7,7 @@
 
//===--===//
 //
 // This tool verifies Control Flow Integrity (CFI) instrumentation by static
-// binary anaylsis. See the design document in /docs/CFIVerify.rst for more
+// binary analysis. See the design document in /docs/CFIVerify.rst for more
 // information.
 //
 // This tool is currently incomplete. It currently only does disassembly for
Index: llvm/test/DebugInfo/macro_link.ll
===
--- llvm/test/DebugInfo/macro_link.ll
+++ llvm/test/DebugInfo/macro_link.ll
@@ -1,6 +1,6 @@
 ; RUN: llvm-link %s %s -S -o -| FileCheck %s
 
-; This test checks that DIMacro and DIMacroFile comaprison works correctly.
+; This test checks that DIMacro and DIMacroFile comparison works correctly.
 
 ; CHECK: !llvm.dbg.cu = !{[[CU1:![0-9]*]], [[CU2:![0-9]*]]}
 
Index: llvm/lib/Support/FileUtilities.cpp
===
--- llvm/lib/Support/FileUtilities.cpp
+++ llvm/lib/Support/FileUtilities.cpp
@@ -169,7 +169,7 @@
 
 /// DiffFilesWithTolerance - Compare the two files specified, returning 0 if 
the
 /// files match, 1 if they are different, and 2 if there is a file error.  This
-/// function differs from DiffFiles in that you can specify an absolete and
+/// function differs from DiffFiles in that you can specify an absolute and
 /// relative FP error that is allowed to exist.  If you specify a string to 
fill
 /// in for the error option, it will set the string to an error message if an
 /// error occurs, allowing the caller to distinguish between a failed diff and 
a


Index: llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
===
--- llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
+++ llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
@@ -7,7 +7,7 @@
 //===--===//
 //
 // This tool verifies Control Flow Integrity (CFI) instrumentation by static
-// binary anaylsis. See the design document in /docs/CFIVerify.rst for more
+// binary analysis. See the design document in /docs/CFIVerify.rst for more
 // information.
 //
 // This tool is currently incomplete. It currently only does disassembly for
Index: llvm/test/DebugInfo/macro_link.ll
===
--- llvm/test/DebugInfo/macro_link.ll
+++ llvm/test/DebugInfo/macro_link.ll
@@ -1,6 +1,6 @@
 ; RUN: llvm-link %s %s -S -o -| FileCheck %s
 
-; This test checks that DIMacro and DIMacroFile comaprison works correctly.
+; This test checks that DIMacro and DIMacroFile comparison works correctly.
 
 ; CHECK: !llvm.dbg.cu = !{[[CU1:![0-9]*]], [[CU2:![0-9]*]]}
 
Index: llvm/lib/Support/FileUtilities.cpp
===
--- llvm/lib/Support/FileUtilities.cpp
+++ llvm/lib/Support/FileUtilities.cpp
@@ -169,7 +169,7 @@
 
 /// DiffFilesWithTolerance - Compare the two files specified, returning 0 if the
 /// files match, 1 if they are different, and 2 if there is a file error.  This
-/// function differs from DiffFiles in that you can specify an absolete and
+/// function differs from DiffFiles in that you can specify an absolute and
 /// relative FP error that is allowed to exist.  If you specify a string to fill
 /// in for the error option, it will set the string to an error message if an
 /// error occurs, allowing the caller to distinguish between a failed diff and a
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146041: Fix weirdly apologetic diagnostic messages

2023-03-22 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 added a comment.

Hi @AryanGodara , I am an Outreachy applicant. I was also working on this issue 
and also created a patch for this issue i.e., https://reviews.llvm.org/D146530 
. Can we collaborate to solve this issue so that only one patch will be there 
for a issue as told by @aaron.ballman .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146041

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146530: [clang][diagnostics]Removed "sorry" from all the required files

2023-03-22 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 added a comment.

In D146530#4213078 , @aaron.ballman 
wrote:

> In D146530#4213076 , 
> @ipriyanshi1708 wrote:
>
>> In D146530#4213045 , 
>> @aaron.ballman wrote:
>>
>>> This appears to be the same efforts that have been going on in 
>>> https://reviews.llvm.org/D146041. Can you coordinate with @AryanGodara so 
>>> that there's only one patch for this?
>>
>> Hi! I am an Outreachy applicant, firstly how can I coordinate with 
>> @AryanGodara and secondly how will it be counted as my contribution and then 
>> can I record it in my final application? Or I will have to look for some 
>> other issues for Outreachy?
>
> Welcome! You can comment on the other review to see if the author would like 
> to collaborate with you on a solution. We have the ability to land commits 
> with co-author tags (please request it explicitly when someone approves the 
> patch so that the person landing the work knows to do this), so that should 
> get you both the attribution in GitHub that you did the work (no idea if 
> Outreachy has rules around co-authoring though). You might have to look for 
> other issues for Outreachy, depending on what they require.

Ok thanks! I will surely ask him to collaborate.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146530

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146530: [clang][diagnostics]Removed "sorry" from all the required files

2023-03-22 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 added a comment.

In D146530#4213045 , @aaron.ballman 
wrote:

> This appears to be the same efforts that have been going on in 
> https://reviews.llvm.org/D146041. Can you coordinate with @AryanGodara so 
> that there's only one patch for this?

Hi! I am an Outreachy applicant, firstly how can I coordinate with @AryanGodara 
and secondly how will it be counted as my contribution and then can I record it 
in my final application? Or I will have to look for some other issues for 
Outreachy?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146530

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146530: [clang][diagnostics]Removed "sorry" from all the required files

2023-03-21 Thread Priyanshi Agarwal via Phabricator via cfe-commits
ipriyanshi1708 created this revision.
Herald added subscribers: s.egerton, mstorsjo, simoncook, asb, fedor.sergeev, 
krytarowski.
Herald added a reviewer: aaron.ballman.
Herald added a project: All.
ipriyanshi1708 updated this revision to Diff 506994.
ipriyanshi1708 added a comment.
ipriyanshi1708 updated this revision to Diff 506999.
ipriyanshi1708 published this revision for review.
ipriyanshi1708 added a reviewer: samtebbs.
Herald added a project: clang.

Removed wrongly added files


ipriyanshi1708 added a comment.

Readded wrongly removed sorry


Fixes https://github.com/llvm/llvm-project/issues/61256


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146530

Files:
  clang/include/clang/Basic/DiagnosticCommonKinds.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/test/CXX/drs/dr16xx.cpp
  clang/test/Lexer/SourceLocationsOverflow.c
  clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
  clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp

Index: clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp
===
--- clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp
+++ clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp
@@ -8,8 +8,8 @@
 
 // floating-point arguments
 template struct Float {};
-using F1 = Float<1.0f>; // FIXME expected-error {{sorry}}
-using F1 = Float<2.0f / 2>; // FIXME expected-error {{sorry}}
+using F1 = Float<1.0f>; // FIXME expected-error {{}}
+using F1 = Float<2.0f / 2>; // FIXME expected-error {{}}
 
 struct S { int n[3]; } s; // expected-note 1+{{here}}
 union U { int a, b; } u;
@@ -48,12 +48,12 @@
 
 // miscellaneous scalar types
 template<_Complex int> struct ComplexInt {};
-using CI = ComplexInt<1 + 3i>; // FIXME: expected-error {{sorry}}
-using CI = ComplexInt<1 + 3i>; // FIXME: expected-error {{sorry}}
+using CI = ComplexInt<1 + 3i>; // FIXME: expected-error {{}}
+using CI = ComplexInt<1 + 3i>; // FIXME: expected-error {{}}
 
 template<_Complex float> struct ComplexFloat {};
-using CF = ComplexFloat<1.0f + 3.0fi>; // FIXME: expected-error {{sorry}}
-using CF = ComplexFloat<1.0f + 3.0fi>; // FIXME: expected-error {{sorry}}
+using CF = ComplexFloat<1.0f + 3.0fi>; // FIXME: expected-error {{}}
+using CF = ComplexFloat<1.0f + 3.0fi>; // FIXME: expected-error {{}}
 
 namespace ClassNTTP {
   struct A { // expected-note 2{{candidate}}
Index: clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
===
--- clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
+++ clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
@@ -205,9 +205,9 @@
 
 struct Y : X {};
 void type_affects_identity(B<::n>) {}
-void type_affects_identity(B<(int Y::*)::n>) {} // FIXME: expected-error {{sorry}}
+void type_affects_identity(B<(int Y::*)::n>) {} // FIXME: expected-error {{}}
 void type_affects_identity(B<(const int X::*)::n>) {}
-void type_affects_identity(B<(const int Y::*)::n>) {} // FIXME: expected-error {{sorry}}
+void type_affects_identity(B<(const int Y::*)::n>) {} // FIXME: expected-error {{}}
 
 // A case where we need to do auto-deduction, and check whether the
 // resulting dependent types match during partial ordering. These
Index: clang/test/Lexer/SourceLocationsOverflow.c
===
--- clang/test/Lexer/SourceLocationsOverflow.c
+++ clang/test/Lexer/SourceLocationsOverflow.c
@@ -1,6 +1,6 @@
 // RUN: not %clang %s -S -o - 2>&1 | FileCheck %s
 // CHECK: In file included from {{.*}}SourceLocationsOverflow.c
-// CHECK-NEXT: inc1.h{{.*}}: fatal error: sorry, this include generates a translation unit too large for Clang to process.
+// CHECK-NEXT: inc1.h{{.*}}: fatal error: this include generates a translation unit too large for Clang to process.
 // CHECK-NEXT: #include "inc2.h"
 // CHECK-NEXT:  ^
 // CHECK-NEXT: note: 214{{...}}B in local locations, 0B in locations loaded from AST files, for a total of 214{{...}}B (99% of available space)
Index: clang/test/CXX/drs/dr16xx.cpp
===
--- clang/test/CXX/drs/dr16xx.cpp
+++ clang/test/CXX/drs/dr16xx.cpp
@@ -392,7 +392,7 @@
 #if __cplusplus < 201402L
 // expected-note@-2 {{first required here}}
 #else
-// expected-warning-re@-4 {{sorry, lifetime extension {{.*}} not supported}}
+// expected-warning-re@-4 {{lifetime extension {{.*}} not supported}}
 #endif
 
   struct D2 {
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -4986,7 +4986,7 @@
 def err_non_type_template_arg_addr_label_diff : Error<
   "template argument / label address difference / what did you expect?">;
 def err_non_type_template_arg_unsupported : Error<
-  "sorry, non-type template argument of