Commit Graph

15234 Commits

Author SHA1 Message Date
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
Benjamin Kramer 312fde6420 lit: flush stdout in no-fancy-progress-bar mode as well.
llvm-svn: 79056
2009-08-14 23:34:45 +00:00
Ted Kremenek 8d091dbe13 Add more attribute 'malloc' test cases involving function pointers.
llvm-svn: 79055
2009-08-14 22:06:01 +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 026d201eca This test case does not need to include 'stdlib.h'.
llvm-svn: 79042
2009-08-14 20:53:10 +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
Ted Kremenek d0d7256b8f Pass '-Wno-' options to clang-cc. This fixes <rdar://problem/6943988>.
llvm-svn: 79011
2009-08-14 18:20:50 +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
Ted Kremenek bc16b4e211 Update/add links to developer meeting.
llvm-svn: 79005
2009-08-14 17:11:34 +00:00
Daniel Dunbar f944cc5347 Fix a few typos.
llvm-svn: 78991
2009-08-14 04:43:04 +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 5aa7855e3a Testcase for a recent checkin.
llvm-svn: 78974
2009-08-14 01:50:51 +00:00
Mike Stump c4b7afed0f Testcase for recent checkin.
llvm-svn: 78973
2009-08-14 01:48:56 +00:00
Mike Stump 7ba9c8752c Testcase for a recent checkin.
llvm-svn: 78972
2009-08-14 01:46:56 +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
Mike Stump 9a1090a399 Add testcase for recent work.
llvm-svn: 78959
2009-08-13 23:33:29 +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
Mike Stump c2f591b1e6 Refine vtable layout for virtual bases and keep better track of
primaries.  WIP.

llvm-svn: 78950
2009-08-13 22:53:07 +00:00
Owen Anderson 41a750271b Update for LLVM API change.
llvm-svn: 78946
2009-08-13 21:57:51 +00:00
Fariborz Jahanian 3d693b22df Adds testing of copy assignment of anonymous union
data members.

llvm-svn: 78943
2009-08-13 21:47:21 +00:00
Fariborz Jahanian 89d01eb3e4 More complete test for my previous patch.
llvm-svn: 78941
2009-08-13 21:38:50 +00:00
Fariborz Jahanian 4985b33fd7 Patch to force synthesis of copy assignment operator
function in the order according to c++03. ir-gen 
for copy assignment in the trivial case and the first
test case.

llvm-svn: 78938
2009-08-13 21:09:41 +00:00
Mike Stump 2631d8c517 Minor cleanups.
llvm-svn: 78927
2009-08-13 18:39:54 +00:00
Mike Stump 1300754fdd Prep for vbase layout refinements. WIP.
llvm-svn: 78882
2009-08-13 02:02:14 +00:00
Daniel Dunbar e5515289fa Update test
llvm-svn: 78877
2009-08-13 01:27:45 +00:00
Ryan Flynn 90964523f6 change cast to dyn_cast because d may not be a FunctionDecl
llvm-svn: 78876
2009-08-13 01:19:23 +00:00
Fariborz Jahanian 9b630c3040 Minor refactoring of copy assign operator ir-gen. SWIP.
llvm-svn: 78875
2009-08-13 00:53:36 +00:00
Mike Stump 6bb66bbd06 Refine virtual base layout. WIP.
llvm-svn: 78873
2009-08-13 00:34:14 +00:00
Ryan Flynn a8fae2ebf4 change a dyn_cast to cast
llvm-svn: 78862
2009-08-12 23:36:28 +00:00
Fariborz Jahanian bbd5e8c2cf More toward synthesizing copy assignments. SWIP.
llvm-svn: 78861
2009-08-12 23:34:46 +00:00
Mike Stump b661738203 Cleanup.
llvm-svn: 78858
2009-08-12 23:25:18 +00:00
Mike Stump 938f15b033 Refactor. WIP. Eventually, this will all go into a vtable builder class.
llvm-svn: 78857
2009-08-12 23:14:12 +00:00
Mike Stump 480212253a Cleanup.
llvm-svn: 78855
2009-08-12 23:03:28 +00:00
Mike Stump 82165efbc4 Refactor.
llvm-svn: 78854
2009-08-12 23:00:59 +00:00
Mike Stump dc94d3fd27 Refactor.
llvm-svn: 78851
2009-08-12 22:34:12 +00:00
Mike Stump cb2752bb5d Remove another done audit FIXME.
llvm-svn: 78847
2009-08-12 22:10:00 +00:00
Mike Stump aa08da7906 Refactor a bit and remove some FIXME audit markers, now that the code
has been audited for correctness.

