Ted Kremenek [Thu, 20 Aug 2009 05:13:36 +0000 (05:13 +0000)]
retain/release checker: Treat NSObject method '-awakeAfterUsingCoder:'
just as if it behaved like an init function. This fixes <rdar://problem/7129086>.
Eli Friedman [Thu, 20 Aug 2009 04:21:42 +0000 (04:21 +0000)]
Fix bit-field promotion to be a bit closer to the behavior of gcc.
Patch by Enea Zaffanella, with some simplifications/corrections to
isPromotableBitField by me.
Zhongxing Xu [Thu, 20 Aug 2009 03:21:49 +0000 (03:21 +0000)]
If the 'while' has an empty body, set the body to the continue target block.
Although this does not make the CFG more correct, it makes the CFG more
beautiful without multiple roots.
Ted Kremenek [Thu, 20 Aug 2009 00:57:22 +0000 (00:57 +0000)]
retain/release checker: Special case handling of CFAttributedStringSetAttribute,
fixing <rdar://problem/7152619>. Along the way, merge test cases in
'test/Analysis/rdar-6539791.c' into 'test/Analysis/retain-release.m'.
Ted Kremenek [Wed, 19 Aug 2009 23:56:48 +0000 (23:56 +0000)]
Enhance diagnostics concerning attribute 'ns_returns_retained' and 'cf_returns_retained' to present the range of the attribute and have the diagnostic location be the declaration that the attribute was falsely attached to. This solves the problem where these diagnostics were being suppressed when these attributes were wrapped in a macro that was defined in a system header.
Daniel Dunbar [Wed, 19 Aug 2009 19:10:30 +0000 (19:10 +0000)]
Convert parts of Rewriter to StringRef based API.
- Please accept my sincere apologies for the gratuitous elimination of code
duplication, manual string length counting, unnecessary strlen calls, etc.
Eli Friedman [Wed, 19 Aug 2009 07:44:53 +0000 (07:44 +0000)]
Make integer promotions work correctly on PIC16 and other platforms
where sizeof(short) == sizeof(int). Move UsualArithmeticConversionsType
out of Sema, since it was only there as a historical artifact. Patch by
Enea Zaffanella.
Introduce LocInfoType which is a Sema-specific implementation detail.
This is a Type subclass that can hold a DeclaratorInfo* when we have type source info coming
out of a declarator that we want to preserve. This is used only at the "border" of Parser/Sema for
passing/getting QualTypes, it does not participate in the type system semantics in any way.
Introduce DeclaratorDecl and pass DeclaratorInfo through the Decl/Sema interfaces.
DeclaratorDecl contains a DeclaratorInfo* to keep type source info.
Subclasses of DeclaratorDecl are FieldDecl, FunctionDecl, and VarDecl.
EnumConstantDecl still inherits from ValueDecl since it has no need for DeclaratorInfo.
Decl/Sema interfaces accept a DeclaratorInfo as parameter but no DeclaratorInfo is created yet.
Introduce DeclaratorInfo and TypeLoc, intended to be used for storing and reading source information for types.
DeclaratorInfo will contain a flat memory block for source information about a type that came out of a declarator.
TypeLoc and its subclasses will be used by clients as wrappers to "traverse" the memory block and read the information.
Both DeclaratorInfo and TypeLoc are not utilized in this commit.
Renamed ClassProp data member of ObjCImplctSetterGetterRefExpr
to InterfaceDecl, as it is unrelated to any property and
holds the InterfaceDecl needed for accessing class getter/setter
methods using the dot-syntax.
Renamed ObjCKVCRefExpr to ObjCImplctSetterGetterRefExpr.
Removed an unnecessary loop to get to setters incoming
argument. Added DoxyGen comments. Still more work
to do in this area (WIP).
Ted Kremenek [Tue, 18 Aug 2009 01:05:30 +0000 (01:05 +0000)]
Enhance static analyzer diagnostics by introducing a new 'EnhancedBugReporter'
which allows custom checks to register callback creator functions for creating
BugReporterVisitor objects. This allows various checks to include diagnostics
such as 'assuming value is null' with little extra work. Eventually this API
should be refactored to be cleaner and more simple.
David Chisnall [Mon, 17 Aug 2009 23:08:21 +0000 (23:08 +0000)]
Changes to TargetABIInfo to (hopefully) select the correct calling convention. This has been tested on FreeBSD, and now correctly generates GCC-compatible code for functions returning small structures. Please test it on other platforms!
Patch to 1) synthesizing non-trivial default destructor when
one is not provided by user. 2) More complete
emission of ctor prologue when it has no initializer
list or when it is synthesized.
David Chisnall [Mon, 17 Aug 2009 16:35:33 +0000 (16:35 +0000)]
Initial patch to support definitions of id and Class from headers in Objective-C code.
This currently breaks test/SemaObjC/id-isa-ref.m and issues some spurious warnings when you attempt to assign a struct objc_class* value to a Class variable. The test case probably should fail as it's written, because without the definition of Class the compiler should not assume struct objc_class* is a valid receiver type, but it's left broken because it would be nice if we could get that passing too for the special case of isa.
Zhongxing Xu [Mon, 17 Aug 2009 06:19:58 +0000 (06:19 +0000)]
To make the analysis independent on the locally stored liveness and cfg
of GRStateManager and GRExprEngine, pass the initial location context
to the getInitialState() method.
Chris Lattner [Sun, 16 Aug 2009 16:57:27 +0000 (16:57 +0000)]
Improve the diagnostic emitted when an unused ObjC property getter
is found. Instead of complaining about a generic "unused expr",
emit:
t.m:7:3: warning: property access result unused - getters should not have side effects
While objc property getters *could* have side effects, according to
the language best practices, they *shouldn't*. Hopefully the
diagnostic now gets this across.
Chris Lattner [Sun, 16 Aug 2009 16:45:18 +0000 (16:45 +0000)]
This is an attempt to improve loc info for 'unused result' expression
warnings, but it fails because we don't have the location of the .
and I don't understand ObjCKVCRefExpr. I'll revisit this later.
Anders Carlsson [Sun, 16 Aug 2009 05:13:48 +0000 (05:13 +0000)]
AddInitializerToDecl can't take a FullExprArg. Make it take an ExprArg, and create the CXXExprWithTemporaries before setting the initializer on the VarDecl.
Anders Carlsson [Sun, 16 Aug 2009 01:56:34 +0000 (01:56 +0000)]
Move builtin call checking out into a separate function, make CheckFunctionCall and CheckBlockCall return bool instead. No intended functionality change.
Eli Friedman [Sat, 15 Aug 2009 19:02:19 +0000 (19:02 +0000)]
Don't perform integer promotions on the operand to a cast; this
simplifies the AST, and can matter in some rare cases involving
casts to vector types. Patch by Enea Zaffanella.
Improved on ir-gen for synthesis of non-trivial default
constructor body whose class has non-static data-members which
required non-trivial construction.