Commit Graph

1886 Commits

Author SHA1 Message Date
Chris Lattner 79f6de0fd0 true is pass, false is success.
llvm-svn: 63627
2009-02-03 07:28:12 +00:00
Chris Lattner 96960c82db disable this test too
llvm-svn: 63626
2009-02-03 07:25:43 +00:00
Chris Lattner a8be8de596 make this fail faster.
llvm-svn: 63625
2009-02-03 07:24: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
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
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
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 0c92d25f2b avoid creating tmp files elsewhere
llvm-svn: 63518
2009-02-02 15:33:56 +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
Anders Carlsson 12beab7085 Forgot to add this test.
llvm-svn: 63484
2009-01-31 19:07:49 +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 f6e6057e92 Fix typo noticed by Chris.
llvm-svn: 63449
2009-01-30 23:26:40 +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
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
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
Chris Lattner be70ced6a6 add testcase for PR3437 and r63405
llvm-svn: 63407
2009-01-30 18:49:16 +00:00
Douglas Gregor d5576dee1c Closed out a few radars that were addressed by designated initializers
llvm-svn: 63398
2009-01-30 17:42:28 +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
Nuno Lopes 8247c9a38f fix RUN line
llvm-svn: 63392
2009-01-30 14:03:37 +00:00
Nuno Lopes c3a558fd45 enable test as it works
llvm-svn: 63391
2009-01-30 13:01:29 +00:00
Nuno Lopes 92f95eb739 enable test as it already works
llvm-svn: 63390
2009-01-30 12:58:18 +00:00
Ted Kremenek 7594e2a59a Fix a couple bugs:
- NonLoc::MakeVal() would use sizeof(unsigned) (literally) instead of consulting
  ASTContext for the size (in bits) of 'int'. While it worked, it was a
  conflation of concepts and using ASTContext.IntTy is 100% correct.
- RegionStore::getSizeInElements() no longer assumes that a VarRegion has the
  type "ConstantArray", and handles the case when uses use ordinary variables
  as if they were arrays.
- Fixed ElementRegion::getRValueType() to just return the rvalue type of its
  "array region" in the case the array didn't have ArrayType.
- All of this fixes <rdar://problem/6541136>

llvm-svn: 63347
2009-01-30 00:08:43 +00:00
Ted Kremenek ed90de4caa retain/release checker: When generating summaries for CF/CG functions, allow arguments to "escape" if they are passed to a function containing the terms "InsertValue", "SetValue", or "AddValue". This fixes <rdar://problem/6539791>.
llvm-svn: 63341
2009-01-29 22:45:13 +00:00
Douglas Gregor bf7207a11f Make CodeGen produce an error if we come across a non-constant initializer list that involves the GNU array-range designator extension
llvm-svn: 63327
2009-01-29 19:42:23 +00:00
Douglas Gregor 0202cb406e Introduce a new expression node, ImplicitValueInitExpr, that
represents an implicit value-initialization of a subobject of a
particular type. This replaces the (ab)use of CXXZeroValueInitExpr
within initializer lists for the "holes" that occur due to the use of
C99 designated initializers.

The new test case is currently XFAIL'd, because CodeGen's
ConstExprEmitter (in lib/CodeGen/CGExprConstant.cpp) needs to be
taught to value-initialize when it sees ImplicitValueInitExprs.

llvm-svn: 63317
2009-01-29 17:44:32 +00:00
Daniel Dunbar 74f2425b89 Evaluate ==,!= for complex types.
llvm-svn: 63280
2009-01-29 06:43:41 +00:00
Douglas Gregor 35a52fabf4 Add another devilish testcase for designated initializers
llvm-svn: 63262
2009-01-29 01:10:11 +00:00
Douglas Gregor f6d2752f12 Eliminate infinite looping in a wacky case with designated initializers. Simplifies (somewhat) the actually checking of the initializer expression following the designators
llvm-svn: 63257
2009-01-29 00:39:20 +00:00
Douglas Gregor 17bd094a6b Improvements to code-generation and semantic analysis of designated
initializers.

  - We now initialize unions properly when a member other than the
    first is named by a designated initializer.
  - We now provide proper semantic analysis and code generation for
    GNU array-range designators *except* that side effects will occur
    more than once. We warn about this.

llvm-svn: 63253
2009-01-28 23:36:17 +00:00
Daniel Dunbar f50e60b23a Implement basic _Complex integer constant folding.
- Merged into single ComplexEvaluator, these share too much logic to
   be worth splitting for float/int (IMHO). Will split on request.

