[cfe-commits] [Patch][Review Request]Revised patch for PR7287

Ted Kremenek kremenek at apple.com
Mon Nov 1 16:25:48 PDT 2010


Doug,

This isn't the right fix.  VisitCallExpr() should never be called with functions that don't have an identifier.

On Nov 1, 2010, at 4:18 PM, Douglas Gregor wrote:

> 
> On Nov 1, 2010, at 3:01 PM, Jim Goodnow II wrote:
> 
>> Okay, how about this? :-)
> 
> Thanks, committed as r117970. 
> 
> 	- Doug
> 
>> Index: lib/Checker/CStringChecker.cpp
>> ===================================================================
>> --- lib/Checker/CStringChecker.cpp	(revision 117853)
>> +++ lib/Checker/CStringChecker.cpp	(working copy)
>> @@ -905,7 +905,10 @@
>>    return false;
>> 
>>  // Get the name of the callee. If it's a builtin, strip off the prefix.
>> -  llvm::StringRef Name = FD->getName();
>> +  IdentifierInfo *II = FD->getIdentifier();
>> +  if (!II)   // if no idenifier, not a simple C function
>> +    return false;
>> +  llvm::StringRef Name = II->getName();
>>  if (Name.startswith("__builtin_"))
>>    Name = Name.substr(10);
>> 
>> Index: lib/Checker/PthreadLockChecker.cpp
>> ===================================================================
>> --- lib/Checker/PthreadLockChecker.cpp	(revision 117853)
>> +++ lib/Checker/PthreadLockChecker.cpp	(working copy)
>> @@ -65,7 +65,10 @@
>>  if (!R)
>>    return;
>> 
>> -  llvm::StringRef FName = R->getDecl()->getName();
>> +  IdentifierInfo *II = R->getDecl()->getIdentifier();
>> +  if (!II)   // if no idenifier, not a simple C function
>> +    return;
>> +  llvm::StringRef FName = II->getName();
>> 
>>  if (FName == "pthread_mutex_lock") {
>>    if (CE->getNumArgs() != 1)<PR7287.b.patch>_______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list