r268453 - [scan-build] fix dead store warnings emitted on clang code base

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Tue May 3 15:14:14 PDT 2016


Author: dblaikie
Date: Tue May  3 17:14:14 2016
New Revision: 268453

URL: http://llvm.org/viewvc/llvm-project?rev=268453&view=rev
Log:
[scan-build] fix dead store warnings emitted on clang code base

This fixes dead store warnings of the type "dead assignment" reported
by CLang Static Analyzer on the following file:

- tools/c-index-test/c-index-test.c.

Patch by Apelete Seketeli <apelete at seketeli.net>!

Differential Revision: http://reviews.llvm.org/D19831

Modified:
    cfe/trunk/tools/c-index-test/c-index-test.c

Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=268453&r1=268452&r2=268453&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Tue May  3 17:14:14 2016
@@ -1432,10 +1432,10 @@ static enum CXChildVisitResult PrintType
     CXString FieldSpelling = clang_getCursorSpelling(cursor);
     const char *FieldName = clang_getCString(FieldSpelling);
     /* recurse to get the first parent record that is not anonymous. */
-    CXCursor Parent, Record;
     unsigned RecordIsAnonymous = 0;
     if (clang_getCursorKind(cursor) == CXCursor_FieldDecl) {
-      Record = Parent = p;
+      CXCursor Record;
+      CXCursor Parent = p;
       do {
         Record = Parent;
         Parent = clang_getCursorSemanticParent(Record);




More information about the cfe-commits mailing list