summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorAmy Huang <akhuang@google.com>2019-10-24 16:34:25 -0700
committerAmy Huang <akhuang@google.com>2019-12-18 10:41:12 -0800
commita85f5efd9597d0036f5c347b362cb873bdf51f16 (patch)
tree7f7d265febf1c6d8d113922c95c3c855722c3c24 /clang/lib/Sema/SemaOverload.cpp
parenteb1857ce0da481caf82271e6d0c9fc745dfab26f (diff)
downloadbcm5719-llvm-a85f5efd9597d0036f5c347b362cb873bdf51f16.tar.gz
bcm5719-llvm-a85f5efd9597d0036f5c347b362cb873bdf51f16.zip
Add support for the MS qualifiers __ptr32, __ptr64, __sptr, __uptr.
Summary: This adds parsing of the qualifiers __ptr32, __ptr64, __sptr, and __uptr and lowers them to the corresponding address space pointer for 32-bit and 64-bit pointers. (32/64-bit pointers added in https://reviews.llvm.org/D69639) A large part of this patch is making these pointers ignore the address space when doing things like overloading and casting. https://bugs.llvm.org/show_bug.cgi?id=42359 Reviewers: rnk, rsmith Subscribers: jholewinski, jvesely, nhaehnle, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71039
Diffstat (limited to 'clang/lib/Sema/SemaOverload.cpp')
-rw-r--r--clang/lib/Sema/SemaOverload.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 32541d6b944..22f1a087ca2 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -2933,8 +2933,12 @@ bool Sema::FunctionParamTypesAreEqual(const FunctionProtoType *OldType,
N = NewType->param_type_begin(),
E = OldType->param_type_end();
O && (O != E); ++O, ++N) {
- if (!Context.hasSameType(O->getUnqualifiedType(),
- N->getUnqualifiedType())) {
+ // Ignore address spaces in pointee type. This is to disallow overloading
+ // on __ptr32/__ptr64 address spaces.
+ QualType Old = Context.removePtrSizeAddrSpace(O->getUnqualifiedType());
+ QualType New = Context.removePtrSizeAddrSpace(N->getUnqualifiedType());
+
+ if (!Context.hasSameType(Old, New)) {
if (ArgPos)
*ArgPos = O - OldType->param_type_begin();
return false;
OpenPOWER on IntegriCloud