llvm-svn: 78846
2009-08-12 22:06:55 +00:00
Mike Stump 6f3793b406 Refine primary vbase selection ordering. WIP.
llvm-svn: 78844
2009-08-12 21:50:08 +00:00
Fariborz Jahanian de7d4c264a Patch for synthesizing copy assignment operator.
WIP.

llvm-svn: 78841
2009-08-12 21:14:35 +00:00
Mike Stump 9deb22b850 Improve the secondary vtables to not include vbase offsets. WIP.
llvm-svn: 78831
2009-08-12 18:50:26 +00:00
Fariborz Jahanian 887cd6a8eb error on property of objc interface type instead of crashing
llvm-svn: 78826
2009-08-12 18:17:53 +00:00
Chris Lattner 91f5ff6bce improve path handling, patch by Baptiste Lepilleur!
llvm-svn: 78824
2009-08-12 17:50:39 +00:00
Mike Stump cecfe61cd1 Refine vtable building for the secondary vtables to exclude yet more
cases where a virtual base was already used as a primary base class.
WIP.

llvm-svn: 78820
2009-08-12 17:42:21 +00:00
Chris Lattner 859c37a5d9 use the new llvm::Triple parsing stuffola for handling darwin version #'s.
llvm-svn: 78794
2009-08-12 06:24:27 +00:00
Nate Begeman 4874592208 Transition the PCH support for ShuffleVectorExpr over to ASTContext allocation
llvm-svn: 78783
2009-08-12 02:28:50 +00:00
Zhongxing Xu 0d375cdcb1 More cleanups.
llvm-svn: 78782
2009-08-12 02:28:32 +00:00
Zhongxing Xu ccffe0953e Remove redundant forward declarations.
llvm-svn: 78781
2009-08-12 02:23:28 +00:00
Nate Begeman f485fb55d8 Fix a fixme by allocating ShuffleVectorExprs in the Context
llvm-svn: 78780
2009-08-12 02:10:25 +00:00
Dan Gohman b321039271 Use the new nsw form of add for signed integer addition.
llvm-svn: 78765
2009-08-12 01:16:29 +00:00
Fariborz Jahanian 853d21a18a Warn on use of property dot syntax when unused.
llvm-svn: 78760
2009-08-12 00:45:33 +00:00
Dan Gohman 43b4484f87 Use the inbounds variant of getelementptr for common pointer arithmetic.
llvm-svn: 78756
2009-08-12 00:33:55 +00:00
Anders Carlsson 0738468322 Add some information about temporaries to the statement dumper.
llvm-svn: 78754
2009-08-12 00:21:52 +00:00
Benjamin Kramer b3788a24c6 Rename macro to avoid a name clash on FreeBSD.
llvm-svn: 78741
2009-08-11 22:46:25 +00:00
Dan Gohman 1cebe56735 Remove the hack that turns sdiv by a power of 2 to ashr, and
use the new "exact" sdiv to allow LLVM optimization to perform
this transformation.

llvm-svn: 78739
2009-08-11 22:40:09 +00:00
Benjamin Kramer 854d7dec5a Add newline at end of file.
llvm-svn: 78735
2009-08-11 22:33:06 +00:00
Fariborz Jahanian 3f8917abf6 Patch to warn if a property which is 'assign' by default
may not implement NSCopying protocol in -fobjc-gc[-only] mode.

llvm-svn: 78726
2009-08-11 22:02:25 +00:00
John McCall 2658c4e2d9 Add a FriendClassDecl type for holding declarations of friend types in
the AST, and create such declarations.

llvm-svn: 78719
2009-08-11 21:13:21 +00:00
Chris Lattner 66a388b859 merge two tests.
llvm-svn: 78705
2009-08-11 20:08:52 +00:00
Chris Lattner f1c9797ffa Fix rdar://7126285: don't warn on unused ObjC property access
that uses "dot syntax" since it might have a side effect.

llvm-svn: 78704
2009-08-11 20:08:03 +00:00
Fariborz Jahanian b2197042b8 ir-gen support for anonymous union data member
copying in copy constructors and used in
default constructor's initializer list.

