summaryrefslogtreecommitdiff
path: root/lib/Sema/DeclSpec.cpp
diff options
context:
space:
mode:
authorMalcolm Parsons <malcolm.parsons@gmail.com>2016-11-17 21:00:09 +0000
committerMalcolm Parsons <malcolm.parsons@gmail.com>2016-11-17 21:00:09 +0000
commit6764ec08f42058b32c7160c350a2a3029192b8be (patch)
treecbe604d0539de082b95d486e8981c6b02ede5e2b /lib/Sema/DeclSpec.cpp
parent5b8679eae47a8f9b40692a7ceda1f480f9780efe (diff)
downloadclang-6764ec08f42058b32c7160c350a2a3029192b8be.tar.gz
Fixes for r287241. Use placement new. Apply clang-format.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@287258 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/DeclSpec.cpp')
-rw-r--r--lib/Sema/DeclSpec.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp
index 0f88ed3642..4107977533 100644
--- a/lib/Sema/DeclSpec.cpp
+++ b/lib/Sema/DeclSpec.cpp
@@ -223,15 +223,11 @@ DeclaratorChunk DeclaratorChunk::getFunction(bool hasProto,
if (!TheDeclarator.InlineStorageUsed &&
NumParams <= llvm::array_lengthof(TheDeclarator.InlineParams)) {
I.Fun.Params = TheDeclarator.InlineParams;
- // Zero the memory block so that unique pointers are initialized
- // properly.
- memset(I.Fun.Params, 0, sizeof(Params[0]) * NumParams);
+ new (I.Fun.Params) ParamInfo[NumParams];
I.Fun.DeleteParams = false;
TheDeclarator.InlineStorageUsed = true;
} else {
- // Call the version of new that zeroes memory so that unique pointers
- // are initialized properly.
- I.Fun.Params = new DeclaratorChunk::ParamInfo[NumParams]();
+ I.Fun.Params = new DeclaratorChunk::ParamInfo[NumParams];
I.Fun.DeleteParams = true;
}
for (unsigned i = 0; i < NumParams; i++)