llvm-svn: 63248
2009-01-28 22:24:07 +00:00
Douglas Gregor 347f7eabb9 Code generation support for C99 designated initializers.
The approach I've taken in this patch is relatively straightforward,
although the code itself is non-trivial. Essentially, as we process
an initializer list we build up a fully-explicit representation of the
initializer list, where each of the subobject initializations occurs
in order. Designators serve to "fill in" subobject initializations in
a non-linear way. The fully-explicit representation makes initializer
lists (both with and without designators) easy to grok for codegen and
later semantic analyses. We keep the syntactic form of the initializer
list linked into the AST for those clients interested in exactly what
the user wrote.

Known limitations:
  - Designating a member of a union that isn't the first member may
    result in bogus initialization (we warn about this)
  - GNU array-range designators are not supported (we warn about this)

llvm-svn: 63242
2009-01-28 21:54:33 +00:00
Ted Kremenek c783209605 retain/release checker: Always generate an "autorelease" summary for an "autorelease" message, and have the summary processing logic treat it as a no-op in GC mode. This change is motivated to encode more of the semantics in the summaries themselves for eventual better diagnostics.
llvm-svn: 63241
2009-01-28 21:44:40 +00:00
Daniel Dunbar 804c0441c2 Handle complex types in ASTContext::mergeTypes
llvm-svn: 63238
2009-01-28 21:22:12 +00:00
Ted Kremenek f675864e3c Add autorelease test case.
llvm-svn: 63237
2009-01-28 21:20:48 +00:00
Sebastian Redl ed8f200318 Implement pointer to member handling in static_cast.
Fix a stupid mistake in UnwrapSimilarPointers that made any two member pointers compatible as long as the pointee was the same.
Make a few style corrections as suggested by Chris.

llvm-svn: 63215
2009-01-28 18:33:18 +00:00
Douglas Gregor fb03466388 Complete semantic checking for typedef redeclarations in C++. The
rules are slightly different than in C, and now we handle both
dialects properly.

llvm-svn: 63211
2009-01-28 17:15:10 +00:00
Ted Kremenek 4daeccf28f retain/release checker: Improve diagnostics to indicate that CF objects are not automatically garbage collected.
llvm-svn: 63187
2009-01-28 06:25:48 +00:00
Chris Lattner 64d8fc25d6 fix a crash I introduced, thanks to Ted for the awesome reduced
testcase :)

llvm-svn: 63182
2009-01-28 05:42:38 +00:00
Nuno Lopes b81d94ff58 add test for PR2502, which was already fixed some time ago
llvm-svn: 63160
2009-01-28 00:44:33 +00:00
Nuno Lopes bb537dc189 fix PR3427: fix debuginfo for incomplete array types
llvm-svn: 63158
2009-01-28 00:35:17 +00:00
Sebastian Redl a5a77a6dc6 Add handling of member pointers to reinterpret_cast.
llvm-svn: 63150
2009-01-27 23:18:31 +00:00
Anders Carlsson 570c357ded If an input constraint refers to an output constraint, it should have the same constraint info as the output constraint. Fixes PR3417
llvm-svn: 63127
2009-01-27 20:38:24 +00:00
Chris Lattner 75441a3870 eliminate some random .ll file outputs
llvm-svn: 63117
2009-01-27 18:56:08 +00:00
Ted Kremenek 422d81dcd4 Fix bug in BasicStore::getLValueElement where if the base of an array subscript expression was an ElementRegion we stacked another ElementRegion on top of that.
This fixes PR 3422.

llvm-svn: 63110
2009-01-27 18:29:03 +00:00
Eli Friedman eb3a9b03ab Fix for PR3418: make sure to handle the RHS of expressions starting with
__extension__.  This sort of construct shows up in the gcc source code.

llvm-svn: 63100
2009-01-27 08:43:38 +00:00
Chris Lattner f1ca7d3e02 Introduce a new PresumedLoc class to represent the concept of a location
as reported to the user and as manipulated by #line.  This is what __FILE__,
__INCLUDE_LEVEL__, diagnostics and other things should follow (but not 
dependency generation!).  

This patch also includes several cleanups along the way: 

- SourceLocation now has a dump method, and several other places 
  that did similar things now use it.
- I cleaned up some code in AnalysisConsumer, but it should probably be
  simplified further now that NamedDecl is better.
- TextDiagnosticPrinter is now simplified and cleaned up a bit.

This patch is a prerequisite for #line, but does not actually provide 
any #line functionality.

llvm-svn: 63098
2009-01-27 07:57:44 +00:00