Commit Graph

3405 Commits

Author SHA1 Message Date
Daniel Dunbar 6e3b7df125 Handle demotion of coerced arguments (as in void a(x) short x; { ... }).
llvm-svn: 63726
2009-02-04 07:22:24 +00:00
Chris Lattner 1c967784f3 Implement handling of file entry/exit notifications from GNU
line markers, including maintenance of the virtual include stack.

For something like this:

# 42 "bar.c" 1
# 142 "bar2.c" 1

#warning zappa
# 92 "bar.c" 2
#warning gonzo
# 102 "foo.c" 2
#warning bonkta


we now produce these three warnings:

#1:
In file included from foo.c:3:
In file included from bar.c:42:
bar2.c:143:2: warning: #warning zappa
#warning zappa
 ^

#2:
In file included from foo.c:3:
bar.c:92:2: warning: #warning gonzo
#warning gonzo
 ^

#3:
foo.c:102:2: warning: #warning bonkta
#warning bonkta
 ^

llvm-svn: 63722
2009-02-04 06:25:26 +00:00
Chris Lattner 95d9c5e778 make getFileCharacteristic linetable aware. line markers that
play around with the 'is system header' bit now function correctly.

llvm-svn: 63720
2009-02-04 05:33:01 +00:00
Chris Lattner 0a1a8d8514 propagate linemarker flags down into the the line table, currently
ignoring include stack push/pop info though.

llvm-svn: 63719
2009-02-04 05:21:58 +00:00
Chris Lattner 334a2ada06 replace gimpy linear search with svelte binary search ;-)
llvm-svn: 63717
2009-02-04 04:46:59 +00:00
Zhongxing Xu 6d5fe08e1b Remove dead code.
llvm-svn: 63715
2009-02-04 02:30:11 +00:00
Chris Lattner 8411e168f8 make my atrocious linear search at least search in the order that is
more likely to hit.

llvm-svn: 63714
2009-02-04 02:29:52 +00:00
Chris Lattner 20c50ba26c add comment
llvm-svn: 63712
2009-02-04 02:15:40 +00:00
Chris Lattner c1219ff7cc add the difference in the line marker phys line number and the
query point to the returned presumed location.  We now produce:

foo.h:92:2: warning: #warning blarg!
#warning blarg!
 ^
foo.h:93:2: warning: #warning blarg!
#warning blarg!
 ^
foo.h:94:2: warning: #warning blarg!
#warning blarg!
 ^

for:

#line 92 "foo.h"
#warning blarg!
#warning blarg!
#warning blarg!

blarg indeed!

llvm-svn: 63710
2009-02-04 02:00:59 +00:00
Chris Lattner d429392285 add really really trivial #line support, where #line now makes every
location below it report as coming from the #line location.  For example,
with:

#line 92 "foo.h"
#warning blarg!
#warning blarg!

we now emit:

foo.h:92:2: warning: #warning blarg!
#warning blarg!
 ^
foo.h:92:2: warning: #warning blarg!
#warning blarg!
 ^

llvm-svn: 63709
2009-02-04 01:55:42 +00:00
Chris Lattner 88ea93e6b4 lower the interface to getLineNumber like we did for
getColumnNumber.  This fixes a FIXME in 
SourceManager::getPresumedLoc because we now just decompose
the sloc once.

llvm-svn: 63701
2009-02-04 01:06:56 +00:00
Chris Lattner e4ad417664 make SM::getColumnNumber take a predecomposed FileID/offset, which
makes it clear to clients that they have to pick an instantiation
or spelling location before calling it and allows optimization based
on that.

llvm-svn: 63698
2009-02-04 00:55:58 +00:00
Daniel Dunbar 310c5b1ab1 Update passing of _Bool values to match what function was declared to take.
llvm-svn: 63697
2009-02-04 00:55:44 +00:00
Daniel Dunbar 4d22e4975a Change construction of common ObjC functions to use CGCall
infrastructure to construct function type.
 - For consistencty, we should probably always use this to construct
   function types, but these are absolutely necessary to ensure that
   we can emit calls to these functions.

