summaryrefslogtreecommitdiff
path: root/test/Sema/init.c
Commit message (Collapse)AuthorAge
* Make Expr::isConstantInitializer match IRGen.Eli Friedman2013-07-16
| | | | | | | | | | Sema needs to be able to accurately determine what will be emitted as a constant initializer and what will not, so we get accurate errors in C and accurate -Wglobal-constructors warnings in C++. This makes Expr::isConstantInitializer match CGExprConstant as closely as possible. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186464 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the test for PR13720 from Sema/init.c to Sema/thread-specifier.c.Hans Wennborg2012-08-29
| | | | | | | Can't use __thread in init.c because it doesn't have a triple. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162836 91177308-0d34-0410-b5e6-96231b3b80d8
* The address of a TLS var is not compile-time constant (PR13720)Hans Wennborg2012-08-29
| | | | | | | | | | | | This makes Clang produce an error for code such as: __thread int x; int *p = &x; The lvalue of a thread-local variable cannot be evaluated at compile time. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162835 91177308-0d34-0410-b5e6-96231b3b80d8
* Switching to using dyn_cast_or_null, and fixing line endings in the test case.Aaron Ballman2012-02-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150209 91177308-0d34-0410-b5e6-96231b3b80d8
* Attempting to initialize a union member that does not exist no longer crashes.Aaron Ballman2012-02-09
| | | | | | Patch by Remi Gacogne git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150144 91177308-0d34-0410-b5e6-96231b3b80d8
* CheckStringInit has side effects; make sure we don't run it in VerifyOnly ↵Eli Friedman2011-09-26
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140552 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR8217, a silent miscompilation of invalid code.Chris Lattner2010-10-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116166 91177308-0d34-0410-b5e6-96231b3b80d8
* tests: Use -ffreestanding when including stdint.h, to avoid platform ↵Daniel Dunbar2010-09-07
| | | | | | dependencies. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113301 91177308-0d34-0410-b5e6-96231b3b80d8
* Vector types are not arithmetic types, either. Note that we now banDouglas Gregor2010-06-22
| | | | | | | | | | __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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106601 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR4386 by implementing gcc's old behaviour (4.2) when initializingRafael Espindola2010-05-07
| | | | | | | | variables with a comparison of a function pointer with 0. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103253 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR6327: restore invariants when there's a parse error in an initializer.John McCall2010-03-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99980 91177308-0d34-0410-b5e6-96231b3b80d8
* Initialization improvements: addition of string initialization and a fewEli Friedman2009-12-19
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91767 91177308-0d34-0410-b5e6-96231b3b80d8
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-15
| | | | | | | | | - 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91446 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix for PR5447: teach Evaluate to deal with floating-point conditionals.Eli Friedman2009-12-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90521 91177308-0d34-0410-b5e6-96231b3b80d8
* Reorganize the parsing of decl groups / function definitions so thatJohn McCall2009-11-03
| | | | | | | | | declarators are parsed primarily within a single function (at least for these cases). Remove some excess diagnostics arising during parse failures. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85924 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix for PR4285: allow intializing a const wchar_t array with a wide Eli Friedman2009-05-31
| | | | | | | | string. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72663 91177308-0d34-0410-b5e6-96231b3b80d8
* Explictly track tentative definitions within Sema, then hand thoseDouglas Gregor2009-04-21
| | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69681 91177308-0d34-0410-b5e6-96231b3b80d8
* hoist checks for ; and in out of ParseInitDeclaratorListAfterFirstDeclaratorChris Lattner2009-03-29
| | | | | | | into ParseSimpleDeclaration, and improve a diagnostic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68009 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename clang to clang-cc.Daniel Dunbar2009-03-24
| | | | | | | Tests and drivers updated, still need to shuffle dirs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67602 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR3868 by making Evaluate handle cases like "(long)&a + 4".Eli Friedman2009-03-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67593 91177308-0d34-0410-b5e6-96231b3b80d8
* Add type checking for tentative definitions at the end of theDouglas Gregor2009-03-10
| | | | | | | | | | | translation unit. Thread the various declarations of variables via VarDecl::getPreviousDeclaration. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66601 91177308-0d34-0410-b5e6-96231b3b80d8
* A few small improvements to Evaluate for stuff I noted in FIXMEs.Eli Friedman2009-02-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65305 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix test to be legal on 64-bit systems.Eli Friedman2009-02-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65270 91177308-0d34-0410-b5e6-96231b3b80d8
* Downgrade the "excess elements in initializer" errors to warnings *inDouglas Gregor2009-02-18
| | | | | | | C*. They're required errors in C++. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64964 91177308-0d34-0410-b5e6-96231b3b80d8
* Use our new snazzy stdint.h to make a testcase 64-bit portable.Sebastian Redl2009-02-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63985 91177308-0d34-0410-b5e6-96231b3b80d8
* Add iterators to LookupResult, allowing one to iterate over theDouglas Gregor2009-02-02
| | | | | | | | non-ambiguous name lookup results without allocating any memory, e.g., for sets of overloaded functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63549 91177308-0d34-0410-b5e6-96231b3b80d8
* Closed out a few radars that were addressed by designated initializersDouglas Gregor2009-01-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63398 91177308-0d34-0410-b5e6-96231b3b80d8
* Ignore parens when determining if an expr is a string literal. Fixes PR3382.Anders Carlsson2009-01-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62922 91177308-0d34-0410-b5e6-96231b3b80d8
* Properly manage the bit-widths of APInts/APSInts in array initialization.Douglas Gregor2009-01-23
| | | | | | | Fixes PR clang/3377 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62851 91177308-0d34-0410-b5e6-96231b3b80d8
* Centralize error reporting of improper uses of incomplete types in theDouglas Gregor2009-01-19
| | | | | | | | | | | 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>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62521 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix test cases broken by quote normalization in diagnostics.Sebastian Redl2008-11-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59888 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR3031 by silencing follow-on errors in invalid declarations.Chris Lattner2008-11-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59027 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix crash caused by this:Argyrios Kyrtzidis2008-11-07
| | | | | | | | | void f() { int +; // crash here } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58846 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR3001: if we have an error parsing an initializer, make sure to removeChris Lattner2008-11-03
| | | | | | | | the designator corresponding to it, otherwise Sema and later parsing will get confused. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58603 91177308-0d34-0410-b5e6-96231b3b80d8
* add the other test case for completeness and to avoid regressions in the futureNuno Lopes2008-09-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55629 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix for PR2747: allow pointer->int casts with a null base; these are Eli Friedman2008-09-02
| | | | | | | | offset-of-like expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55627 91177308-0d34-0410-b5e6-96231b3b80d8
* Add test case for function-pointer-cast-of-global as constantDaniel Dunbar2008-08-25
| | | | | | | expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55323 91177308-0d34-0410-b5e6-96231b3b80d8
* add testcase we already handle.Chris Lattner2008-08-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54967 91177308-0d34-0410-b5e6-96231b3b80d8
* wrap some long diagnostics, make 'initializer is not a constant' diagnosticChris Lattner2008-08-10
| | | | | | | a bit more clear (rdar://5646070) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54606 91177308-0d34-0410-b5e6-96231b3b80d8
* Make sure to allow assigning a pointer to a bool.Eli Friedman2008-05-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51778 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a couple of bugs found by Neil Booth in the const-ness checking.Eli Friedman2008-05-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51361 91177308-0d34-0410-b5e6-96231b3b80d8
* add testcase for pr2050 which is now fixed.Chris Lattner2008-05-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50610 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve diagnostic for illegal array initialization.Eli Friedman2008-02-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46869 91177308-0d34-0410-b5e6-96231b3b80d8
* all filevar's have static storage. Previously a global withChris Lattner2007-12-02
| | | | | | | | extern storage class was returning false from hasStaticStorage. Ted, please review this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44515 91177308-0d34-0410-b5e6-96231b3b80d8
* add several cases that Expr::hasStaticStorage missed, pointed out by Oliver HuntChris Lattner2007-11-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44376 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement test/Sema/init.c by treating functions as constants.Chris Lattner2007-11-01
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43599 91177308-0d34-0410-b5e6-96231b3b80d8