summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorAnastasia Stulova <anastasia.stulova@arm.com>2019-03-19 16:50:21 +0000
committerAnastasia Stulova <anastasia.stulova@arm.com>2019-03-19 16:50:21 +0000
commit32be13ac51be3fffbc4a5888a989c2073e002885 (patch)
tree68753ba7ed47713d222f6ad765a7c23568a9522b /lib/Sema/SemaOverload.cpp
parenteaba54eacac4dc55ecd5a5bd8b32d3cc679542e6 (diff)
downloadclang-32be13ac51be3fffbc4a5888a989c2073e002885.tar.gz
[Sema] Adjust addr space of reference operand in compound assignment
When we create overloads for the builtin compound assignment operators we need to preserve address space for the reference operand taking it from the argument that is passed in. Differential Revision: https://reviews.llvm.org/D59367 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@356475 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r--lib/Sema/SemaOverload.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 284642b976..2409acd44f 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -8513,17 +8513,16 @@ public:
Right < LastPromotedArithmeticType; ++Right) {
QualType ParamTypes[2];
ParamTypes[1] = ArithmeticTypes[Right];
-
+ auto LeftBaseTy = AdjustAddressSpaceForBuiltinOperandType(
+ S, ArithmeticTypes[Left], Args[0]);
// Add this built-in operator as a candidate (VQ is empty).
- ParamTypes[0] =
- S.Context.getLValueReferenceType(ArithmeticTypes[Left]);
+ ParamTypes[0] = S.Context.getLValueReferenceType(LeftBaseTy);
S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet,
/*IsAssigmentOperator=*/isEqualOp);
// Add this built-in operator as a candidate (VQ is 'volatile').
if (VisibleTypeConversionsQuals.hasVolatile()) {
- ParamTypes[0] =
- S.Context.getVolatileType(ArithmeticTypes[Left]);
+ ParamTypes[0] = S.Context.getVolatileType(LeftBaseTy);
ParamTypes[0] = S.Context.getLValueReferenceType(ParamTypes[0]);
S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet,
/*IsAssigmentOperator=*/isEqualOp);
@@ -8579,15 +8578,14 @@ public:
Right < LastPromotedIntegralType; ++Right) {
QualType ParamTypes[2];
ParamTypes[1] = ArithmeticTypes[Right];
-
+ auto LeftBaseTy = AdjustAddressSpaceForBuiltinOperandType(
+ S, ArithmeticTypes[Left], Args[0]);
// Add this built-in operator as a candidate (VQ is empty).
- ParamTypes[0] = S.Context.getLValueReferenceType(
- AdjustAddressSpaceForBuiltinOperandType(S, ArithmeticTypes[Left],
- Args[0]));
+ ParamTypes[0] = S.Context.getLValueReferenceType(LeftBaseTy);
S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet);
if (VisibleTypeConversionsQuals.hasVolatile()) {
// Add this built-in operator as a candidate (VQ is 'volatile').
- ParamTypes[0] = ArithmeticTypes[Left];
+ ParamTypes[0] = LeftBaseTy;
ParamTypes[0] = S.Context.getVolatileType(ParamTypes[0]);
ParamTypes[0] = S.Context.getLValueReferenceType(ParamTypes[0]);
S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet);