[cfe-commits] r172557 - /cfe/trunk/lib/Sema/DeclSpec.cpp
David Greene
greened at obbligato.org
Tue Jan 15 14:09:39 PST 2013
Author: greened
Date: Tue Jan 15 16:09:39 2013
New Revision: 172557
URL: http://llvm.org/viewvc/llvm-project?rev=172557&view=rev
Log:
Fix Cast Code
Eliminate a cast and resulting cast-qual warning by using a temporary
as the target of memcpy.
Modified:
cfe/trunk/lib/Sema/DeclSpec.cpp
Modified: cfe/trunk/lib/Sema/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=172557&r1=172556&r2=172557&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Tue Jan 15 16:09:39 2013
@@ -772,9 +772,10 @@
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;
More information about the cfe-commits
mailing list