Commit Graph

7985 Commits

Author SHA1 Message Date
Zhongxing Xu a778b02e89 If the body of for loop is empty, set its body to the continue target.
Otherwise we get a wrong CFG.

llvm-svn: 79507
2009-08-20 02:56:48 +00:00
Mike Stump 2220447adc Ensure we don't output repeated vbase offsets. I have a testcase for
this, but need to fixup the actual offset value before I can check it
in.  WIP.

llvm-svn: 79506
2009-08-20 02:11:48 +00:00
John McCall 87a44eb98a Basic nested-template implementation.
llvm-svn: 79504
2009-08-20 01:44:21 +00:00
Zhongxing Xu 068928b2a6 Rename: ProgramPoint::getContext() => ProgramPoint::getLocationContext().
llvm-svn: 79502
2009-08-20 01:23:34 +00:00
Fariborz Jahanian dd46eb770f Test case for my last patch plus a minor clean up.
llvm-svn: 79500
2009-08-20 01:01:06 +00:00
Ted Kremenek d982f001c9 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'.

llvm-svn: 79499
2009-08-20 00:57:22 +00:00
Fariborz Jahanian eeb0e57247 ir-gen for multi-dimensional array construction. WIP.
llvm-svn: 79497
2009-08-20 00:15:15 +00:00
Ted Kremenek eebcf574dd 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.
llvm-svn: 79496
2009-08-19 23:56:48 +00:00
Argyrios Kyrtzidis 20cf19141f Keep track of the right paren ')' source location in a function declarator.
llvm-svn: 79489
2009-08-19 23:14:54 +00:00
Fariborz Jahanian a8fe2c26a8 Removed unneeded code for break/continue statements in
manufactured for-loop per Anders feedback (thanks).

- Fariborz

llvm-svn: 79466
2009-08-19 21:10:38 +00:00
Fariborz Jahanian 431c883287 ir-gen for constructing arrays as non-static data members. WIP.
llvm-svn: 79464
2009-08-19 20:55:16 +00:00
Eli Friedman a9c3d71b59 Add TCE target to clang; patch by Mikael Lepistö.
llvm-svn: 79462
2009-08-19 20:47:07 +00:00
Daniel Dunbar 62c850fb8f Remove now unnecessary helper methods.
llvm-svn: 79460
2009-08-19 20:32:38 +00:00
Daniel Dunbar 58bc48c14e Switch to SmallString::str from SmallString::c_str.
- Several FIXMEs due to non-Twinification of IRBuilder.

llvm-svn: 79455
2009-08-19 20:04:03 +00:00
Daniel Dunbar dec484abfb 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.

llvm-svn: 79448
2009-08-19 19:10:30 +00:00
Daniel Dunbar 69c300d5e3 Use raw_svector_ostream for string concatenation.
llvm-svn: 79444
2009-08-19 18:30:37 +00:00
Mike Stump 3bc0a3bf7d One second thought, I think I want to limit this class to just vtable
building activities.

llvm-svn: 79438
2009-08-19 18:10:47 +00:00
Mike Stump b386941208 Cleanup: fold IndirectPrimary into builder.
llvm-svn: 79423
2009-08-19 14:40:47 +00:00
Mike Stump 3b09f004db We don't want to confuse this layout with the BLayout from the builder.
llvm-svn: 79422
2009-08-19 14:06:50 +00:00
Zhongxing Xu 080fa0522b Get the Decl from the current ExplodedNode. Eventually the diagnostic client
and other core analysis logic will be untied to a particular Decl.

llvm-svn: 79420
2009-08-19 12:50:00 +00:00
Benjamin Kramer a48651de2d Update CMakeLists.
llvm-svn: 79416
2009-08-19 12:02:15 +00:00
Eli Friedman 5ae98ee006 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.

