llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/189058.diff


4 Files Affected:

- (modified) clang/lib/AST/ByteCode/Compiler.cpp (+15) 
- (modified) clang/lib/AST/ByteCode/Compiler.h (+2) 
- (modified) clang/test/CodeGenObjC/no-nsconstant-literals.m (+6) 
- (modified) clang/test/CodeGenObjC/objc2-constant-collection-literals.m (+6) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index 4d129a7ccd497..cd591eb487dd1 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -4213,6 +4213,21 @@ bool Compiler<Emitter>::VisitCXXTypeidExpr(const 
CXXTypeidExpr *E) {
   return true;
 }
 
+template <class Emitter>
+bool Compiler<Emitter>::VisitObjCDictionaryLiteral(
+    const ObjCDictionaryLiteral *E) {
+  if (E->isExpressibleAsConstantInitializer())
+    return this->emitDummyPtr(E, E);
+  return this->emitError(E);
+}
+
+template <class Emitter>
+bool Compiler<Emitter>::VisitObjCArrayLiteral(const ObjCArrayLiteral *E) {
+  if (E->isExpressibleAsConstantInitializer())
+    return this->emitDummyPtr(E, E);
+  return this->emitError(E);
+}
+
 template <class Emitter>
 bool Compiler<Emitter>::VisitExpressionTraitExpr(const ExpressionTraitExpr *E) 
{
   assert(Ctx.getLangOpts().CPlusPlus);
diff --git a/clang/lib/AST/ByteCode/Compiler.h 
b/clang/lib/AST/ByteCode/Compiler.h
index f867fcc9fcbaa..cd14f72b87f9f 100644
--- a/clang/lib/AST/ByteCode/Compiler.h
+++ b/clang/lib/AST/ByteCode/Compiler.h
@@ -230,6 +230,8 @@ class Compiler : public ConstStmtVisitor<Compiler<Emitter>, 
bool>,
   bool VisitCXXDeleteExpr(const CXXDeleteExpr *E);
   bool VisitBlockExpr(const BlockExpr *E);
   bool VisitCXXTypeidExpr(const CXXTypeidExpr *E);
+  bool VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E);
+  bool VisitObjCArrayLiteral(const ObjCArrayLiteral *E);
 
   // Statements.
   bool visitCompoundStmt(const CompoundStmt *S);
diff --git a/clang/test/CodeGenObjC/no-nsconstant-literals.m 
b/clang/test/CodeGenObjC/no-nsconstant-literals.m
index 8a10869f48528..e41e866070a38 100644
--- a/clang/test/CodeGenObjC/no-nsconstant-literals.m
+++ b/clang/test/CodeGenObjC/no-nsconstant-literals.m
@@ -1,9 +1,15 @@
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.14.0 
-fobjc-runtime=macosx-10.14.0 -I %S/Inputs -emit-llvm 
-no-enable-noundef-analysis -o - %s | FileCheck --check-prefix 
CHECK-ALL-DISABLED %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.14.0 
-fobjc-runtime=macosx-10.14.0 -I %S/Inputs -emit-llvm 
-no-enable-noundef-analysis -o - %s -fexperimental-new-constant-interpeter | 
FileCheck --check-prefix CHECK-ALL-DISABLED %s
 
 // RUN: %clang_cc1 -triple x86_64-apple-macosx11.0.0 
-fobjc-runtime=macosx-11.0.0 -fobjc-constant-literals -I %S/Inputs -emit-llvm 
-no-enable-noundef-analysis -o - %s | FileCheck --check-prefix 
CHECK-ALL-DISABLED-CONST-ON %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx11.0.0 
-fobjc-runtime=macosx-11.0.0 -fobjc-constant-literals 
-fconstant-nsarray-literals -fconstant-nsdictionary-literals -I %S/Inputs 
-emit-llvm -no-enable-noundef-analysis -o - %s | FileCheck --check-prefix 
CHECK-NUMBERS-DISABLED %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx11.0.0 
-fobjc-runtime=macosx-11.0.0 -fobjc-constant-literals 
-fconstant-nsnumber-literals -fconstant-nsarray-literals -I %S/Inputs 
-emit-llvm -no-enable-noundef-analysis -o - %s | FileCheck --check-prefix 
CHECK-DICT-DISABLED %s
 
+// RUN: %clang_cc1 -triple x86_64-apple-macosx11.0.0 
-fobjc-runtime=macosx-11.0.0 -fobjc-constant-literals -I %S/Inputs -emit-llvm 
-no-enable-noundef-analysis -o - %s -fexperimental-new-constant-interpreter | 
FileCheck --check-prefix CHECK-ALL-DISABLED-CONST-ON %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx11.0.0 
-fobjc-runtime=macosx-11.0.0 -fobjc-constant-literals 
-fconstant-nsarray-literals -fconstant-nsdictionary-literals -I %S/Inputs 
-emit-llvm -no-enable-noundef-analysis -o - %s 
-fexperimental-new-constant-interpreter | FileCheck --check-prefix 
CHECK-NUMBERS-DISABLED %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx11.0.0 
-fobjc-runtime=macosx-11.0.0 -fobjc-constant-literals 
-fconstant-nsnumber-literals -fconstant-nsarray-literals -I %S/Inputs 
-emit-llvm -no-enable-noundef-analysis -o - %s 
-fexperimental-new-constant-interpreter | FileCheck --check-prefix 
CHECK-DICT-DISABLED %s
+
+
 #if __has_feature(objc_bool)
 #define YES __objc_yes
 #define NO __objc_no
diff --git a/clang/test/CodeGenObjC/objc2-constant-collection-literals.m 
b/clang/test/CodeGenObjC/objc2-constant-collection-literals.m
index acc9004fdad57..272db903d3ebf 100644
--- a/clang/test/CodeGenObjC/objc2-constant-collection-literals.m
+++ b/clang/test/CodeGenObjC/objc2-constant-collection-literals.m
@@ -2,6 +2,12 @@
 // RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-macosx11.0.0 
-fobjc-runtime=macosx-11.0.0 -fobjc-constant-literals 
-fconstant-nsnumber-literals -fconstant-nsarray-literals 
-fconstant-nsdictionary-literals -I %S/Inputs -emit-llvm -o - %s | FileCheck %s 
--check-prefix=CHECK
 // RUN: %clang_cc1 -triple arm64-apple-ios14.0 -fobjc-runtime=ios-14.0 
-fobjc-constant-literals -fconstant-nsnumber-literals 
-fconstant-nsarray-literals -fconstant-nsdictionary-literals -I %S/Inputs 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK
 
+// RUN: %clang_cc1 -triple x86_64-apple-macosx11.0.0 
-fobjc-runtime=macosx-11.0.0 -fobjc-constant-literals 
-fconstant-nsnumber-literals -fconstant-nsarray-literals 
-fconstant-nsdictionary-literals -I %S/Inputs -emit-llvm -o - %s 
-fexperimental-new-constant-interpreter | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-macosx11.0.0 
-fobjc-runtime=macosx-11.0.0 -fobjc-constant-literals 
-fconstant-nsnumber-literals -fconstant-nsarray-literals 
-fconstant-nsdictionary-literals -I %S/Inputs -emit-llvm -o - %s 
-fexperimental-new-constant-interprete r| FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -triple arm64-apple-ios14.0 -fobjc-runtime=ios-14.0 
-fobjc-constant-literals -fconstant-nsnumber-literals 
-fconstant-nsarray-literals -fconstant-nsdictionary-literals -I %S/Inputs 
-emit-llvm -o - %s -fexperimental-new-constant-interpreter | FileCheck %s 
--check-prefix=CHECK
+
+
+
 #if __has_feature(objc_constant_literals)
 
 #if __has_feature(objc_bool)

``````````

</details>


https://github.com/llvm/llvm-project/pull/189058
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to