This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGc75b2261a0aa: [analyzer] Introduce common bug category "Unused code". (authored by dergachev.a). Herald added a project: clang.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98741/new/ https://reviews.llvm.org/D98741 Files: clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp clang/lib/StaticAnalyzer/Core/CommonBugCategories.cpp clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist clang/test/Analysis/Inputs/expected-plists/objc-arc.m.plist clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist
Index: clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist =================================================================== --- clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist +++ clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist @@ -2169,7 +2169,7 @@ </dict> </array> <key>description</key><string>Value stored to 'foo' during its initialization is never read</string> - <key>category</key><string>Dead store</string> + <key>category</key><string>Unused code</string> <key>type</key><string>Dead initialization</string> <key>check_name</key><string>deadcode.DeadStores</string> <!-- This hash is experimental and going to change! --> @@ -5654,7 +5654,7 @@ </dict> </array> <key>description</key><string>Value stored to 'x' is never read</string> - <key>category</key><string>Dead store</string> + <key>category</key><string>Unused code</string> <key>type</key><string>Dead increment</string> <key>check_name</key><string>deadcode.DeadStores</string> <!-- This hash is experimental and going to change! --> Index: clang/test/Analysis/Inputs/expected-plists/objc-arc.m.plist =================================================================== --- clang/test/Analysis/Inputs/expected-plists/objc-arc.m.plist +++ clang/test/Analysis/Inputs/expected-plists/objc-arc.m.plist @@ -382,7 +382,7 @@ </dict> </array> <key>description</key><string>Value stored to 'x' during its initialization is never read</string> - <key>category</key><string>Dead store</string> + <key>category</key><string>Unused code</string> <key>type</key><string>Dead initialization</string> <key>check_name</key><string>deadcode.DeadStores</string> <!-- This hash is experimental and going to change! --> @@ -450,7 +450,7 @@ </dict> </array> <key>description</key><string>Value stored to 'obj1' during its initialization is never read</string> - <key>category</key><string>Dead store</string> + <key>category</key><string>Unused code</string> <key>type</key><string>Dead initialization</string> <key>check_name</key><string>deadcode.DeadStores</string> <!-- This hash is experimental and going to change! --> @@ -518,7 +518,7 @@ </dict> </array> <key>description</key><string>Value stored to 'obj4' during its initialization is never read</string> - <key>category</key><string>Dead store</string> + <key>category</key><string>Unused code</string> <key>type</key><string>Dead initialization</string> <key>check_name</key><string>deadcode.DeadStores</string> <!-- This hash is experimental and going to change! --> @@ -586,7 +586,7 @@ </dict> </array> <key>description</key><string>Value stored to 'obj5' during its initialization is never read</string> - <key>category</key><string>Dead store</string> + <key>category</key><string>Unused code</string> <key>type</key><string>Dead initialization</string> <key>check_name</key><string>deadcode.DeadStores</string> <!-- This hash is experimental and going to change! --> @@ -654,7 +654,7 @@ </dict> </array> <key>description</key><string>Value stored to 'obj6' during its initialization is never read</string> - <key>category</key><string>Dead store</string> + <key>category</key><string>Unused code</string> <key>type</key><string>Dead initialization</string> <key>check_name</key><string>deadcode.DeadStores</string> <!-- This hash is experimental and going to change! --> @@ -1064,7 +1064,7 @@ </dict> </array> <key>description</key><string>Value stored to 'cf1' during its initialization is never read</string> - <key>category</key><string>Dead store</string> + <key>category</key><string>Unused code</string> <key>type</key><string>Dead initialization</string> <key>check_name</key><string>deadcode.DeadStores</string> <!-- This hash is experimental and going to change! --> @@ -1132,7 +1132,7 @@ </dict> </array> <key>description</key><string>Value stored to 'cf2' during its initialization is never read</string> - <key>category</key><string>Dead store</string> + <key>category</key><string>Unused code</string> <key>type</key><string>Dead initialization</string> <key>check_name</key><string>deadcode.DeadStores</string> <!-- This hash is experimental and going to change! --> @@ -1200,7 +1200,7 @@ </dict> </array> <key>description</key><string>Value stored to 'cf3' during its initialization is never read</string> - <key>category</key><string>Dead store</string> + <key>category</key><string>Unused code</string> <key>type</key><string>Dead initialization</string> <key>check_name</key><string>deadcode.DeadStores</string> <!-- This hash is experimental and going to change! --> @@ -1268,7 +1268,7 @@ </dict> </array> <key>description</key><string>Value stored to 'cf4' during its initialization is never read</string> - <key>category</key><string>Dead store</string> + <key>category</key><string>Unused code</string> <key>type</key><string>Dead initialization</string> <key>check_name</key><string>deadcode.DeadStores</string> <!-- This hash is experimental and going to change! --> Index: clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist =================================================================== --- clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist +++ clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist @@ -2368,7 +2368,7 @@ </dict> </array> <key>description</key><string>Value stored to 'x' is never read</string> - <key>category</key><string>Dead store</string> + <key>category</key><string>Unused code</string> <key>type</key><string>Dead increment</string> <key>check_name</key><string>deadcode.DeadStores</string> <!-- This hash is experimental and going to change! --> @@ -11409,7 +11409,7 @@ </dict> </array> <key>description</key><string>Value stored to 'foo' during its initialization is never read</string> - <key>category</key><string>Dead store</string> + <key>category</key><string>Unused code</string> <key>type</key><string>Dead initialization</string> <key>check_name</key><string>deadcode.DeadStores</string> <!-- This hash is experimental and going to change! --> Index: clang/lib/StaticAnalyzer/Core/CommonBugCategories.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/CommonBugCategories.cpp +++ clang/lib/StaticAnalyzer/Core/CommonBugCategories.cpp @@ -22,6 +22,7 @@ const char *const CXXObjectLifecycle = "C++ object lifecycle"; const char *const CXXMoveSemantics = "C++ move semantics"; const char *const SecurityError = "Security error"; +const char *const UnusedCode = "Unused code"; } // namespace categories } // namespace ento } // namespace clang Index: clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp =================================================================== --- clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp +++ clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp @@ -169,7 +169,7 @@ if (SM.isInSystemHeader(SL) || SM.isInExternCSystemHeader(SL)) continue; - B.EmitBasicReport(D, this, "Unreachable code", "Dead code", + B.EmitBasicReport(D, this, "Unreachable code", categories::UnusedCode, "This statement is never executed", DL, SR); } } Index: clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp =================================================================== --- clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp +++ clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp @@ -260,8 +260,8 @@ break; } - BR.EmitBasicReport(AC->getDecl(), Checker, BugType, "Dead store", os.str(), - L, R, Fixits); + BR.EmitBasicReport(AC->getDecl(), Checker, BugType, categories::UnusedCode, + os.str(), L, R, Fixits); } void CheckVarDecl(const VarDecl *VD, const Expr *Ex, const Expr *Val, Index: clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h =================================================================== --- clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h +++ clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h @@ -21,6 +21,7 @@ extern const char *const CXXObjectLifecycle; extern const char *const CXXMoveSemantics; extern const char *const SecurityError; +extern const char *const UnusedCode; } // namespace categories } // namespace ento } // namespace clang
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits