http://llvm.org/bugs/show_bug.cgi?id=11186
Summary: Check for incorrect use of out-error
Product: clang
Version: 2.8
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
NSError usage says that you shouldn't look at what was written into an outError
unless your call to the method/function that filled it returns a value that
results in a false condition check.
That is, if you have
- (BOOL)foo:(NSError **)outError;
then this should be valid:
NSError *error;
if (![self foo:&error]) {
... do something with "error"
}
but this should produce an diagnostic:
NSError *error;
[self foo:&error];
if (error) {
...
}
Non-condition return type methods/functions should be considered OK, though.
These are often used as utility functions to fill out NSError objects:
static void _makeError(NSString *domain, NSInteger code, NSError **outError) {
if (outError) {
... make an error ...
}
}
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs