From a6394d0440382ed03a5ce89f6a5655bbca845ceb Mon Sep 17 00:00:00 2001 From: David Greene Date: Tue, 15 Jan 2013 22:09:39 +0000 Subject: Fix Cast Code Eliminate a cast and resulting cast-qual warning by using a temporary as the target of memcpy. llvm-svn: 172557 --- clang/lib/Sema/DeclSpec.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'clang/lib') diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp index a81c0093bb7..fa63c2af38f 100644 --- a/clang/lib/Sema/DeclSpec.cpp +++ b/clang/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; -- cgit v1.2.3