llvm-svn: 79412
2009-08-19 07:44:53 +00:00
Mike Stump 984c99d190 Restore vbase offsets for classes without a primary.
llvm-svn: 79402
2009-08-19 02:53:08 +00:00
Mike Stump 583ef62149 Refine vcalls a little.
llvm-svn: 79400
2009-08-19 02:06:38 +00:00
Argyrios Kyrtzidis cc06621280 Fix a comment and improve an assert message.
llvm-svn: 79399
2009-08-19 01:46:06 +00:00
Argyrios Kyrtzidis 560ac97bf3 Store/load type source info from/to PCH files.
llvm-svn: 79396
2009-08-19 01:28:35 +00:00
Argyrios Kyrtzidis c7148c974d Use Sema's LocInfoType to pass and preserve type source info through the Parser.
llvm-svn: 79395
2009-08-19 01:28:28 +00:00
Argyrios Kyrtzidis e918926d31 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.

llvm-svn: 79394
2009-08-19 01:28:17 +00:00
Argyrios Kyrtzidis fc8b022810 Create and instantiate a DeclaratorInfo using a newly introduced Sema::GetDeclaratorInfoForDeclarator().
llvm-svn: 79393
2009-08-19 01:28:06 +00:00
Argyrios Kyrtzidis 60ed560428 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.

llvm-svn: 79392
2009-08-19 01:27:57 +00:00
Argyrios Kyrtzidis 3f79ad7405 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.

llvm-svn: 79391
2009-08-19 01:27:32 +00:00
Mike Stump 6fe6ca11da Cleanup.
llvm-svn: 79374
2009-08-18 22:04:08 +00:00
Mike Stump 494c42526b Add some documentation.
llvm-svn: 79373
2009-08-18 21:59:28 +00:00
Mike Stump 07347353a0 Cleanups. Move GenerateRtti to CodeGenModule.
llvm-svn: 79372
2009-08-18 21:49:00 +00:00
Fariborz Jahanian 19380c4b88 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.

llvm-svn: 79371
2009-08-18 21:37:33 +00:00
Mike Stump ee81dca8c7 Move the rest of the vtable building code into the new builder.
llvm-svn: 79370
2009-08-18 21:30:21 +00:00
Mike Stump 1f18b9a301 Suck up method generation.
llvm-svn: 79367
2009-08-18 21:03:28 +00:00
Mike Stump 5cb34077ef Split out vtable bulding code into a builder.
llvm-svn: 79366
2009-08-18 20:50:28 +00:00
Fariborz Jahanian 88cc2340de 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).

llvm-svn: 79365
2009-08-18 20:50:23 +00:00
Anders Carlsson a192947509 Change ActOnReturnStmt to not take a FullExprArg. Instead, Sema will wrap the return expr inside a CXXExprWithTemporaries if needed.
llvm-svn: 79342
2009-08-18 16:11:00 +00:00
Zhongxing Xu 7864b9ea0c Remove unused parameter BugReporter due to previous patch.
llvm-svn: 79328
2009-08-18 08:58:41 +00:00
Zhongxing Xu 4c76dbc758 Now we can get the CFG from the ProgramPoint. No need to pass in the
BugReporter.

llvm-svn: 79327
2009-08-18 08:46:04 +00:00
Daniel Dunbar 5232203234 Convert CreateTargetInfo to use a Triple instead of manul string munging.
- Patch by Yonggang Luo (with some formatting tweaks by Eli and myself).

llvm-svn: 79320
2009-08-18 05:47:58 +00:00
Ted Kremenek 9b2c79de59 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.

llvm-svn: 79302
2009-08-18 01:05:30 +00:00
John McCall 5ed6e8f54c Teach Sema how to pop out of friend function definitions in nested classes.
llvm-svn: 79291
2009-08-18 00:00:49 +00:00
David Chisnall 26657ea8bc Fixed typo in last commit pointed out by Anton.
llvm-svn: 79290
2009-08-17 23:18:30 +00:00
David Chisnall de3a06933d 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!
llvm-svn: 79288
2009-08-17 23:08:21 +00:00
Jakob Stoklund Olesen 0de52f906d Support compilation for the blackfin back-end
llvm-svn: 79271
2009-08-17 20:08:44 +00:00
Fariborz Jahanian d172e91f2a 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.

llvm-svn: 79269
2009-08-17 19:04:50 +00:00
Anders Carlsson 49033712e4 Remove an ErrorUnsupported call.
llvm-svn: 79261
2009-08-17 18:24:57 +00:00
David Chisnall 9f57c29053 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.

Approved by snaroff.