llvm-svn: 63695
2009-02-04 00:44:42 +00:00
Chris Lattner 153a0f1f52 build per-fid linetable entries.
llvm-svn: 63694
2009-02-04 00:40:31 +00:00
Douglas Gregor e254f90d94 Initial implementation of argument dependent lookup (a.k.a. ADL,
a.k.a. Koenig lookup) in C++. Most of the pieces are in place, but for
two:

  - In an unqualified call g(x), even if the name does not refer to
    anything in the current scope, we can still find functions named
    "g" based on ADL. We don't yet have this ability.
  - ADL will need updating for friend functions and templates.

llvm-svn: 63692
2009-02-04 00:32:51 +00:00
Fariborz Jahanian 3d9296e6f5 Some function stub added for new abi messaging.
llvm-svn: 63691
2009-02-04 00:22:57 +00:00
Daniel Dunbar 84388bf397 Use CGCall infrastructure to call enumeration mutation function.
llvm-svn: 63685
2009-02-03 23:55:40 +00:00
Fariborz Jahanian 82c72e1ee4 Several new declarations for objc2 nonfragile
abi messaging.

llvm-svn: 63684
2009-02-03 23:49:23 +00:00
Daniel Dunbar 1ef7373ee8 Fix return type for calls to objc_setProperty.
llvm-svn: 63683
2009-02-03 23:43:59 +00:00
Daniel Dunbar a33461150d Use ConvertTypeForMem when creating alloca for scalar argument.
llvm-svn: 63681
2009-02-03 23:04:57 +00:00
Daniel Dunbar ee3da87ce7 Add CodeGenFunction::ConvertTypeForMem forwarding function.
llvm-svn: 63678
2009-02-03 23:03:55 +00:00
Chris Lattner 6e0e1f49a5 more plumbing for #line propagation. Use happy bit #3
out of FileInfo :)

llvm-svn: 63672
2009-02-03 22:13:05 +00:00
Chris Lattner 1eaa70a612 stub out basic #line handling calls.
llvm-svn: 63667
2009-02-03 21:52:55 +00:00
Fariborz Jahanian e80f317886 GNUStep fast enumeration.
Patch by David Chisnall.

llvm-svn: 63666
2009-02-03 21:52:35 +00:00
Chris Lattner 1927267b9d silence some warnings.
llvm-svn: 63662
2009-02-03 21:29:32 +00:00
Sebastian Redl 3d3f75a995 Allow taking the address of data members, resulting in a member pointer.
Pointers to functions don't work yet, and pointers to overloaded functions even less. Also, far too much illegal code is accepted.

llvm-svn: 63655
2009-02-03 20:19:35 +00:00
Daniel Dunbar fc7c76159c x86_64 ABI: Initial implementation of ABI compliant parameter passing.
- Now only 27/500 failures on ABITest single argument tests; from
   350/500. :)
 - As with return types, a large percentage of these are likely to be
   gcc bugs, not yet reviewed.

Also, fix bug in handling of Ignore ABI type in argument lists.

llvm-svn: 63654
2009-02-03 20:00:13 +00:00
Douglas Gregor 4489e9465f When looking for a tag name via unqualified name lookup, only look in
scopes where the name would be considered a redeclaration if we know
that we're declaring or defining that tag.

llvm-svn: 63647
2009-02-03 19:26:08 +00:00
Douglas Gregor 889ceb752d Semantic analysis, ASTs, and unqualified name lookup support for C++
using directives, from Piotr Rak!

llvm-svn: 63646
2009-02-03 19:21:40 +00:00
Daniel Dunbar 2f219b0770 ABI handling: Implement coercion for argument types (in addition to
return types).

llvm-svn: 63645
2009-02-03 19:12:28 +00:00
Fariborz Jahanian 712bfa6478 ir-gen for nonfragile ivar bitfield access (objc2 nonfragile abi).
llvm-svn: 63644
2009-02-03 19:03:09 +00:00
Sanjiv Gupta c1b58d40e6 Targets that don't have stack use global address space for parameters.
Specify external linkage for such globals so that llvm optimizer do
not assume there values initialized as zero.

