forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Reapply "[Clang][Sema] Earlier type checking for builtin unar…
…y operators (llvm#90500)" (llvm#92283)" This reverts commit 1595988. rdar://131028403 Conflicts: clang/docs/ReleaseNotes.rst
- Loading branch information
Showing
17 changed files
with
263 additions
and
598 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,139 +1,41 @@ | ||
// RUN: %clang_cc1 -std=c++17 -Wno-unused -ast-dump %s -ast-dump-filter Test | FileCheck %s | ||
// RUN: %clang_cc1 -std=c++17 -ast-dump %s -ast-dump-filter Test | FileCheck %s | ||
|
||
namespace Test { | ||
template<typename T, typename U> | ||
void Unary(T t, T* pt, T U::* mpt, T(&ft)(), T(&at)[4]) { | ||
// CHECK: UnaryOperator {{.*}} '<dependent type>' lvalue prefix '*' cannot overflow | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T' lvalue ParmVar {{.*}} 't' 'T' | ||
*t; | ||
struct A{}; | ||
|
||
// CHECK: UnaryOperator {{.*}} '<dependent type>' prefix '+' cannot overflow | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T' lvalue ParmVar {{.*}} 't' 'T' | ||
+t; | ||
template <typename T, typename U> | ||
auto Test(T* pt, U* pu) { | ||
// CHECK: UnaryOperator {{.*}} '<dependent type>' lvalue prefix '*' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
(void)*pt; | ||
|
||
// CHECK: UnaryOperator {{.*}} '<dependent type>' prefix '-' cannot overflow | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T' lvalue ParmVar {{.*}} 't' 'T' | ||
-t; | ||
// CHECK: UnaryOperator {{.*}} '<dependent type>' lvalue prefix '++' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
(void)(++pt); | ||
|
||
// CHECK: UnaryOperator {{.*}} '<dependent type>' prefix '!' cannot overflow | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T' lvalue ParmVar {{.*}} 't' 'T' | ||
!t; | ||
// CHECK: UnaryOperator {{.*}} '<dependent type>' prefix '+' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
(void)(+pt); | ||
|
||
// CHECK: UnaryOperator {{.*}} '<dependent type>' prefix '~' cannot overflow | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T' lvalue ParmVar {{.*}} 't' 'T' | ||
~t; | ||
// CHECK: BinaryOperator {{.*}} '<dependent type>' '+' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 3 | ||
(void)(pt + 3); | ||
|
||
// CHECK: UnaryOperator {{.*}} '<dependent type>' prefix '&' cannot overflow | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T' lvalue ParmVar {{.*}} 't' 'T' | ||
&t; | ||
// CHECK: BinaryOperator {{.*}} '<dependent type>' '-' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
(void)(pt - pt); | ||
|
||
// CHECK: UnaryOperator {{.*}} '<dependent type>' lvalue prefix '++' cannot overflow | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T' lvalue ParmVar {{.*}} 't' 'T' | ||
++t; | ||
// CHECK: BinaryOperator {{.*}} '<dependent type>' '-' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'U *' lvalue ParmVar {{.*}} 'pu' 'U *' | ||
(void)(pt - pu); | ||
|
||
// CHECK: UnaryOperator {{.*}} '<dependent type>' lvalue prefix '--' cannot overflow | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T' lvalue ParmVar {{.*}} 't' 'T' | ||
--t; | ||
// CHECK: BinaryOperator {{.*}} '<dependent type>' '==' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'U *' lvalue ParmVar {{.*}} 'pu' 'U *' | ||
(void)(pt == pu); | ||
|
||
// CHECK: UnaryOperator {{.*}} 'T' lvalue prefix '*' cannot overflow | ||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'T *' <LValueToRValue> | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
*pt; | ||
} | ||
|
||
// CHECK: UnaryOperator {{.*}} 'T *' prefix '+' cannot overflow | ||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'T *' <LValueToRValue> | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
+pt; | ||
|
||
// CHECK: UnaryOperator {{.*}} 'bool' prefix '!' cannot overflow | ||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'bool' <PointerToBoolean> | ||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'T *' <LValueToRValue> | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
!pt; | ||
|
||
// CHECK: UnaryOperator {{.*}} '<dependent type>' prefix '&' cannot overflow | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
&pt; | ||
|
||
// CHECK: UnaryOperator {{.*}} 'T *' lvalue prefix '++' cannot overflow | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
++pt; | ||
|
||
// CHECK: UnaryOperator {{.*}} 'T *' lvalue prefix '--' cannot overflow | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
--pt; | ||
|
||
// CHECK: UnaryOperator {{.*}} 'bool' prefix '!' cannot overflow | ||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'bool' <MemberPointerToBoolean> | ||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'T U::*' <LValueToRValue> | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T U::*' lvalue ParmVar {{.*}} 'mpt' 'T U::*' | ||
!mpt; | ||
|
||
// CHECK: UnaryOperator {{.*}} '<dependent type>' prefix '&' cannot overflow | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T U::*' lvalue ParmVar {{.*}} 'mpt' 'T U::*' | ||
&mpt; | ||
|
||
// CHECK: UnaryOperator {{.*}} 'T ()' lvalue prefix '*' cannot overflow | ||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'T (*)()' <FunctionToPointerDecay> | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T ()' lvalue ParmVar {{.*}} 'ft' 'T (&)()' | ||
*ft; | ||
|
||
// CHECK: UnaryOperator {{.*}} 'T (*)()' prefix '+' cannot overflow | ||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'T (*)()' <FunctionToPointerDecay> | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T ()' lvalue ParmVar {{.*}} 'ft' 'T (&)()' | ||
+ft; | ||
|
||
// CHECK: UnaryOperator {{.*}} 'bool' prefix '!' cannot overflow | ||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'bool' <PointerToBoolean> | ||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'T (*)()' <FunctionToPointerDecay> | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T ()' lvalue ParmVar {{.*}} 'ft' 'T (&)()' | ||
!ft; | ||
|
||
// CHECK: UnaryOperator {{.*}} '<dependent type>' prefix '&' cannot overflow | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T ()' lvalue ParmVar {{.*}} 'ft' 'T (&)()' | ||
&ft; | ||
|
||
// CHECK: UnaryOperator {{.*}} 'T' lvalue prefix '*' cannot overflow | ||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'T *' <ArrayToPointerDecay> | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T[4]' lvalue ParmVar {{.*}} 'at' 'T (&)[4]' | ||
*at; | ||
|
||
// CHECK: UnaryOperator {{.*}} 'T *' prefix '+' cannot overflow | ||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'T *' <ArrayToPointerDecay> | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T[4]' lvalue ParmVar {{.*}} 'at' 'T (&)[4]' | ||
+at; | ||
|
||
// CHECK: UnaryOperator {{.*}} 'bool' prefix '!' cannot overflow | ||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'bool' <PointerToBoolean> | ||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'T *' <ArrayToPointerDecay> | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T[4]' lvalue ParmVar {{.*}} 'at' 'T (&)[4]' | ||
!at; | ||
|
||
// CHECK: UnaryOperator {{.*}} '<dependent type>' prefix '&' cannot overflow | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T[4]' lvalue ParmVar {{.*}} 'at' 'T (&)[4]' | ||
&at; | ||
} | ||
|
||
template<typename T, typename U> | ||
void Binary(T* pt, U* pu) { | ||
// CHECK: BinaryOperator {{.*}} '<dependent type>' '+' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 3 | ||
pt + 3; | ||
|
||
// CHECK: BinaryOperator {{.*}} '<dependent type>' '-' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
pt - pt; | ||
|
||
// CHECK: BinaryOperator {{.*}} '<dependent type>' '-' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'U *' lvalue ParmVar {{.*}} 'pu' 'U *' | ||
pt - pu; | ||
|
||
// CHECK: BinaryOperator {{.*}} '<dependent type>' '==' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'T *' lvalue ParmVar {{.*}} 'pt' 'T *' | ||
// CHECK-NEXT: DeclRefExpr {{.*}} 'U *' lvalue ParmVar {{.*}} 'pu' 'U *' | ||
pt == pu; | ||
} | ||
} // namespace Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.