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.
Zhongxing Xu [Sat, 15 Aug 2009 03:17:38 +0000 (03:17 +0000)]
Extend the ProgramPoint to include the context information LocationContext,
which is either a stack frame context of the function or a local scope
context.
Eli Friedman [Sat, 15 Aug 2009 02:50:32 +0000 (02:50 +0000)]
Fix for PR4721: adjust CodeGen and ASTContext so that we have a
consistent model for handling size expressions for VLAs.
The model is essentially as follows: VLA types own their associated
expression. In some cases, we need to create multiple VLA types to
represent a given VLA (for canonical types, or qualifiers on array types,
or type merging). If we need to create multiple types based off of
the same VLA declaration, we use the new refcounting functionality so they can
all own the expression. The VLASizeMap in CodeGenFunction then uses the size
expression to identify the group of VLA types based off of the same original
declaration.
I'm not particularly attached to the VLA types owning the expression,
but we're stuck with at least until someone comes up with a way
to walk the VLA expressions for a declaration.
I did the parallel fix in ASTContext for DependentSizedArrayType, but I
haven't really looked closely at it, so there might still be issues
there.
I'll clean up the code duplication in ASTContext in a followup commit.
Ted Kremenek [Sat, 15 Aug 2009 00:51:46 +0000 (00:51 +0000)]
Change handling of attribute 'malloc' to only accept the attribute on function
declarations (and not function pointers). This is consistent with GCC. Accepting
this attribute on function pointers means that the attribute should be treated
as a type qualifier, which apparently is not what GCC does. We obviously can
change this later should we desire to enhance the 'malloc' attribute in this
way.
Ted Kremenek [Fri, 14 Aug 2009 20:49:40 +0000 (20:49 +0000)]
Improve Sema's handling of attribute 'malloc' to reject the attribute when
attaching to Objective-C methods (which mirrors GCC's behavior) and to allow the
return type of the function to be an Objective-C pointer or Block pointer (which
GCC also accepts).
Along the way, add 'const' to some of the pointer arguments of various utility
functions...
Fixed a bug in ir-gen for copy assignment synthesis.
Fixed a bug when evaluating those copy-assignments
which need by lazily syntheized. A test case
for these.