llvm-svn: 79248
2009-08-17 16:35:33 +00:00
Zhongxing Xu b562444cf8 adjust indentation.
llvm-svn: 79236
2009-08-17 14:13:14 +00:00
Zhongxing Xu 5f078cb844 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.

llvm-svn: 79228
2009-08-17 06:19:58 +00:00
Erick Tryzelaar b90731117c Update lexer to work with the new APFloat string parsing.
llvm-svn: 79211
2009-08-16 23:36:28 +00:00
Anders Carlsson 81f0df9601 Improve handling of delete expressions.
llvm-svn: 79205
2009-08-16 21:13:42 +00:00
Anders Carlsson a471db0dd4 Store the delete operator for delete expressions.
llvm-svn: 79200
2009-08-16 20:29:29 +00:00
Fariborz Jahanian d262eda6fc Patch toward synthesizing non-trivial destructors. WIP
llvm-svn: 79199
2009-08-16 19:36:17 +00:00
Mike Stump 996576f3aa Refine vbase offset calculations. WIP.
llvm-svn: 79198
2009-08-16 19:04:13 +00:00
Anders Carlsson 3b848940d7 Only do this for initializers of course.
llvm-svn: 79197
2009-08-16 17:54:29 +00:00
Anders Carlsson b80760bd78 Destroy bound temporaries.
llvm-svn: 79196
2009-08-16 17:50:25 +00:00
Chris Lattner 2ba5ca9d4f 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.

llvm-svn: 79192
2009-08-16 16:57:27 +00:00
Chris Lattner d37f61c1c6 fix my previous commit.
llvm-svn: 79191
2009-08-16 16:51:50 +00:00
Chris Lattner d8b800ad31 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.

llvm-svn: 79190
2009-08-16 16:45:18 +00:00
Anders Carlsson 5b106a7545 Add an IsInitializer flag to EmitAnyExpr. This is used to prevent temporaries from being destroyed when they're bound to a reference variable.
llvm-svn: 79179
2009-08-16 07:36:22 +00:00
Anders Carlsson 157c321b7c No need to append extra padding now that we don't create packed structs for simple cases like the constant string.
llvm-svn: 79178
2009-08-16 05:55:31 +00:00
Anders Carlsson 250aada4b9 AddInitializerToDecl can't take a FullExprArg. Make it take an ExprArg, and create the CXXExprWithTemporaries before setting the initializer on the VarDecl.
llvm-svn: 79176
2009-08-16 05:13:48 +00:00
Anders Carlsson e80ccac2cb Call MaybeBindToTemporary for overloaded binary and unary operators.
llvm-svn: 79173
2009-08-16 04:11:06 +00:00
Anders Carlsson 1c83debc36 Call MaybeBindToTemporary when constructing functino call operator calls.
llvm-svn: 79172
2009-08-16 03:53:54 +00:00
Anders Carlsson 8c84c206d9 Add MaybeBindToTemporary calls for member call expressions.
llvm-svn: 79171
2009-08-16 03:42:12 +00:00
Anders Carlsson f898401305 Make sure to call MaybeBindToTemporary when creating CallExprs.
llvm-svn: 79168
2009-08-16 03:06:32 +00:00
Anders Carlsson bc4c107836 Move builtin call checking out into a separate function, make CheckFunctionCall and CheckBlockCall return bool instead. No intended functionality change.
llvm-svn: 79157
2009-08-16 01:56:34 +00:00
Mike Stump 22ea1f8a30 Cleanups and fixups for calculating the virtual base offsets. WIP.
llvm-svn: 79156
2009-08-16 01:46:26 +00:00
Anders Carlsson f86a8d1030 BuildCXXConstructExpr doesn't need to take an ASTContext.
llvm-svn: 79149
2009-08-15 23:41:35 +00:00
Eli Friedman ea56303b09 Add an explicit constructor to ActiveTemplateInstantiation which
initializes all the members; this fixes a valgrind error in the 
regression tests.

llvm-svn: 79148
2009-08-15 22:50:33 +00:00
Eli Friedman c80ca68423 Fix test failure due to uninitialized member.
llvm-svn: 79145
2009-08-15 22:23:00 +00:00
Eli Friedman c96d4963eb Implement __is_empty. Patch by Sean Hunt.
llvm-svn: 79143
2009-08-15 21:55:26 +00:00
Eli Friedman da8d4def72 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.