llvm-svn: 78700
2009-08-11 18:49:54 +00:00
Daniel Dunbar d362857f4c Update test case.
llvm-svn: 78699
2009-08-11 18:37:40 +00:00
Benjamin Kramer 9cd050ab07 LLVMContext is a class now.
llvm-svn: 78691
2009-08-11 17:46:57 +00:00
Douglas Gregor 2168a9f25f Fix DISABLE_SMART_POINTERS build
llvm-svn: 78674
2009-08-11 15:56:57 +00:00
John McCall d1e9d835f3 Argument-dependent lookup for friend declarations. Add a new decl type,
FriendFunctionDecl, and create instances as appropriate.

The design of FriendFunctionDecl is still somewhat up in the air;  you can
befriend arbitrary types of functions --- methods, constructors, etc. ---
and it's not clear that this representation captures that very well.
We'll have a better picture when we start consuming this data in access
control.

llvm-svn: 78653
2009-08-11 06:59:38 +00:00
Douglas Gregor a16548e301 Refactor the template-instantiation logic for expressions into a
generic tree transformation (also used for recanonicalization) and a
small amount of template-instantiation-specific logic.

llvm-svn: 78645
2009-08-11 05:31:07 +00:00
Argyrios Kyrtzidis ae438f8c03 Check whether a tag was defined in a C++ condition declaration using GetTypeForDeclarator.
llvm-svn: 78644
2009-08-11 05:20:41 +00:00
Mike Stump 78696a70bf Implement more of the inductive case for vtable layout involving
virtual base primaries and improve the layout of classes with virtual
bases.  WIP.

Hey, I've decided I want a change to FileCheck, I need to ensure that
the group is together, nothing in between.  Can we change it to check
the match line is from the line immediately following the last matched
line, if the source for the matched line is immediately after the
source for the previously matched line?

// CHECK: 1
// CHECK: 2
// CHECK: 3

// CHECK: 4
// CHECK: 5
// CHECK: 6

would require 1 2 and 3 to be continuous in the output, and 4 5 and 6
to be continuous.

llvm-svn: 78638
2009-08-11 04:03:59 +00:00
Fariborz Jahanian 4898990524 Fix an indentation.
llvm-svn: 78624
2009-08-10 23:59:59 +00:00
Fariborz Jahanian 296584b2a9 Support for anonymous union in ctor's initializer and
bunch of FIXMEs for their is-gen.

llvm-svn: 78623
2009-08-10 23:56:17 +00:00
Nate Begeman 5ec4b318e3 Take 2 on AltiVec-style vector initializers.
Fixes PR4704 problems

Addresses Eli's patch feedback re: ugly cast code

Updates all postfix operators to remove ParenListExprs.  While this is awful,
no better solution (say, in the parser) is obvious to me.  Better solutions
welcome.

llvm-svn: 78621
2009-08-10 23:49:36 +00:00
Anders Carlsson ed1674d971 Add a CastInfo struct that will be used for cast information when constructing cast expressions. Right now it only stores the cast kind, but in the future it might store conversion functions and constructors.
llvm-svn: 78599
2009-08-10 21:30:22 +00:00
Chris Lattner 30ba674391 fix a couple of problems with section attributes:
1. Passing something that isn't a string used to cause:
   "argument to annotate attribute was not a string literal"
  make it say "section attribute" instead.

2. Fix the location of the above message to point to the
   bad argument instead of the section token.

3. Implement rdar://4341926, by diagnosing invalid section
   specifiers in the frontend rather than letting them slip all
   the way to the assembler (a QoI win).

An example of #3 is that we used to produce something like this:

/var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Expected comma after segment-name
/var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Rest of line ignored. 1st junk character valued 46 (.).

Daniel improved clang to use llvm_report_error, so now we got:

$ clang t.c -c
fatal error: error in backend: Global variable 'x' has an invalid section specifier 'sadf': mach-o section specifier
      requires a segment and section separated by a comma.

with no loc info.  Now we get:

$ clang t.c -fsyntax-only
t.c:4:30: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment
      and section separated by a comma
int x __attribute__((section("sadf")));
                             ^

which is nice :)

llvm-svn: 78586
2009-08-10 19:03:04 +00:00
Chris Lattner 2375952a47 these tests include section specifiers that aren't valid on the
mac, use an explicit triple.

llvm-svn: 78583
2009-08-10 18:56:44 +00:00
Fariborz Jahanian 9d3405ceab minor refactoring. No change otherwise.
llvm-svn: 78582
2009-08-10 18:46:38 +00:00
Fariborz Jahanian 7cc52cf09f ir-gen for generating copying of scalar data members in
a synthesized copy constructor.

llvm-svn: 78580
2009-08-10 18:34:26 +00:00
Mike Stump 68f0d31f25 Add walking bases in reverse order.
llvm-svn: 78578
2009-08-10 18:21:22 +00:00
Fariborz Jahanian 2a26e351fc Fixed a ir-gen bug in synthesizing copy constructors.
llvm-svn: 78570
2009-08-10 17:20:45 +00:00
Daniel Dunbar 71f22e738a Use LLVM's new error handler API to report back end errors using Diagnostic.
For example,
--
ddunbar@giles:Frontend$ clang -c backend-errors.c
fatal error: error in backend: Global variable 'a' has an invalid section specifier
      'I AM, not, legal': mach-o section specifier uses an unknown section type.
--
compare to:
--
ddunbar@giles:Frontend$ gcc -c backend-errors.c
/var/folders/DQ/DQ8GT3++HESEzT1obWBynE+++TI/-Tmp-//cc45w2pq.s:2:Expected comma after segment-name
/var/folders/DQ/DQ8GT3++HESEzT1obWBynE+++TI/-Tmp-//cc45w2pq.s:2:Rest of line ignored. 1st junk character valued 77 (M).
--

Yay!

I am not tied to my wording choice, we could also go with "uncoverable error"
for the prefix, or just leave it off entirely.

llvm-svn: 78554
2009-08-10 03:40:28 +00:00
Daniel Dunbar 481fe50903 Revert r78535, it is causing a number of failures to build projects.
--- Reverse-merging r78535 into '.':
D    test/Sema/altivec-init.c
U    include/clang/Basic/DiagnosticSemaKinds.td
U    include/clang/AST/Expr.h
U    include/clang/AST/StmtNodes.def
U    include/clang/Parse/Parser.h
U    include/clang/Parse/Action.h
U    tools/clang-cc/clang-cc.cpp
U    lib/Frontend/PrintParserCallbacks.cpp
U    lib/CodeGen/CGExprScalar.cpp
U    lib/Sema/SemaInit.cpp
U    lib/Sema/Sema.h
U    lib/Sema/SemaExpr.cpp
U    lib/Sema/SemaTemplateInstantiateExpr.cpp
U    lib/AST/StmtProfile.cpp
U    lib/AST/Expr.cpp
U    lib/AST/StmtPrinter.cpp
U    lib/Parse/ParseExpr.cpp
U    lib/Parse/ParseExprCXX.cpp

llvm-svn: 78551
2009-08-10 03:01:36 +00:00
Ryan Flynn e64ffc277c warn, as gcc does, if __attribute__((malloc)) applied to function returning non-pointer type
llvm-svn: 78542
2009-08-09 22:36:29 +00:00
Ryan Flynn 1f1fdc070e map previously ignored __attribute((malloc)) to noalias attribute of llvm function's return
llvm-svn: 78541
2009-08-09 20:07:29 +00:00
Anders Carlsson f48123b413 Improve handling of member pointers.
llvm-svn: 78536
2009-08-09 18:26:27 +00:00
Nate Begeman a96114ed08 AltiVec-style vector initializer syntax, vec4 a = (vec4)(a, b, c, d);
In addition to being defined by the AltiVec PIM, this is also the vector
initializer syntax used by OpenCL, so that vector literals are compatible
with macro arguments.

llvm-svn: 78535
2009-08-09 17:55:44 +00:00
Benjamin Kramer b57e5d2f4f Older GCCs don't have vector::data().
llvm-svn: 78519
2009-08-08 23:43:26 +00:00
Fariborz Jahanian 24f38969d5 ir-gen for initialization, in synthesize copy constructor,
of base/field which have trivial copy constructor.

llvm-svn: 78516
2009-08-08 23:32:22 +00:00
Anders Carlsson b8be93fc92 Add support for global initializers.
llvm-svn: 78515
2009-08-08 23:24:23 +00:00