]> granicus.if.org Git - clang/commitdiff
[scan-build] fix dead store warnings emitted on clang code base
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 3 May 2016 22:14:14 +0000 (22:14 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 3 May 2016 22:14:14 +0000 (22:14 +0000)
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@seketeli.net>!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268453 91177308-0d34-0410-b5e6-96231b3b80d8

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

index d0fe84aa08afc379943b5b5212eb74dac0e24348..802140a350fc146cb22f6db30aa69eff423a3a9e 100644 (file)
@@ -1432,10 +1432,10 @@ static enum CXChildVisitResult PrintTypeSize(CXCursor cursor, CXCursor p,
     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);