[clang] 86e50af - [AST] Print fixed enum type regardless of language mode

Erik Pilkington via cfe-commits cfe-commits at lists.llvm.org
Tue May 5 12:30:57 PDT 2020


Author: Erik Pilkington
Date: 2020-05-05T15:30:39-04:00
New Revision: 86e50af72d0a0f5cddd2cb487681709eda7934e8

URL: https://github.com/llvm/llvm-project/commit/86e50af72d0a0f5cddd2cb487681709eda7934e8
DIFF: https://github.com/llvm/llvm-project/commit/86e50af72d0a0f5cddd2cb487681709eda7934e8.diff

LOG: [AST] Print fixed enum type regardless of language mode

These are permitted in all language modes, not just C++11.

Added: 
    

Modified: 
    clang/lib/AST/DeclPrinter.cpp
    clang/test/AST/ast-print-enum-decl.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index 706452fcc4a7..fc2a166e11b4 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -532,7 +532,7 @@ void DeclPrinter::VisitEnumDecl(EnumDecl *D) {
 
   Out << ' ' << *D;
 
-  if (D->isFixed() && D->getASTContext().getLangOpts().CPlusPlus11)
+  if (D->isFixed())
     Out << " : " << D->getIntegerType().stream(Policy);
 
   if (D->isCompleteDefinition()) {

diff  --git a/clang/test/AST/ast-print-enum-decl.c b/clang/test/AST/ast-print-enum-decl.c
index fba931344285..0e2a8ed7d8e5 100644
--- a/clang/test/AST/ast-print-enum-decl.c
+++ b/clang/test/AST/ast-print-enum-decl.c
@@ -103,3 +103,8 @@ struct DeclGroupInMemberList {
   enum T2 { T20 } *p1, *p2;
   // PRINT-NEXT: };
 };
+
+enum fixedEnum : int { fixedEnumerator };
+// PRINT-LABEL: enum fixedEnum : int {
+// PRINT-NEXT: fixedEnumerator
+// PRINT-NEXT: };


        


More information about the cfe-commits mailing list