Implement C++1y sized deallocation (n3778). This is not enabled by -std=c++1y;
instead, it's enabled by the -cc1 flag -fsized-deallocation, until we sort out
the backward-compatibility issues.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191629 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 587b18e..57bf94c 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -2310,8 +2310,11 @@
return true;
// Otherwise, we're looking for a second parameter whose type is
- // 'const std::nothrow_t &'.
+ // 'const std::nothrow_t &', or, in C++1y, 'std::size_t'.
QualType Ty = FPT->getArgType(1);
+ ASTContext &Ctx = getASTContext();
+ if (Ctx.getLangOpts().SizedDeallocation && Ty == Ctx.getSizeType())
+ return true;
if (!Ty->isReferenceType())
return false;
Ty = Ty->getPointeeType();