[clang] a4fbae2 - Revert "[Sema] check PseudoObject when rebuilding CXXOperatorCallExpr in template instantiation"
Jeroen Dobbelaere via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 1 02:20:03 PST 2021
Author: Jeroen Dobbelaere
Date: 2021-12-01T11:18:30+01:00
New Revision: a4fbae268f67a6737b86c47f555f95a4a44462d2
URL: https://github.com/llvm/llvm-project/commit/a4fbae268f67a6737b86c47f555f95a4a44462d2
DIFF: https://github.com/llvm/llvm-project/commit/a4fbae268f67a6737b86c47f555f95a4a44462d2.diff
LOG: Revert "[Sema] check PseudoObject when rebuilding CXXOperatorCallExpr in template instantiation"
This reverts commit 0c047a8e13320fb8e9dabbf7a3c6a00fe81198c7.
A number of buildbots started failing. Reverting for now.
Added:
Modified:
clang/lib/Sema/TreeTransform.h
clang/test/SemaObjCXX/instantiate-property-access.mm
Removed:
clang/test/SemaCXX/PR51855.cpp
################################################################################
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 152feac4041c4..7f3326c13263f 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -14630,28 +14630,18 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
Expr *Callee = OrigCallee->IgnoreParenCasts();
bool isPostIncDec = Second && (Op == OO_PlusPlus || Op == OO_MinusMinus);
- if (const BuiltinType *pty = First->getType()->getAsPlaceholderType()) {
- if (Second && !isPostIncDec) {
- BinaryOperatorKind Opc = BinaryOperator::getOverloadedOpcode(Op);
- if (pty->getKind() == BuiltinType::PseudoObject &&
- BinaryOperator::isAssignmentOp(Opc))
- return SemaRef.checkPseudoObjectAssignment(/*Scope=*/nullptr, OpLoc,
- Opc, First, Second);
- } else {
- UnaryOperatorKind Opc =
- UnaryOperator::getOverloadedOpcode(Op, isPostIncDec);
- if (pty->getKind() == BuiltinType::PseudoObject &&
- UnaryOperator::isIncrementDecrementOp(Opc))
- return SemaRef.checkPseudoObjectIncDec(/*Scope=*/nullptr, OpLoc, Opc,
- First);
- }
+ if (First->getObjectKind() == OK_ObjCProperty) {
+ BinaryOperatorKind Opc = BinaryOperator::getOverloadedOpcode(Op);
+ if (BinaryOperator::isAssignmentOp(Opc))
+ return SemaRef.checkPseudoObjectAssignment(/*Scope=*/nullptr, OpLoc, Opc,
+ First, Second);
ExprResult Result = SemaRef.CheckPlaceholderExpr(First);
if (Result.isInvalid())
return ExprError();
First = Result.get();
}
- if (Second && Second->getType()->isPlaceholderType()) {
+ if (Second && Second->getObjectKind() == OK_ObjCProperty) {
ExprResult Result = SemaRef.CheckPlaceholderExpr(Second);
if (Result.isInvalid())
return ExprError();
diff --git a/clang/test/SemaCXX/PR51855.cpp b/clang/test/SemaCXX/PR51855.cpp
deleted file mode 100644
index 6ace3bf085aa5..0000000000000
--- a/clang/test/SemaCXX/PR51855.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-// RUN: %clang_cc1 -S -triple %itanium_abi_triple -fms-extensions -emit-llvm %s -o - | FileCheck %s
-
-struct F {};
-
-F operator*=(F &lhs, int rhs);
-
-F operator++(F &lhs);
-
-struct S {
- short _m;
- S(short _m) : _m(_m) {}
-
- void putM(short rhs) { _m = rhs; }
- short getM() { return _m; }
-
- __declspec(property(get = getM, put = putM)) short theData;
-};
-
-int test1a(int i) {
- S tmp(i);
- tmp.theData *= 2;
- return tmp.theData;
-}
-
-// CHECK-LABEL: define {{.*}} @_Z6test1ai(
-// CHECK: call {{.*}} @_ZN1SC1Es(
-// CHECK: call {{.*}} @_ZN1S4getMEv(
-// CHECK: call {{.*}} @_ZN1S4putMEs(
-// CHECK: call {{.*}} @_ZN1S4getMEv(
-
-template <typename T>
-int test1b(int i) {
- T tmp(i);
- tmp.theData *= 2;
- return tmp.theData;
-}
-
-template int test1b<S>(int);
-
-// CHECK-LABEL: define {{.*}} @_Z6test1bI1SEii(
-// CHECK: call {{.*}} @_ZN1SC1Es(
-// CHECK: call {{.*}} @_ZN1S4getMEv(
-// CHECK: call {{.*}} @_ZN1S4putMEs(
-// CHECK: call {{.*}} @_ZN1S4getMEv(
-
-int test2a(int i) {
- S tmp(i);
- ++tmp.theData;
- return tmp.theData;
-}
-
-// CHECK-LABEL: define {{.*}} i32 @_Z6test2ai(
-// CHECK: call {{.*}} @_ZN1SC1Es(
-// CHECK: call {{.*}} @_ZN1S4getMEv(
-// CHECK: call {{.*}} @_ZN1S4putMEs(
-// CHECK: call {{.*}} @_ZN1S4getMEv(
-
-template <typename T>
-int test2b(int i) {
- T tmp(i);
- ++tmp.theData;
- return tmp.theData;
-}
-
-template int test2b<S>(int);
-
-// CHECK-LABEL: define {{.*}} i32 @_Z6test2bI1SEii(
-// CHECK: call void @_ZN1SC1Es(
-// CHECK: call {{.*}} @_ZN1S4getMEv(
-// CHECK: call {{.*}} @_ZN1S4putMEs(
-// CHECK: call {{.*}} @_ZN1S4getMEv(
diff --git a/clang/test/SemaObjCXX/instantiate-property-access.mm b/clang/test/SemaObjCXX/instantiate-property-access.mm
index e792825facf46..8d5c201a80a19 100644
--- a/clang/test/SemaObjCXX/instantiate-property-access.mm
+++ b/clang/test/SemaObjCXX/instantiate-property-access.mm
@@ -1,5 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fsyntax-only -DDEPENDENT -verify %s
// expected-no-diagnostics
class C {};
@@ -10,10 +9,6 @@
C operator += (C c1, C c2);
-C operator++(C c1);
-
-bool operator!(C c1);
-
enum TextureType { TextureType3D };
@interface Texture
@@ -21,13 +16,9 @@ @interface Texture
@property C c;
@end
-template <typename T> class Framebuffer {
+template <typename> class Framebuffer {
public:
-#ifdef DEPENDENT
- T **color_attachment;
-#else
- Texture **color_attachment;
-#endif
+ Texture **color_attachment;
Framebuffer();
};
@@ -37,15 +28,8 @@ @interface Texture
(void)(color_attachment[0].c == color_attachment[0].c);
(void)(color_attachment[0].c == 1);
(void)(1 == color_attachment[0].c);
- (void)(!color_attachment[0].textureType);
- ++color_attachment[0].textureType;
- (void)(!color_attachment[0].c);
}
void foo() {
-#ifdef DEPENDENT
- Framebuffer<Texture>();
-#else
Framebuffer<int>();
-#endif
}
More information about the cfe-commits
mailing list