llvm-svn: 63636
2009-02-03 18:07:49 +00:00
Fariborz Jahanian ebc4c9d2a3 Minor objc2 bug fix.
llvm-svn: 63635
2009-02-03 17:34:34 +00:00
Sanjiv Gupta 3cac613eb8 Fixed the typo in comment.
llvm-svn: 63634
2009-02-03 17:23:12 +00:00
Chris Lattner 9be4f6d6c7 reclaim my precious bit in FileInfo by ensuring that ContentCache objects
are 8-byte aligned.

llvm-svn: 63630
2009-02-03 07:41:46 +00:00
Chris Lattner c8233df64b switch SourceManager from using an std::map and std::list of
ContentCache objects to using a densemap and list, and allocating
the ContentCache objects from a bump pointer.  This does not speed
up or slow down things substantially, but gives us control over 
their alignment.

llvm-svn: 63628
2009-02-03 07:30:45 +00:00
Daniel Dunbar 32931eb21d Change ABIInfo to compute information for a full signature at a time
(the main point of this restructing).

llvm-svn: 63619
2009-02-03 06:51:18 +00:00
Daniel Dunbar 0136282a9c Remove ABIArgInfo::Default kind, ABI is now responsible for specifying
acceptable kind with more precise semantics.

llvm-svn: 63617
2009-02-03 06:30:17 +00:00
Daniel Dunbar 67dace890f Add ABIArgInfo::Direct kind, which passes arguments using whatever the
native IRgen type is. This is like Default, but without any extra
semantics (like automatic tweaking of structures or void).

llvm-svn: 63615
2009-02-03 06:17:37 +00:00
Daniel Dunbar 5a0acdc982 Add two FIXMEs.
llvm-svn: 63613
2009-02-03 06:02:10 +00:00
Daniel Dunbar b52d077d8b Always use CGFunctionInfo to access ABI information.
llvm-svn: 63612
2009-02-03 05:59:18 +00:00
Daniel Dunbar 313321ea23 Move ABIArgInfo into CGFunctionInfo, computed on creation.
- Still have to convert some consumers over.

llvm-svn: 63610
2009-02-03 05:31:23 +00:00
Daniel Dunbar 6d6b0d309a Move ABIInfo/ABIArgInfo classes into ABIInfo.h
llvm-svn: 63586
2009-02-03 01:05:53 +00:00
Douglas Gregor 8761da5f68 Simplify the way in which we inject the names of tag definitions and
elaborated-type-specifier declarations into outer scopes while
retaining their proper lexical scope. This way is simpler and more
consistent with the way DeclContexts work, and also fixes

  http://llvm.org/bugs/show_bug.cgi?id=3430

llvm-svn: 63581
2009-02-03 00:34:39 +00:00
Fariborz Jahanian c88a70d885 objc2's ir-gen for nonfragile ivar access.
llvm-svn: 63578
2009-02-03 00:09:52 +00:00
Daniel Dunbar e0be82956b Memoize CGFunctionInfo construction.
llvm-svn: 63576
2009-02-03 00:07:12 +00:00
Mike Stump 99231d5c98 Formatting fix.
llvm-svn: 63573
2009-02-02 23:46:21 +00:00
Daniel Dunbar 3668cb2d3c Change CGFunctionInfo args iterator to not include the return type.
llvm-svn: 63571
2009-02-02 23:43:58 +00:00
Douglas Gregor 8bd3c2ebac Add a macro-based enumeration of all of the Decl nodes (like we do
with Stmt/Expr nodes), and convert some of the more mundane
switch-on-all-decl-kinds uses over to use this new file.

llvm-svn: 63570
2009-02-02 23:39:07 +00:00
Daniel Dunbar bf8c24ad89 Thread CGFunctionInfo construction through CodeGenTypes.
- Inefficient & leaks memory currently, will be cleaned up subsequently.

llvm-svn: 63567
2009-02-02 23:23:47 +00:00
Nuno Lopes 7cffb63a9d emit diagnostic when casting a ptr to a small int when doing static initialization (addresses Eli's comments I believe)
llvm-svn: 63562
2009-02-02 22:57:15 +00:00
Nuno Lopes 026bcde14b fix TryToFixInvalidVariablyModifiedType to reject negative array sizes
llvm-svn: 63557
2009-02-02 22:32:08 +00:00
Douglas Gregor bb2e688396 Steve set me straight on this one. GCC was right, EDG was wrong: the
direct-initialization following a user-defined conversion can select
any constructor; it just can't employ any user-defined
conversions. So we ban those conversions and classify the constructor
call based on the relationship between the "from" and "to" types in
the conversion.

llvm-svn: 63554
2009-02-02 22:11:10 +00:00
Daniel Dunbar d931a87f90 More ABI API cleanup.
- Lift CGFunctionInfo creation above ReturnTypeUsesSret and
   EmitFunction{Epi,Pro}log.

llvm-svn: 63553
2009-02-02 22:03:45 +00:00
Ted Kremenek e9aee88eed Clean up indentation.
llvm-svn: 63551
2009-02-02 21:45:32 +00:00
Daniel Dunbar 7633cbf005 ABI handling API changes.
- Lift CGFunctionInfo creation up to callers of EmitCall.

 - Move isVariadic bit out of CGFunctionInfo, take as argument to
   GetFunctionType instead.

No functionality change.

llvm-svn: 63550
2009-02-02 21:43:58 +00:00
Douglas Gregor 0e8fc3c773 Add iterators to LookupResult, allowing one to iterate over the
non-ambiguous name lookup results without allocating any memory, e.g.,
for sets of overloaded functions.

llvm-svn: 63549
2009-02-02 21:35:47 +00:00
Fariborz Jahanian 9f84b78ac1 Refactored code gen for ivar access in preparation for
objc2 nonfragile ivar access code gen.

llvm-svn: 63541
2009-02-02 20:02:29 +00:00
Daniel Dunbar f5589ac5a9 Shuffle some functions around, no functionality change.
llvm-svn: 63538
2009-02-02 19:06:38 +00:00
Steve Naroff 49140cb544 Change the ObjC type encoding for block pointer types to "@?" (for consistency with GCC).
This fixes <rdar://problem/6538564> clang ObjC rewriter: Wrong encoding emitted for methods with Block parameters.

llvm-svn: 63534
2009-02-02 18:24:29 +00:00
Daniel Dunbar 50f520171c Add FIXME.
llvm-svn: 63531
2009-02-02 18:06:39 +00:00
Douglas Gregor a5c9e1ae93 Check value-initializations that occur when an initializer list
provides too few elements.

llvm-svn: 63525
2009-02-02 17:43:21 +00:00
Nuno Lopes 598afdcfe7 allow cast from array to int to be considered as constant
llvm-svn: 63519
2009-02-02 16:07:41 +00:00
Nuno Lopes 8877f99f9d fix PR3459: improve compatibility with gcc when checking for constant exprs
llvm-svn: 63517
2009-02-02 15:00:55 +00:00
Eli Friedman 1f90fe17f9 Fix for PR3447: use padded sizes for computations on struct/union
constants.

llvm-svn: 63491
2009-02-01 08:12:19 +00:00
Daniel Dunbar 5df2b0baaa Remove unused overload of GetFunctionType.
llvm-svn: 63472
2009-01-31 03:05:44 +00:00
Daniel Dunbar a8b7f6bb13 Initialize CGFunctionInfo isVariadic bit correctly.
llvm-svn: 63471
2009-01-31 02:54:56 +00:00
Fariborz Jahanian c22f236e81 Use target alignment API to set objc2's meta-data
alignment.

llvm-svn: 63470
2009-01-31 02:43:27 +00:00
Daniel Dunbar a37249c663 Err, unbreak my previous "no functionality change commit", will fix properly later.
llvm-svn: 63467
2009-01-31 02:20:43 +00:00
Daniel Dunbar 3cd20632ff Kill off CGCallInfo, always use CGFunctionInfo for encapsulating
function/call info.

llvm-svn: 63466
2009-01-31 02:19:00 +00:00
Anders Carlsson d277d790e0 Add sema support for the cleanup attribute.
llvm-svn: 63462
2009-01-31 01:16:18 +00:00
Fariborz Jahanian 0408723269 class meta-data belong to __objc_data section (in objc2
nonfragile abi).

llvm-svn: 63461
2009-01-31 01:07:39 +00:00
Fariborz Jahanian 822082517f Recognize class's visibility attribute and set its linkage
to private extern (in objc2 nonfragile abi).

llvm-svn: 63460
2009-01-31 00:59:10 +00:00
Daniel Dunbar 34aa3ca8c4 x86_64 ABI: Retool classification to compute lo & hi classifications
in terms of where the type resides in the containing object. This is a
more clear embodiement of the spec & fixes a merging issue with
unions. Down to 3/1000 failures.

llvm-svn: 63455
2009-01-31 00:06:58 +00:00
Fariborz Jahanian 75e0351adb Missed another mis-alignment of an objc2 meta-data.
llvm-svn: 63453
2009-01-30 23:51:52 +00:00
Douglas Gregor 576e98cc1e Improve our handling of the second step in a user-defined conversion
sequence. Previously, we weren't permitting the second step to call
copy constructors, which left user-defined conversion sequences
surprisingly broken.

Now, we perform overload resolution among all of the constructors, but
only accept the result if it makes the conversion a standard
conversion. Note that this behavior is different from both GCC and EDG
(which don't agree with each other, either); I've submitted a core
issue on the matter.

llvm-svn: 63450
2009-01-30 23:27:23 +00:00
Anders Carlsson db5a9b675c Turn on -flax-vector-conversions by default, issue a warning whenever one is done. Add a -fnolax-vector-conversions option. Fixes PR2862.
llvm-svn: 63447
2009-01-30 23:17:46 +00:00
Fariborz Jahanian e46e284efd Setting correct alignent for objc2 meta-data.
llvm-svn: 63445
2009-01-30 23:15:42 +00:00
Daniel Dunbar 6a046c64d9 x86_64 ABI: Fix more thinkos, straddling computation for complex was
computing in bytes not bits. We are now down to 22/1000 failures on
the return types tests, and 18 of those are gcc bugs I believe.

llvm-svn: 63438
2009-01-30 22:40:15 +00:00
Douglas Gregor d42a0fb41b Upgrade the "excess elements in array initializer" warning to an
error, since both C99 and C++ consider it an error. For reference, GCC
makes this a warning while G++ makes it an error.

llvm-svn: 63435
2009-01-30 22:26:29 +00:00
Douglas Gregor d14247a9e5 Implement and test aggregate initialization in C++. Major changes:
- Support initialization of reference members; complain if any
  reference members are left uninitialized.
  - Use C++ copy-initialization for initializing each element (falls
  back to constraint checking in C)
  - Make sure we diagnose when one tries to provide an initializer
  list for a non-aggregate.
  - Don't complain about empty initializers in C++ (they are permitted)
  - Unrelated but necessary: don't bother trying to convert the
  decl-specifier-seq to a type when we're dealing with a C++
  constructor, destructor, or conversion operator; it results in
  spurious warnings.

llvm-svn: 63431
2009-01-30 22:09:00 +00:00
Fariborz Jahanian fa57e8e7ab add imag_info section and data (for objc2 nonfragile abi).
llvm-svn: 63430
2009-01-30 22:07:48 +00:00
Daniel Dunbar c35dca92f5 x86_64 ABI: Fix thinko in prev commit, 64-bit vectors should have SSE
class, not integer.

llvm-svn: 63426
2009-01-30 21:50:20 +00:00
Ted Kremenek 378e7fd330 Fix horrible non-termination bug in LiveVariables. The issue was that
the liveness state of block-level expressions could oscillate because
of two issues:
- The initial value before a merge was not always set to "Top"
- The set of live block-level expressions is a union, not an intersection

This fixes <rdar://problem/650084>.

llvm-svn: 63421
2009-01-30 21:35:30 +00:00
Fariborz Jahanian 279abd31a9 Generate list of implemented classes and categories in their
own sections (related to objc2 nonfragile abi).

llvm-svn: 63418
2009-01-30 20:55:31 +00:00
Daniel Dunbar 4d22eaeb44 x86_64 ABI: Pass <1 x double> in memory. This is arguably wrong, but
matches gcc 4.2 (not llvm-gcc).

llvm-svn: 63413
2009-01-30 19:38:39 +00:00
Ted Kremenek 0b0a64830a Move method out-of-line.
llvm-svn: 63412
2009-01-30 19:27:39 +00:00
Fariborz Jahanian 097feda5e0 Code gen. for @protocol expression in the new nonfragile abi.
llvm-svn: 63408
2009-01-30 18:58:59 +00:00
Daniel Dunbar 7da8d0b321 Remove testing -use-x86_64-abi option; current implementation is
robust enough for general use.

llvm-svn: 63406
2009-01-30 18:47:53 +00:00
Daniel Dunbar 890c6b5520 x86_64 ABI: Split small vectors which cross an eightbyte boundary. Down to 33/500 return type failures.
llvm-svn: 63404
2009-01-30 18:40:10 +00:00
Chris Lattner 1958677ccf " Attached is a patch for TextDiagnosticPrinter that adds an optional
parameter that allows users to omit the printing of the source
location on a diagnostic. So basically it would omit the "abc.c:5:1: "
at the beginning of the line."

Patch by Alexei Svitkine!

llvm-svn: 63396
2009-01-30 17:41:53 +00:00
Douglas Gregor ddb2485eb6 Switch Type::isAggregateType to use the C++ definition of "aggregate
type" rather than the C definition. We do this because both C99 and
Clang always use "aggregate type" as "aggregate or union type", and
the C++ definition includes union types.

llvm-svn: 63395
2009-01-30 17:31:00 +00:00
Anders Carlsson 221483dd4e Make sure to cast the VLA size of array to the type of size_t. Fixes PR3442.
llvm-svn: 63394
2009-01-30 16:41:04 +00:00
Steve Naroff 3b6a4bd891 Simplify/cleanup r63219 (based on Chris review).
llvm-svn: 63393
2009-01-30 14:23:32 +00:00
Daniel Dunbar f5222fa0ad x86_64 ABI: Implement classification for arrays.
- This brings us down to an 8% failure rate on the first 500 return
   types tests (from 12%).

llvm-svn: 63383
2009-01-30 08:09:32 +00:00
Anders Carlsson 02714ed353 Implement constant generation of ImplicitValueInitExprs.
llvm-svn: 63379
2009-01-30 06:13:25 +00:00
Chris Lattner 34beb046ea update for change in API.
llvm-svn: 63363
2009-01-30 01:58:33 +00:00
Douglas Gregor ed8f288708 Eliminated LookupCriteria, whose creation was causing a bottleneck for
LookupName et al. Instead, use an enum and a bool to describe its
contents.

Optimized the C/Objective-C path through LookupName, eliminating any
unnecessarily C++isms. Simplify IdentifierResolver::iterator, removing
some code and arguments that are no longer used.

Eliminated LookupDeclInScope/LookupDeclInContext, moving all callers
over to LookupName, LookupQualifiedName, or LookupParsedName, as
appropriate.

All together, I'm seeing a 0.2% speedup on Cocoa.h with PTH and
-disable-free. Plus, we're down to three name-lookup routines.

llvm-svn: 63354
2009-01-30 01:04:22 +00:00
Daniel Dunbar 62dc51c395 Use uint64_t not unsigned for type sizes/offsets.
llvm-svn: 63352
2009-01-30 00:47:38 +00:00