Author: Benedek Kaibas Date: 2026-11-03T10:51:52+01:00 New Revision: 6e8d1b32c75cacf11e2ebc4f313f1bd672f9a493
URL: https://github.com/llvm/llvm-project/commit/6e8d1b32c75cacf11e2ebc4f313f1bd672f9a493 DIFF: https://github.com/llvm/llvm-project/commit/6e8d1b32c75cacf11e2ebc4f313f1bd672f9a493.diff LOG: [analyzer] Standardize diagnostics that had contained double space after sentence end (#228777) Until now, there was no consensus between using single spaces or double spaces after sentence endings in the emitted diagnostics by the Clang Static Analyzer (CSA). This led to inconsistently formatted diagnostics by the CSA. Currently there are the following cases where the CSA is not consistent with the Clang compiler: - 1: Using double spaces after sentence endings - 2: Using full sentences in diagnostics - 3: Using a capital letter at the start of the diagnostic This PR resolves (1) by removing the double spaces after sentence endings and partially resolves (2) because for the affected lines it also removes the full sentence diagnostics. To uplift downstream tests someone needs to just remove the double spaces in the test suite emitted by the given checkers and convert the multiple sentences into one using ;. This PR was also discussed in the following RFC: https://discourse.llvm.org/t/rfc-standardization-of-reports-sentence-spacing/92428. In a follow up PR I plan to fully resolve (2) as well. Added: Modified: clang/docs/ReleaseNotes.md clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp clang/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp clang/test/Analysis/Inputs/expected-plists/retain-release-path-notes.m.plist clang/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist clang/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist clang/test/Analysis/Inputs/expected-plists/unix-fns.c.plist clang/test/Analysis/const-method-call.cpp clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp clang/test/Analysis/dispatch-once.m clang/test/Analysis/incorrect-checker-names.cpp clang/test/Analysis/retain-release-path-notes.m clang/test/Analysis/security-syntax-checks.m clang/test/Analysis/stack-addr-ps.cpp clang/test/Analysis/stack-capture-leak-no-arc.mm clang/test/Analysis/stackaddrleak.c clang/test/Analysis/stackaddrleak.cpp Removed: ################################################################################ diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md index 7a0169be43980e..78ae18c23c51bc 100644 --- a/clang/docs/ReleaseNotes.md +++ b/clang/docs/ReleaseNotes.md @@ -1459,6 +1459,7 @@ The `alpha.cplusplus.UseAfterLifetimeEnd` checker was renamed to `alpha.core.Use #### Diagnostic changes - For self-assignments during initialization (`T v = v;`), `core.uninitialized.Assign` will not report them as uninitialized accesses (except C++ reference types), and the checks will be delayed until the first accesses of these variables; `deadcode.DeadStores` will not report them as dead stores. (#GH187530) +- The diagnostics of the Clang Static Analyzer no longer have two spaces after a sentence ending (#GH228777). The RFC for this change can be found here: https://discourse.llvm.org/t/rfc-standardization-of-reports-sentence-spacing/92428 (release-notes-sanitizers)= diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp index c8fe5c2ccf384e..88a56de59ea9bb 100644 --- a/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp @@ -56,12 +56,12 @@ static void CompareReturnTypes(const ObjCMethodDecl *MethDerived, << "', defines the instance method '"; MethDerived->getSelector().print(os); os << "' whose return type is '" << ResDerived - << "'. A method with the same name (same selector) is also defined in " + << "'; a method with the same name (same selector) is also defined in " "class '" << *MethAncestor->getClassInterface() << "' and has a return type of '" << ResAncestor - << "'. These two types are incompatible, and may result in undefined " - "behavior for clients of these classes."; + << "'; these two types are incompatible, and may result in undefined " + "behavior for clients of these classes"; PathDiagnosticLocation MethDLoc = PathDiagnosticLocation::createBegin(MethDerived, diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp index 797e1efc7e8ca5..2f4429fd7785a2 100644 --- a/clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp @@ -588,7 +588,7 @@ void WalkAST::checkCall_mktemp(const CallExpr *CE, const FunctionDecl *FD) { "Potential insecure temporary file in call 'mktemp'", "Security", "Call to function 'mktemp' is insecure as it always " - "creates or uses insecure temporary file. Use 'mkstemp' " + "creates or uses insecure temporary file; use 'mkstemp' " "instead", CELoc, CE->getCallee()->getSourceRange()); } @@ -892,8 +892,8 @@ void WalkAST::checkCall_rand(const CallExpr *CE, const FunctionDecl *FD) { SmallString<256> buf2; llvm::raw_svector_ostream os2(buf2); os2 << "Function '" << *FD - << "' is obsolete because it implements a poor random number generator." - << " Use 'arc4random' instead"; + << "' is obsolete because it implements a poor random number generator;" + << " use 'arc4random' instead"; PathDiagnosticLocation CELoc = PathDiagnosticLocation::createBegin(CE, BR.getSourceManager(), AC); @@ -922,8 +922,9 @@ void WalkAST::checkCall_random(const CallExpr *CE, const FunctionDecl *FD) { "'random' is not a secure random number generator", "Security", "The 'random' function produces a sequence of values that " - "an adversary may be able to predict. Use 'arc4random' " - "instead", CELoc, CE->getCallee()->getSourceRange()); + "an adversary may be able to predict; use 'arc4random' " + "instead", + CELoc, CE->getCallee()->getSourceRange()); } //===----------------------------------------------------------------------===// @@ -1064,7 +1065,7 @@ void WalkAST::checkUncheckedReturnValue(CallExpr *CE) { SmallString<256> buf2; llvm::raw_svector_ostream os2(buf2); os2 << "The return value from the call to '" << *FD - << "' is not checked. If an error occurs in '" << *FD + << "' is not checked; if an error occurs in '" << *FD << "', the following code may execute with unexpected privileges"; PathDiagnosticLocation CELoc = diff --git a/clang/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp index d72dc072fd3c67..b5a32ef4d48b66 100644 --- a/clang/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp @@ -125,10 +125,10 @@ void MacOSXAPIChecker::CheckDispatchOnce(CheckerContext &C, const CallExpr *CE, } else { os << " stack allocated memory"; } - os << " for the predicate value. Using such transient memory for " - "the predicate is potentially dangerous."; + os << " for the predicate value; using such transient memory for " + "the predicate is potentially dangerous"; if (SuggestStatic) - os << " Perhaps you intended to declare the variable as 'static'?"; + os << "; perhaps you intended to declare the variable as 'static'?"; ExplodedNode *N = C.addSink(); if (!N) diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp index 59d11c4d8ae2cf..4c7af02283c133 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp @@ -745,8 +745,8 @@ RefLeakReportVisitor::getEndPath(const ExplodedNode *EndN, } else { os << "whose name ('" << MD->getSelector().getAsString() << "') does not start with " - "'copy', 'mutableCopy', 'alloc' or 'new'." - " This violates the naming convention rules" + "'copy', 'mutableCopy', 'alloc' or 'new';" + " violating the naming convention rules" " given in the Memory Management Guide for Cocoa"; } } else { @@ -754,7 +754,7 @@ RefLeakReportVisitor::getEndPath(const ExplodedNode *EndN, ObjKind K = RV->getObjKind(); if (K == ObjKind::ObjC || K == ObjKind::CF) { os << "whose name ('" << *FD - << "') does not contain 'Copy' or 'Create'. This violates the " + << "') does not contain 'Copy' or 'Create'; violating the " "naming convention rules given in the Memory Management Guide " "for Core Foundation"; } else if (RV->getObjKind() == ObjKind::OS) { diff --git a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp index db307d3ac549f6..c188d4cd439b1a 100644 --- a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp @@ -585,7 +585,7 @@ void StackAddrEscapeChecker::checkEndFunction(const ReturnStmt *RS, // Generate a report for this bug. const StringRef CommonSuffix = - " upon returning to the caller. This will be a dangling reference"; + " upon returning to the caller; this will be a dangling reference"; SmallString<128> Buf; llvm::raw_svector_ostream Out(Buf); const SourceRange Range = genName(Out, Referred, Ctx.getASTContext()); diff --git a/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp index f0f9dcbd582503..cbd2f37ea9d107 100644 --- a/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp @@ -432,10 +432,10 @@ void UnixAPIMisuseChecker::CheckPthreadOnce(CheckerContext &C, os << " the local variable '" << VR->getDecl()->getName() << '\''; else os << " stack allocated memory"; - os << " for the \"control\" value. Using such transient memory for " - "the control value is potentially dangerous."; + os << " for the \"control\" value; using such transient memory for " + "the control value is potentially dangerous"; if (isa<VarRegion>(R) && R->hasMemorySpace<StackLocalsSpaceRegion>(state)) - os << " Perhaps you intended to declare the variable as 'static'?"; + os << "; perhaps you intended to declare the variable as 'static'?"; auto report = std::make_unique<PathSensitiveBugReport>(BT_pthreadOnce, os.str(), N); diff --git a/clang/test/Analysis/Inputs/expected-plists/retain-release-path-notes.m.plist b/clang/test/Analysis/Inputs/expected-plists/retain-release-path-notes.m.plist index e9f4f7577649ee..206590ef964984 100644 --- a/clang/test/Analysis/Inputs/expected-plists/retain-release-path-notes.m.plist +++ b/clang/test/Analysis/Inputs/expected-plists/retain-release-path-notes.m.plist @@ -2189,9 +2189,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: object allocated and stored into 'object' is returned from a function whose name ('CFGetRuleViolation') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: object allocated and stored into 'object' is returned from a function whose name ('CFGetRuleViolation') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> <key>message</key> - <string>Object leaked: object allocated and stored into 'object' is returned from a function whose name ('CFGetRuleViolation') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: object allocated and stored into 'object' is returned from a function whose name ('CFGetRuleViolation') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> </dict> </array> <key>description</key><string>Potential leak of an object stored into 'object'</string> @@ -2673,9 +2673,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: object allocated and stored into 'result' is returned from a method whose name ('getViolation') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: object allocated and stored into 'result' is returned from a method whose name ('getViolation') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> <key>message</key> - <string>Object leaked: object allocated and stored into 'result' is returned from a method whose name ('getViolation') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: object allocated and stored into 'result' is returned from a method whose name ('getViolation') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> </dict> </array> <key>description</key><string>Potential leak of an object stored into 'result'</string> diff --git a/clang/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist b/clang/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist index 5c4ea431696f15..647ba33b035745 100644 --- a/clang/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist +++ b/clang/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist @@ -1651,9 +1651,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: object allocated and stored into 'date' is returned from a function whose name ('f7') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: object allocated and stored into 'date' is returned from a function whose name ('f7') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> <key>message</key> - <string>Object leaked: object allocated and stored into 'date' is returned from a function whose name ('f7') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: object allocated and stored into 'date' is returned from a function whose name ('f7') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> </dict> </array> <key>description</key><string>Potential leak of an object stored into 'date'</string> @@ -12124,9 +12124,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name ('NoCopyString') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name ('NoCopyString') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> <key>message</key> - <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name ('NoCopyString') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name ('NoCopyString') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'NSString *'</string> @@ -12209,9 +12209,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name ('noCopyString') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name ('noCopyString') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> <key>message</key> - <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name ('noCopyString') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name ('noCopyString') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'NSString *'</string> @@ -12786,9 +12786,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name (':') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name (':') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> <key>message</key> - <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name (':') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name (':') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'NSString *'</string> @@ -18436,9 +18436,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'CFDateRef' is returned from a method whose name ('alsoReturnsRetained') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'CFDateRef' is returned from a method whose name ('alsoReturnsRetained') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> <key>message</key> - <string>Object leaked: allocated object of type 'CFDateRef' is returned from a method whose name ('alsoReturnsRetained') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'CFDateRef' is returned from a method whose name ('alsoReturnsRetained') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'CFDateRef'</string> @@ -18699,9 +18699,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'CFDateRef' is returned from a method whose name ('alsoReturnsRetainedAsCF') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'CFDateRef' is returned from a method whose name ('alsoReturnsRetainedAsCF') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> <key>message</key> - <string>Object leaked: allocated object of type 'CFDateRef' is returned from a method whose name ('alsoReturnsRetainedAsCF') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'CFDateRef' is returned from a method whose name ('alsoReturnsRetainedAsCF') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'CFDateRef'</string> @@ -19980,9 +19980,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camelcase_createno') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camelcase_createno') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> <key>message</key> - <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camelcase_createno') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camelcase_createno') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'CFMutableArrayRef'</string> @@ -20066,9 +20066,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camelcase_copying') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camelcase_copying') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> <key>message</key> - <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camelcase_copying') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camelcase_copying') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'CFMutableArrayRef'</string> @@ -20152,9 +20152,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camel_creat') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camel_creat') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> <key>message</key> - <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camel_creat') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camel_creat') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'CFMutableArrayRef'</string> @@ -20238,9 +20238,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camel_copymachine') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camel_copymachine') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> <key>message</key> - <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camel_copymachine') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camel_copymachine') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'CFMutableArrayRef'</string> diff --git a/clang/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist b/clang/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist index ccf7849e5fab69..7fab01d665b333 100644 --- a/clang/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist +++ b/clang/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist @@ -1651,9 +1651,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: object allocated and stored into 'date' is returned from a function whose name ('f7') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: object allocated and stored into 'date' is returned from a function whose name ('f7') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> <key>message</key> - <string>Object leaked: object allocated and stored into 'date' is returned from a function whose name ('f7') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: object allocated and stored into 'date' is returned from a function whose name ('f7') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> </dict> </array> <key>description</key><string>Potential leak of an object stored into 'date'</string> @@ -12124,9 +12124,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name ('NoCopyString') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name ('NoCopyString') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> <key>message</key> - <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name ('NoCopyString') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name ('NoCopyString') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'NSString *'</string> @@ -12209,9 +12209,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name ('noCopyString') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name ('noCopyString') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> <key>message</key> - <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name ('noCopyString') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name ('noCopyString') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'NSString *'</string> @@ -12786,9 +12786,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name (':') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name (':') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> <key>message</key> - <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name (':') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'NSString *' is returned from a method whose name (':') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'NSString *'</string> @@ -18505,9 +18505,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'CFDateRef' is returned from a method whose name ('alsoReturnsRetained') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'CFDateRef' is returned from a method whose name ('alsoReturnsRetained') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> <key>message</key> - <string>Object leaked: allocated object of type 'CFDateRef' is returned from a method whose name ('alsoReturnsRetained') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'CFDateRef' is returned from a method whose name ('alsoReturnsRetained') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'CFDateRef'</string> @@ -18768,9 +18768,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'CFDateRef' is returned from a method whose name ('alsoReturnsRetainedAsCF') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'CFDateRef' is returned from a method whose name ('alsoReturnsRetainedAsCF') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> <key>message</key> - <string>Object leaked: allocated object of type 'CFDateRef' is returned from a method whose name ('alsoReturnsRetainedAsCF') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa</string> + <string>Object leaked: allocated object of type 'CFDateRef' is returned from a method whose name ('alsoReturnsRetainedAsCF') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'CFDateRef'</string> @@ -20049,9 +20049,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camelcase_createno') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camelcase_createno') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> <key>message</key> - <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camelcase_createno') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camelcase_createno') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'CFMutableArrayRef'</string> @@ -20135,9 +20135,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camelcase_copying') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camelcase_copying') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> <key>message</key> - <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camelcase_copying') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camelcase_copying') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'CFMutableArrayRef'</string> @@ -20221,9 +20221,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camel_creat') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camel_creat') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> <key>message</key> - <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camel_creat') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camel_creat') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'CFMutableArrayRef'</string> @@ -20307,9 +20307,9 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camel_copymachine') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camel_copymachine') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> <key>message</key> - <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camel_copymachine') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation</string> + <string>Object leaked: allocated object of type 'CFMutableArrayRef' is returned from a function whose name ('camel_copymachine') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation</string> </dict> </array> <key>description</key><string>Potential leak of an object of type 'CFMutableArrayRef'</string> diff --git a/clang/test/Analysis/Inputs/expected-plists/unix-fns.c.plist b/clang/test/Analysis/Inputs/expected-plists/unix-fns.c.plist index d7913cbc338fd0..32a58ac1860f51 100644 --- a/clang/test/Analysis/Inputs/expected-plists/unix-fns.c.plist +++ b/clang/test/Analysis/Inputs/expected-plists/unix-fns.c.plist @@ -551,12 +551,12 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Call to 'dispatch_once' uses the local variable 'pred' for the predicate value. Using such transient memory for the predicate is potentially dangerous. Perhaps you intended to declare the variable as 'static'?</string> + <string>Call to 'dispatch_once' uses the local variable 'pred' for the predicate value; using such transient memory for the predicate is potentially dangerous; perhaps you intended to declare the variable as 'static'?</string> <key>message</key> - <string>Call to 'dispatch_once' uses the local variable 'pred' for the predicate value. Using such transient memory for the predicate is potentially dangerous. Perhaps you intended to declare the variable as 'static'?</string> + <string>Call to 'dispatch_once' uses the local variable 'pred' for the predicate value; using such transient memory for the predicate is potentially dangerous; perhaps you intended to declare the variable as 'static'?</string> </dict> </array> - <key>description</key><string>Call to 'dispatch_once' uses the local variable 'pred' for the predicate value. Using such transient memory for the predicate is potentially dangerous. Perhaps you intended to declare the variable as 'static'?</string> + <key>description</key><string>Call to 'dispatch_once' uses the local variable 'pred' for the predicate value; using such transient memory for the predicate is potentially dangerous; perhaps you intended to declare the variable as 'static'?</string> <key>category</key><string>API Misuse (Apple)</string> <key>type</key><string>Improper use of 'dispatch_once'</string> <key>check_name</key><string>osx.API</string> @@ -643,12 +643,12 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Call to 'pthread_once' uses the local variable 'pred' for the "control" value. Using such transient memory for the control value is potentially dangerous. Perhaps you intended to declare the variable as 'static'?</string> + <string>Call to 'pthread_once' uses the local variable 'pred' for the "control" value; using such transient memory for the control value is potentially dangerous; perhaps you intended to declare the variable as 'static'?</string> <key>message</key> - <string>Call to 'pthread_once' uses the local variable 'pred' for the "control" value. Using such transient memory for the control value is potentially dangerous. Perhaps you intended to declare the variable as 'static'?</string> + <string>Call to 'pthread_once' uses the local variable 'pred' for the "control" value; using such transient memory for the control value is potentially dangerous; perhaps you intended to declare the variable as 'static'?</string> </dict> </array> - <key>description</key><string>Call to 'pthread_once' uses the local variable 'pred' for the "control" value. Using such transient memory for the control value is potentially dangerous. Perhaps you intended to declare the variable as 'static'?</string> + <key>description</key><string>Call to 'pthread_once' uses the local variable 'pred' for the "control" value; using such transient memory for the control value is potentially dangerous; perhaps you intended to declare the variable as 'static'?</string> <key>category</key><string>Unix API</string> <key>type</key><string>Improper use of 'pthread_once'</string> <key>check_name</key><string>unix.API</string> @@ -1463,12 +1463,12 @@ </array> <key>depth</key><integer>0</integer> <key>extended_message</key> - <string>Call to 'dispatch_once' uses the local variable 'pred' for the predicate value. Using such transient memory for the predicate is potentially dangerous. Perhaps you intended to declare the variable as 'static'?</string> + <string>Call to 'dispatch_once' uses the local variable 'pred' for the predicate value; using such transient memory for the predicate is potentially dangerous; perhaps you intended to declare the variable as 'static'?</string> <key>message</key> - <string>Call to 'dispatch_once' uses the local variable 'pred' for the predicate value. Using such transient memory for the predicate is potentially dangerous. Perhaps you intended to declare the variable as 'static'?</string> + <string>Call to 'dispatch_once' uses the local variable 'pred' for the predicate value; using such transient memory for the predicate is potentially dangerous; perhaps you intended to declare the variable as 'static'?</string> </dict> </array> - <key>description</key><string>Call to 'dispatch_once' uses the local variable 'pred' for the predicate value. Using such transient memory for the predicate is potentially dangerous. Perhaps you intended to declare the variable as 'static'?</string> + <key>description</key><string>Call to 'dispatch_once' uses the local variable 'pred' for the predicate value; using such transient memory for the predicate is potentially dangerous; perhaps you intended to declare the variable as 'static'?</string> <key>category</key><string>API Misuse (Apple)</string> <key>type</key><string>Improper use of 'dispatch_once'</string> <key>check_name</key><string>osx.API</string> diff --git a/clang/test/Analysis/const-method-call.cpp b/clang/test/Analysis/const-method-call.cpp index b37ce17447bdd2..3f7b7b93a5507c 100644 --- a/clang/test/Analysis/const-method-call.cpp +++ b/clang/test/Analysis/const-method-call.cpp @@ -314,6 +314,6 @@ template <typename R> class callable<R()> { void entry() { callable<bool()>{}.call().const_method(); - // expected-warning@-1 {{Address of stack memory associated with temporary object of type 'callable<bool ()>' is still referred to by the static variable 'L' upon returning to the caller. This will be a dangling reference}} + // expected-warning@-1 {{Address of stack memory associated with temporary object of type 'callable<bool ()>' is still referred to by the static variable 'L' upon returning to the caller; this will be a dangling reference}} } } // namespace gh77378 diff --git a/clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp b/clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp index fddd6c8c3d6dfc..b5a02bbf59f95d 100644 --- a/clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp +++ b/clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp @@ -86,7 +86,7 @@ struct UntypedAllocaTest { // expected-warning-re@+3 {{Address of stack memory allocated by call to \ alloca() on line {{[0-9]+}} is still referred to by a temporary object on the \ -stack upon returning to the caller. This will be a dangling reference}} +stack upon returning to the caller; this will be a dangling reference}} UntypedAllocaTest() : allocaPtr(__builtin_alloca(sizeof(int))) { // All good! } @@ -104,7 +104,7 @@ struct TypedAllocaTest1 { : allocaPtr(static_cast<int *>(__builtin_alloca(sizeof(int)))) {} // expected-warning-re@-2 {{Address of stack memory allocated by call to \ alloca() on line {{[0-9]+}} is still referred to by a temporary object on the \ -stack upon returning to the caller. This will be a dangling reference}} +stack upon returning to the caller; this will be a dangling reference}} }; void fTypedAllocaTest1() { @@ -117,7 +117,7 @@ struct TypedAllocaTest2 { // expected-warning-re@+5 {{Address of stack memory allocated by call to \ alloca() on line {{[0-9]+}} is still referred to by a temporary object on the \ -stack upon returning to the caller. This will be a dangling reference}} +stack upon returning to the caller; this will be a dangling reference}} TypedAllocaTest2() : allocaPtr(static_cast<int *>(__builtin_alloca(sizeof(int)))) { *allocaPtr = 55555; @@ -370,7 +370,7 @@ class VoidPointerRRefTest1 { public: // expected-warning@+3 {{Address of stack memory associated with local \ variable 'vptr' is still referred to by a temporary object on the stack \ -upon returning to the caller. This will be a dangling reference}} +upon returning to the caller; this will be a dangling reference}} VoidPointerRRefTest1(void *vptr, char) : vptrrref(static_cast<void *&&>(vptr)) { // expected-warning {{binding reference member 'vptrrref' to stack allocated parameter 'vptr'}} // All good! } @@ -388,7 +388,7 @@ class VoidPointerRRefTest2 { public: // expected-warning@+3 {{Address of stack memory associated with local \ variable 'vptr' is still referred to by a temporary object on the stack \ -upon returning to the caller. This will be a dangling reference}} +upon returning to the caller; this will be a dangling reference}} VoidPointerRRefTest2(void **vptr, char) : vpptrrref(static_cast<void **&&>(vptr)) { // expected-warning {{binding reference member 'vpptrrref' to stack allocated parameter 'vptr'}} // All good! } @@ -406,7 +406,7 @@ class VoidPointerLRefTest { public: // expected-warning@+3 {{Address of stack memory associated with local \ variable 'vptr' is still referred to by a temporary object on the stack \ -upon returning to the caller. This will be a dangling reference}} +upon returning to the caller; this will be a dangling reference}} VoidPointerLRefTest(void *vptr, char) : vptrrref(static_cast<void *&>(vptr)) { // expected-warning {{binding reference member 'vptrrref' to stack allocated parameter 'vptr'}} // All good! } diff --git a/clang/test/Analysis/dispatch-once.m b/clang/test/Analysis/dispatch-once.m index fa84f563815dd6..77ec1187c3817b 100644 --- a/clang/test/Analysis/dispatch-once.m +++ b/clang/test/Analysis/dispatch-once.m @@ -21,7 +21,7 @@ void test_stack(void) { dispatch_once_t once; - dispatch_once(&once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the local variable 'once' for the predicate value. Using such transient memory for the predicate is potentially dangerous. Perhaps you intended to declare the variable as 'static'?}} + dispatch_once(&once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the local variable 'once' for the predicate value; using such transient memory for the predicate is potentially dangerous; perhaps you intended to declare the variable as 'static'?}} } void test_static_local(void) { @@ -32,7 +32,7 @@ void test_static_local(void) { void test_heap_var(void) { dispatch_once_t *once = calloc(1, sizeof(dispatch_once_t)); // Use regexps to check that we're NOT suggesting to make this static. - dispatch_once(once, ^{}); // expected-warning-re{{{{^Call to 'dispatch_once' uses heap-allocated memory for the predicate value. Using such transient memory for the predicate is potentially dangerous$}}}} + dispatch_once(once, ^{}); // expected-warning-re{{{{^Call to 'dispatch_once' uses heap-allocated memory for the predicate value; using such transient memory for the predicate is potentially dangerous$}}}} } void test_external_pointer(dispatch_once_t *once) { @@ -46,12 +46,12 @@ void test_external_pointer(dispatch_once_t *once) { void test_local_struct(void) { Struct s; - dispatch_once(&s.once, ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the local variable 's' for the predicate value.}} + dispatch_once(&s.once, ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the local variable 's' for the predicate value;}} } void test_heap_struct(void) { Struct *s = calloc(1, sizeof(Struct)); - dispatch_once(&s->once, ^{}); // expected-warning{{Call to 'dispatch_once' uses heap-allocated memory for the predicate value.}} + dispatch_once(&s->once, ^{}); // expected-warning{{Call to 'dispatch_once' uses heap-allocated memory for the predicate value;}} } @interface Object : NSObject { @@ -66,44 +66,44 @@ - (void)test_ivar_struct_from_inside; @implementation Object - (void)test_ivar_from_inside { - dispatch_once(&once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the instance variable 'once' for the predicate value.}} + dispatch_once(&once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the instance variable 'once' for the predicate value;}} } - (void)test_ivar_struct_from_inside { - dispatch_once(&s.once, ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 's' for the predicate value.}} + dispatch_once(&s.once, ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 's' for the predicate value;}} } - (void)test_ivar_array_from_inside { - dispatch_once(&once_array[1], ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 'once_array' for the predicate value.}} + dispatch_once(&once_array[1], ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 'once_array' for the predicate value;}} } @end void test_ivar_from_alloc_init(void) { Object *o = [[Object alloc] init]; - dispatch_once(&o->once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the instance variable 'once' for the predicate value.}} + dispatch_once(&o->once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the instance variable 'once' for the predicate value;}} } void test_ivar_struct_from_alloc_init(void) { Object *o = [[Object alloc] init]; - dispatch_once(&o->s.once, ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 's' for the predicate value.}} + dispatch_once(&o->s.once, ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 's' for the predicate value;}} } void test_ivar_array_from_alloc_init(void) { Object *o = [[Object alloc] init]; - dispatch_once(&o->once_array[1], ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 'once_array' for the predicate value.}} + dispatch_once(&o->once_array[1], ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 'once_array' for the predicate value;}} } void test_ivar_from_external_obj(Object *o) { // ObjC object pointer always points to the heap. - dispatch_once(&o->once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the instance variable 'once' for the predicate value.}} + dispatch_once(&o->once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the instance variable 'once' for the predicate value;}} } void test_ivar_struct_from_external_obj(Object *o) { - dispatch_once(&o->s.once, ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 's' for the predicate value.}} + dispatch_once(&o->s.once, ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 's' for the predicate value;}} } void test_ivar_array_from_external_obj(Object *o) { - dispatch_once(&o->once_array[1], ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 'once_array' for the predicate value.}} + dispatch_once(&o->once_array[1], ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 'once_array' for the predicate value;}} } void test_block_var_from_block(void) { __block dispatch_once_t once; ^{ - dispatch_once(&once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the block variable 'once' for the predicate value.}} + dispatch_once(&once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the block variable 'once' for the predicate value;}} }; } @@ -114,7 +114,7 @@ void test_block_var_from_outside_block(void) { ^{ use_block_var(&once); }; - dispatch_once(&once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the block variable 'once' for the predicate value.}} + dispatch_once(&once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the block variable 'once' for the predicate value;}} } void test_static_var_from_outside_block(void) { diff --git a/clang/test/Analysis/incorrect-checker-names.cpp b/clang/test/Analysis/incorrect-checker-names.cpp index 8dee0b6f468581..8ada3fd7fa6c2d 100644 --- a/clang/test/Analysis/incorrect-checker-names.cpp +++ b/clang/test/Analysis/incorrect-checker-names.cpp @@ -16,5 +16,5 @@ char const *p; void f0() { char const str[] = "This will change"; p = str; -} // expected-warning@-1{{Address of stack memory associated with local variable 'str' is still referred to by the global variable 'p' upon returning to the caller. This will be a dangling reference [core.StackAddressEscape]}} -// expected-note@-2{{Address of stack memory associated with local variable 'str' is still referred to by the global variable 'p' upon returning to the caller. This will be a dangling reference}} +} // expected-warning@-1{{Address of stack memory associated with local variable 'str' is still referred to by the global variable 'p' upon returning to the caller; this will be a dangling reference [core.StackAddressEscape]}} +// expected-note@-2{{Address of stack memory associated with local variable 'str' is still referred to by the global variable 'p' upon returning to the caller; this will be a dangling reference}} diff --git a/clang/test/Analysis/retain-release-path-notes.m b/clang/test/Analysis/retain-release-path-notes.m index 3c193c1e2bc4fd..a50a1bd313a9e4 100644 --- a/clang/test/Analysis/retain-release-path-notes.m +++ b/clang/test/Analysis/retain-release-path-notes.m @@ -112,7 +112,7 @@ CFTypeRef CFCopyRuleViolation (void) { CFTypeRef CFGetRuleViolation (void) { CFTypeRef object = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type 'CFTypeRef' with a +1 retain count}} - return object; // expected-warning{{leak}} expected-note{{Object leaked: object allocated and stored into 'object' is returned from a function whose name ('CFGetRuleViolation') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation}} + return object; // expected-warning{{leak}} expected-note{{Object leaked: object allocated and stored into 'object' is returned from a function whose name ('CFGetRuleViolation') does not contain 'Copy' or 'Create'; violating the naming convention rules given in the Memory Management Guide for Core Foundation}} } @implementation Foo (FundamentalMemoryManagementRules) @@ -133,7 +133,7 @@ - (id)copyViolationKeyedSubscript { - (id)getViolation { id result = [[Foo alloc] init]; // expected-note{{Method returns an instance of Foo with a +1 retain count}} - return result; // expected-warning{{leak}} expected-note{{Object leaked: object allocated and stored into 'result' is returned from a method whose name ('getViolation') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa}} + return result; // expected-warning{{leak}} expected-note{{Object leaked: object allocated and stored into 'result' is returned from a method whose name ('getViolation') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'; violating the naming convention rules given in the Memory Management Guide for Cocoa}} } - (id)copyAutorelease { diff --git a/clang/test/Analysis/security-syntax-checks.m b/clang/test/Analysis/security-syntax-checks.m index 154f0c1bae427c..678870a23a898b 100644 --- a/clang/test/Analysis/security-syntax-checks.m +++ b/clang/test/Analysis/security-syntax-checks.m @@ -100,8 +100,8 @@ void test_getpw(void) { void test_setuid(void) { - setuid(2); // expected-warning{{The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges}} - setuid(0); // expected-warning{{The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges}} + setuid(2); // expected-warning{{The return value from the call to 'setuid' is not checked; if an error occurs in 'setuid', the following code may execute with unexpected privileges}} + setuid(0); // expected-warning{{The return value from the call to 'setuid' is not checked; if an error occurs in 'setuid', the following code may execute with unexpected privileges}} if (setuid (2) != 0) abort(); @@ -113,8 +113,8 @@ void test_setuid(void) check(setuid (2)); // no-warning - setreuid(2,2); // expected-warning{{The return value from the call to 'setreuid' is not checked. If an error occurs in 'setreuid', the following code may execute with unexpected privileges}} - setregid(2,2); // expected-warning{{The return value from the call to 'setregid' is not checked. If an error occurs in 'setregid', the following code may execute with unexpected privileges}} + setreuid(2,2); // expected-warning{{The return value from the call to 'setreuid' is not checked; if an error occurs in 'setreuid', the following code may execute with unexpected privileges}} + setregid(2,2); // expected-warning{{The return value from the call to 'setregid' is not checked; if an error occurs in 'setregid', the following code may execute with unexpected privileges}} } // CWE-338: Use of cryptographically weak prng @@ -135,16 +135,16 @@ void test_rand(void) unsigned short a[7]; unsigned b; - rand(); // expected-warning{{Function 'rand' is obsolete because it implements a poor random number generator. Use 'arc4random' instead}} - drand48(); // expected-warning{{Function 'drand48' is obsolete because it implements a poor random number generator. Use 'arc4random' instead}} - erand48(a); // expected-warning{{Function 'erand48' is obsolete because it implements a poor random number generator. Use 'arc4random' instead}} - jrand48(a); // expected-warning{{Function 'jrand48' is obsolete because it implements a poor random number generator. Use 'arc4random' instead}} - lcong48(a); // expected-warning{{Function 'lcong48' is obsolete because it implements a poor random number generator. Use 'arc4random' instead}} - lrand48(); // expected-warning{{Function 'lrand48' is obsolete because it implements a poor random number generator. Use 'arc4random' instead}} - mrand48(); // expected-warning{{Function 'mrand48' is obsolete because it implements a poor random number generator. Use 'arc4random' instead}} - nrand48(a); // expected-warning{{Function 'nrand48' is obsolete because it implements a poor random number generator. Use 'arc4random' instead}} - rand_r(&b); // expected-warning{{Function 'rand_r' is obsolete because it implements a poor random number generator. Use 'arc4random' instead}} - random(); // expected-warning{{The 'random' function produces a sequence of values that an adversary may be able to predict. Use 'arc4random' instead}} + rand(); // expected-warning{{Function 'rand' is obsolete because it implements a poor random number generator; use 'arc4random' instead}} + drand48(); // expected-warning{{Function 'drand48' is obsolete because it implements a poor random number generator; use 'arc4random' instead}} + erand48(a); // expected-warning{{Function 'erand48' is obsolete because it implements a poor random number generator; use 'arc4random' instead}} + jrand48(a); // expected-warning{{Function 'jrand48' is obsolete because it implements a poor random number generator; use 'arc4random' instead}} + lcong48(a); // expected-warning{{Function 'lcong48' is obsolete because it implements a poor random number generator; use 'arc4random' instead}} + lrand48(); // expected-warning{{Function 'lrand48' is obsolete because it implements a poor random number generator; use 'arc4random' instead}} + mrand48(); // expected-warning{{Function 'mrand48' is obsolete because it implements a poor random number generator; use 'arc4random' instead}} + nrand48(a); // expected-warning{{Function 'nrand48' is obsolete because it implements a poor random number generator; use 'arc4random' instead}} + rand_r(&b); // expected-warning{{Function 'rand_r' is obsolete because it implements a poor random number generator; use 'arc4random' instead}} + random(); // expected-warning{{The 'random' function produces a sequence of values that an adversary may be able to predict; use 'arc4random' instead}} } char *mktemp(char *buf); diff --git a/clang/test/Analysis/stack-addr-ps.cpp b/clang/test/Analysis/stack-addr-ps.cpp index 0ca7b074143065..5d3465f73bf6dd 100644 --- a/clang/test/Analysis/stack-addr-ps.cpp +++ b/clang/test/Analysis/stack-addr-ps.cpp @@ -373,7 +373,7 @@ void ***param_ptr_to_ptr_to_ptr_return(void ***ppp) { int local = 0; **ppp = &local; return ppp; - // expected-warning@-1 {{Address of stack memory associated with local variable 'local' is still referred to by the caller variable 'ppp' upon returning to the caller. This will be a dangling reference}} + // expected-warning@-1 {{Address of stack memory associated with local variable 'local' is still referred to by the caller variable 'ppp' upon returning to the caller; this will be a dangling reference}} } void param_ptr_to_ptr_to_ptr_caller(void** pp) { @@ -568,7 +568,7 @@ S returned_struct_with_ptr_callee() { int local = 42; S s; s.p = &local; - return s; // expected-warning {{Address of stack memory associated with local variable 'local' returned to caller}} expected-warning{{Address of stack memory associated with local variable 'local' is still referred to by the caller variable 's' upon returning to the caller. This will be a dangling reference}} + return s; // expected-warning {{Address of stack memory associated with local variable 'local' returned to caller}} expected-warning{{Address of stack memory associated with local variable 'local' is still referred to by the caller variable 's' upon returning to the caller; this will be a dangling reference}} } S leak_through_field_of_returned_object() { diff --git a/clang/test/Analysis/stack-capture-leak-no-arc.mm b/clang/test/Analysis/stack-capture-leak-no-arc.mm index 71145d05072d77..2e9f0da73f17e2 100644 --- a/clang/test/Analysis/stack-capture-leak-no-arc.mm +++ b/clang/test/Analysis/stack-capture-leak-no-arc.mm @@ -40,7 +40,7 @@ dispatch_block_t test_block_inside_block_async_leak() { // called. void output_block(dispatch_block_t * blk) { int x = 0; - *blk = ^{ f(x); }; // expected-warning {{Address of stack-allocated block declared on line 43 is still referred to by the caller variable 'blk' upon returning to the caller. This will be a dangling reference [core.StackAddressEscape]}} + *blk = ^{ f(x); }; // expected-warning {{Address of stack-allocated block declared on line 43 is still referred to by the caller variable 'blk' upon returning to the caller; this will be a dangling reference [core.StackAddressEscape]}} } // The block literal captures nothing thus is treated as a constant. @@ -54,7 +54,7 @@ void test_block_leak() { __block dispatch_block_t blk; int x = 0; dispatch_block_t p = ^{ - blk = ^{ // expected-warning {{Address of stack-allocated block declared on line 57 is still referred to by the caller variable 'blk' upon returning to the caller. This will be a dangling reference [core.StackAddressEscape]}} + blk = ^{ // expected-warning {{Address of stack-allocated block declared on line 57 is still referred to by the caller variable 'blk' upon returning to the caller; this will be a dangling reference [core.StackAddressEscape]}} f(x); }; }; diff --git a/clang/test/Analysis/stackaddrleak.c b/clang/test/Analysis/stackaddrleak.c index 96bd4e4ea19e5f..615394a62bc934 100644 --- a/clang/test/Analysis/stackaddrleak.c +++ b/clang/test/Analysis/stackaddrleak.c @@ -7,7 +7,7 @@ char const *p; void f0(void) { char const str[] = "This will change"; p = str; -} // expected-warning@-1{{Address of stack memory associated with local variable 'str' is still referred to by the global variable 'p' upon returning to the caller. This will be a dangling reference}} +} // expected-warning@-1{{Address of stack memory associated with local variable 'str' is still referred to by the global variable 'p' upon returning to the caller; this will be a dangling reference}} void f1(void) { char const str[] = "This will change"; @@ -17,7 +17,7 @@ void f1(void) { void f2(void) { p = (const char *) __builtin_alloca(12); -} // expected-warning@-1{{Address of stack memory allocated by call to alloca() on line 19 is still referred to by the global variable 'p' upon returning to the caller. This will be a dangling reference}} +} // expected-warning@-1{{Address of stack memory allocated by call to alloca() on line 19 is still referred to by the global variable 'p' upon returning to the caller; this will be a dangling reference}} // PR 7383 - previously the stack address checker would crash on this example // because it would attempt to do a direct load from 'pr7383_list'. diff --git a/clang/test/Analysis/stackaddrleak.cpp b/clang/test/Analysis/stackaddrleak.cpp index df202a2fee7762..5b5a04da613146 100644 --- a/clang/test/Analysis/stackaddrleak.cpp +++ b/clang/test/Analysis/stackaddrleak.cpp @@ -18,7 +18,7 @@ struct myfunction { myfunction create_func() { int n; auto c = [&n] {}; - return c; // expected-warning {{Address of stack memory associated with local variable 'n' returned to caller}} expected-warning{{Address of stack memory associated with local variable 'n' is still referred to by a temporary object on the stack upon returning to the caller. This will be a dangling reference}} + return c; // expected-warning {{Address of stack memory associated with local variable 'n' returned to caller}} expected-warning{{Address of stack memory associated with local variable 'n' is still referred to by a temporary object on the stack upon returning to the caller; this will be a dangling reference}} } void gh_66221() { create_func()(); _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