llvm-svn: 79126
2009-08-15 19:02:19 +00:00
Fariborz Jahanian 0aed0225b4 Improved on ir-gen for synthesis of non-trivial default
constructor body whose class has non-static data-members which
required non-trivial construction.

llvm-svn: 79125
2009-08-15 18:55:17 +00:00
Eli Friedman 2be79b3608 Add an additional C++ hardcoded search path.
llvm-svn: 79075
2009-08-15 03:45:14 +00:00
Zhongxing Xu e1190f73a9 Extend the ProgramPoint to include the context information LocationContext,
which is either a stack frame context of the function or a local scope 
context.

llvm-svn: 79072
2009-08-15 03:17:38 +00:00
Eli Friedman 04fddf0d1f 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.

llvm-svn: 79071
2009-08-15 02:50:32 +00:00
John McCall deb8448690 Disable all recognition of main() in -ffreestanding. Addresses bug #4720.
llvm-svn: 79070
2009-08-15 02:09:25 +00:00
Ted Kremenek 08479ae7fe 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.

llvm-svn: 79060
2009-08-15 00:51:46 +00:00
Chris Lattner 8dc7626f9c minor cleanups for VLA stuff.
llvm-svn: 79059
2009-08-15 00:03:43 +00:00
Chris Lattner 19efdd67dd use GetVLASize instead of accessing VLASizeMap directly, this gets an assert if
VLASize isn't populated for the type yet.

llvm-svn: 79057
2009-08-14 23:43:22 +00:00
Ted Kremenek f22c410efa Per Eli Friedman's feedback, handle attribute 'malloc' being applied to
declarations of function pointers.

llvm-svn: 79053
2009-08-14 22:03:27 +00:00
Fariborz Jahanian 2e4a46b745 objc2's foreach statement's selector type can be
a block pointer too.

llvm-svn: 79050
2009-08-14 21:53:27 +00:00
Devang Patel d4bbb08946 Do now overflow while calulating upper bound for zero sized array.
llvm-svn: 79043
2009-08-14 20:57:45 +00:00
Ted Kremenek 420d9a7a5e Use 'dyn_cast' instead of a check for a function declaration followed by a
'cast'.

llvm-svn: 79041
2009-08-14 20:51:58 +00:00
Ted Kremenek 527042b5a9 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...

llvm-svn: 79040
2009-08-14 20:49:40 +00:00
Fariborz Jahanian 42af5ba7b7 ir-gen for generation of trvial copy constructor
call.

llvm-svn: 79034
2009-08-14 20:11:43 +00:00
Anders Carlsson e827123f08 Make the CXXDefaultArgExpr constructor protected and add a static Create function.
llvm-svn: 79013
2009-08-14 18:30:22 +00:00
Fariborz Jahanian 83b000c713 Fixed a regression in deciding when to issue warning on properties which
implement NSCopying protocol in GC mode.

llvm-svn: 79008
2009-08-14 18:06:25 +00:00
Shantonu Sen 4a7b937c4b PR4715
-Wno-error disables WarningsAsErrors instead of
mistakenly being treated like -Werror

llvm-svn: 78987
2009-08-14 04:07:15 +00:00
Anders Carlsson 5d67a97513 Fix spacing
llvm-svn: 78981
2009-08-14 02:39:47 +00:00
John McCall 58de35804b Support friend declarations in templates and test that argdep lookup
still works.

llvm-svn: 78979
2009-08-14 02:03:10 +00:00
Mike Stump bcf756cbac Deconflate virtual base offsets from non-virtual base offsets.
Deconflate a virtual base primary from a non-virtual base.

llvm-svn: 78971
2009-08-14 01:44:03 +00:00
Fariborz Jahanian 92b3f47de2 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.

llvm-svn: 78965
2009-08-14 00:01:54 +00:00
Owen Anderson c36edfede5 Update for LLVM API change.
llvm-svn: 78957
2009-08-13 23:27:53 +00:00
Mike Stump 590a7c780c We can't avoid doing the work to find all the indirect primary virtual
base classes as we'll need that to layout the virtual bases...

llvm-svn: 78954
2009-08-13 23:26:06 +00:00