Commit Graph

43 Commits

Author SHA1 Message Date
Aaron Ballman 6d1bebbad9 Switching to using dyn_cast_or_null, and fixing line endings in the test case.
llvm-svn: 150209
2012-02-09 22:16:56 +00:00
Aaron Ballman 3bc84198f4 Attempting to initialize a union member that does not exist no longer crashes.
Patch by Remi Gacogne

llvm-svn: 150144
2012-02-09 03:29:06 +00:00
Eli Friedman d8d7a37437 CheckStringInit has side effects; make sure we don't run it in VerifyOnly mode, at least for the moment. <rdar://problem/10185490>.
Sebastian, please take a look at this; I'm not entirely sure it is the right thing to do.

llvm-svn: 140552
2011-09-26 19:09:09 +00:00
Chris Lattner 88fdea8ad9 fix PR8217, a silent miscompilation of invalid code.
llvm-svn: 116166
2010-10-10 18:16:20 +00:00
Daniel Dunbar 53c9ac30f9 tests: Use -ffreestanding when including stdint.h, to avoid platform dependencies.
llvm-svn: 113301
2010-09-07 22:54:28 +00:00
Douglas Gregor a3208f9e7c Vector types are not arithmetic types, either. Note that we now ban
__real myvec and __imag myvec, since they aren't all that useful (it's
just an identity function) but we might want to use them in more
restricted cases in the future (e.g., "__real mycomplexvec" could
extract the real parts of a vector of complex numbers).

llvm-svn: 106601
2010-06-22 23:41:02 +00:00
Rafael Espindola a1f9cc1bec Fix PR4386 by implementing gcc's old behaviour (4.2) when initializing
variables with a comparison of a function pointer with 0.

llvm-svn: 103253
2010-05-07 15:18:43 +00:00
John McCall eae5acbbd0 Fix PR6327: restore invariants when there's a parse error in an initializer.
llvm-svn: 99980
2010-03-31 02:13:20 +00:00
Eli Friedman 7827520ce8 Initialization improvements: addition of string initialization and a few
small bug fixes in SemaInit, switch over SemaDecl to use it more often, and
change a bunch of diagnostics which are different with the new initialization
code.

llvm-svn: 91767
2009-12-19 08:11:05 +00:00
Daniel Dunbar 8fbe78f6fc Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Eli Friedman f3da334da6 Fix for PR5447: teach Evaluate to deal with floating-point conditionals.
llvm-svn: 90521
2009-12-04 02:12:53 +00:00
John McCall d5a36321b9 Reorganize the parsing of decl groups / function definitions so that
declarators are parsed primarily within a single function (at least for
these cases).  Remove some excess diagnostics arising during parse failures.

llvm-svn: 85924
2009-11-03 19:26:08 +00:00
Eli Friedman 42a8465518 Fix for PR4285: allow intializing a const wchar_t array with a wide
string.

llvm-svn: 72663
2009-05-31 10:54:53 +00:00
Douglas Gregor beecd58e21 Explictly track tentative definitions within Sema, then hand those
tentative definitions off to the ASTConsumer at the end of the
translation unit. 

Eliminate CodeGen's internal tracking of tentative definitions, and
instead hook into ASTConsumer::CompleteTentativeDefinition. Also,
tweak the definition-deferal logic for C++, where there are no
tentative definitions.

Fixes <rdar://problem/6808352>, and will make it much easier for
precompiled headers to cope with tentative definitions in the future.

llvm-svn: 69681
2009-04-21 17:11:58 +00:00
Chris Lattner efb0f111f1 hoist checks for ; and in out of ParseInitDeclaratorListAfterFirstDeclarator
into ParseSimpleDeclaration, and improve a diagnostic.

llvm-svn: 68009
2009-03-29 17:18:04 +00:00
Daniel Dunbar a45cf5b6b0 Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.

llvm-svn: 67602
2009-03-24 02:24:46 +00:00
Eli Friedman 94c25c66b5 Fix PR3868 by making Evaluate handle cases like "(long)&a + 4".
llvm-svn: 67593
2009-03-24 01:14:50 +00:00
Douglas Gregor 0760fa1618 Add type checking for tentative definitions at the end of the
translation unit.

Thread the various declarations of variables via
VarDecl::getPreviousDeclaration.

