[cfe-commits] r157204 - in /cfe/trunk: lib/StaticAnalyzer/Core/ObjCMessage.cpp test/Analysis/PR12905.c
Benjamin Kramer
benny.kra at googlemail.com
Mon May 21 12:40:38 PDT 2012
Author: d0k
Date: Mon May 21 14:40:38 2012
New Revision: 157204
URL: http://llvm.org/viewvc/llvm-project?rev=157204&view=rev
Log:
Analyzer: Fix PR12905, a crash when encountering a call to a function named "C".
While there clean up indentation.
Added:
cfe/trunk/test/Analysis/PR12905.c
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/ObjCMessage.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Core/ObjCMessage.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ObjCMessage.cpp?rev=157204&r1=157203&r2=157204&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ObjCMessage.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ObjCMessage.cpp Mon May 21 14:40:38 2012
@@ -161,16 +161,15 @@
}
bool CallOrObjCMessage::isCFCGAllowingEscape(StringRef FName) {
- if (FName[0] == 'C' && (FName[1] == 'F' || FName[1] == 'G'))
- if (StrInStrNoCase(FName, "InsertValue") != StringRef::npos||
- StrInStrNoCase(FName, "AddValue") != StringRef::npos ||
- StrInStrNoCase(FName, "SetValue") != StringRef::npos ||
- StrInStrNoCase(FName, "WithData") != StringRef::npos ||
- StrInStrNoCase(FName, "AppendValue") != StringRef::npos||
- StrInStrNoCase(FName, "SetAttribute") != StringRef::npos) {
- return true;
- }
- return false;
+ if (!FName.startswith("CF") && !FName.startswith("CG"))
+ return false;
+
+ return StrInStrNoCase(FName, "InsertValue") != StringRef::npos ||
+ StrInStrNoCase(FName, "AddValue") != StringRef::npos ||
+ StrInStrNoCase(FName, "SetValue") != StringRef::npos ||
+ StrInStrNoCase(FName, "WithData") != StringRef::npos ||
+ StrInStrNoCase(FName, "AppendValue") != StringRef::npos ||
+ StrInStrNoCase(FName, "SetAttribute") != StringRef::npos;
}
Added: cfe/trunk/test/Analysis/PR12905.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/PR12905.c?rev=157204&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/PR12905.c (added)
+++ cfe/trunk/test/Analysis/PR12905.c Mon May 21 14:40:38 2012
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core %s
+// PR12905
+
+void C(void);
+
+void t(void) {
+ C();
+}
More information about the cfe-commits
mailing list