diff options
author | David Greene <greened@obbligato.org> | 2013-01-15 22:09:39 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2013-01-15 22:09:39 +0000 |
commit | c23e69d761e369bb7ffeef52926ab0442c41670f (patch) | |
tree | 22cceb42072caf4e58a370b53a6f60283344e4f8 /lib/Sema/DeclSpec.cpp | |
parent | 6b716c58565ebd325f3fb989cfa92ed0934db8c5 (diff) |
Fix Cast Code
Eliminate a cast and resulting cast-qual warning by using a temporary
as the target of memcpy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172557 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/DeclSpec.cpp')
-rw-r--r-- | lib/Sema/DeclSpec.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp index a81c0093bb..fa63c2af38 100644 --- a/lib/Sema/DeclSpec.cpp +++ b/lib/Sema/DeclSpec.cpp @@ -772,9 +772,10 @@ void DeclSpec::setProtocolQualifiers(Decl * const *Protos, SourceLocation *ProtoLocs, SourceLocation LAngleLoc) { if (NP == 0) return; - ProtocolQualifiers = new Decl*[NP]; + Decl **ProtoQuals = new Decl*[NP]; + memcpy(ProtoQuals, Protos, sizeof(Decl*)*NP); + ProtocolQualifiers = ProtoQuals; ProtocolLocs = new SourceLocation[NP]; - memcpy((void*)ProtocolQualifiers, Protos, sizeof(Decl*)*NP); memcpy(ProtocolLocs, ProtoLocs, sizeof(SourceLocation)*NP); NumProtocolQualifiers = NP; ProtocolLAngleLoc = LAngleLoc; |