llvm-svn: 66601
2009-03-10 23:43:53 +00:00
Eli Friedman 3ae5911042 A few small improvements to Evaluate for stuff I noted in FIXMEs.
llvm-svn: 65305
2009-02-23 04:23:56 +00:00
Eli Friedman fd85266342 Fix test to be legal on 64-bit systems.
llvm-svn: 65270
2009-02-22 07:40:57 +00:00
Douglas Gregor 1cba5fe1d1 Downgrade the "excess elements in initializer" errors to warnings *in
C*. They're required errors in C++.

llvm-svn: 64964
2009-02-18 22:23:55 +00:00
Sebastian Redl 1d8cb2e0d0 Use our new snazzy stdint.h to make a testcase 64-bit portable.
llvm-svn: 63985
2009-02-07 00:23:52 +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 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 b66a312f93 Ignore parens when determining if an expr is a string literal. Fixes PR3382.
llvm-svn: 62922
2009-01-24 17:47:50 +00:00
Douglas Gregor 033d1257ca Properly manage the bit-widths of APInts/APSInts in array initialization.
Fixes PR clang/3377

llvm-svn: 62851
2009-01-23 16:54:12 +00:00
Douglas Gregor dd430f7ec9 Centralize error reporting of improper uses of incomplete types in the
new DiagnoseIncompleteType. It provides additional information about
struct/class/union/enum types when possible, either by pointing to the
forward declaration of that type or by pointing to the definition (if
we're in the process of defining that type). 
Fixes <rdar://problem/6500531>.

llvm-svn: 62521
2009-01-19 19:26:10 +00:00
Sebastian Redl 632ab20e1e Fix test cases broken by quote normalization in diagnostics.
llvm-svn: 59888
2008-11-22 22:39:41 +00:00
Chris Lattner 8c5dd730ce Fix PR3031 by silencing follow-on errors in invalid declarations.
llvm-svn: 59027
2008-11-11 06:13:16 +00:00
Argyrios Kyrtzidis 6709e7d4cc Fix crash caused by this:
void f() {
   int +; // crash here
}

llvm-svn: 58846
2008-11-07 13:01:22 +00:00
Chris Lattner 8cc7be369c Fix PR3001: if we have an error parsing an initializer, make sure to remove
the designator corresponding to it, otherwise Sema and later parsing will
get confused.

llvm-svn: 58603
2008-11-03 09:28:22 +00:00
Nuno Lopes dd30e2c677 add the other test case for completeness and to avoid regressions in the future
llvm-svn: 55629
2008-09-02 10:10:14 +00:00
Eli Friedman de09ce03c4 Fix for PR2747: allow pointer->int casts with a null base; these are
offset-of-like expressions.

llvm-svn: 55627
2008-09-02 09:37:00 +00:00
Daniel Dunbar 8d57244601 Add test case for function-pointer-cast-of-global as constant
expression.

llvm-svn: 55323
2008-08-25 20:08:27 +00:00
Chris Lattner 5caafe598f add testcase we already handle.
llvm-svn: 54967
2008-08-19 00:58:40 +00:00
Chris Lattner 28b4294ccf wrap some long diagnostics, make 'initializer is not a constant' diagnostic
a bit more clear (rdar://5646070)

llvm-svn: 54606
2008-08-10 01:58:45 +00:00
Eli Friedman 3360d898ec Make sure to allow assigning a pointer to a bool.
llvm-svn: 51778
2008-05-30 18:07:22 +00:00
Eli Friedman 86346ede95 Fix a couple of bugs found by Neil Booth in the const-ness checking.
llvm-svn: 51361
2008-05-21 03:39:11 +00:00
Chris Lattner cfcabaeb7f add testcase for pr2050 which is now fixed.
llvm-svn: 50610
2008-05-04 01:13:36 +00:00
Eli Friedman 4297826cac Improve diagnostic for illegal array initialization.
llvm-svn: 46869
2008-02-08 00:48:24 +00:00
Chris Lattner 6311b58000 all filevar's have static storage. Previously a global with
extern storage class was returning false from hasStaticStorage.
Ted, please review this.

llvm-svn: 44515
2007-12-02 07:47:49 +00:00
Chris Lattner da22eeca44 add several cases that Expr::hasStaticStorage missed, pointed out by Oliver Hunt
llvm-svn: 44376
2007-11-27 21:35:27 +00:00
Chris Lattner c3ebf29ef6 Implement test/Sema/init.c by treating functions as constants.
llvm-svn: 43599
2007-11-01 02:45:17 +00:00