summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/tentative-decls.c
Commit message (Collapse)AuthorAgeFilesLines
* Sema: Static redeclaration after extern declarations is a Microsoft ExtensionDavid Majnemer2014-06-181-2/+2
| | | | | | | | | | | CL permits static redeclarations to follow extern declarations. The storage specifier on the latter declaration has no effect. This fixes PR20034. Differential Revision: http://reviews.llvm.org/D4149 llvm-svn: 211238
* c: privide deprecated warning when __private_extern__ storageFariborz Jahanian2012-08-171-1/+2
| | | | | | | | specifier is unsed in a declaration; as it may not make the symbol local to linkage unit as intended. Suggest using "hidden" visibility attribute instead. // rdar://7703982 llvm-svn: 162138
* Patch to warn about __private_extern__ on tentative definitionsFariborz Jahanian2012-08-151-2/+3
| | | | | | | | as it does something unexpected (but gcc compatible). Suggest use of __attribute__((visibility("hidden"))) on declaration instead. // rdar://7703982 llvm-svn: 161972
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - 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
* Improve GCC compatibility by allowing static tentative definitions ofDouglas Gregor2009-07-201-1/+1
| | | | | | incomplete type (with a warning), from Enea Zaffanella! llvm-svn: 76451
* This is a pretty big cleanup for how invalid decl/type are handle.Chris Lattner2009-04-251-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This gets rid of a bunch of random InvalidDecl bools in sema, changing us to use the following approach: 1. When analyzing a declspec or declarator, if an error is found, we set a bit in Declarator saying that it is invalid. 2. Once the Decl is created by sema, we immediately set the isInvalid bit on it from what is in the declarator. From this point on, sema consistently looks at and sets the bit on the decl. This gives a very clear separation of concerns and simplifies a bunch of code. In addition to this, this patch makes these changes: 1. it renames DeclSpec::getInvalidType() -> isInvalidType(). 2. various "merge" functions no longer return bools: they just set the invalid bit on the dest decl if invalid. 3. The ActOnTypedefDeclarator/ActOnFunctionDeclarator/ActOnVariableDeclarator methods now set invalid on the decl returned instead of returning an invalid bit byref. 4. In SemaType, refering to a typedef that was invalid now propagates the bit into the resultant type. Stuff declared with the invalid typedef will now be marked invalid. 5. Various methods like CheckVariableDeclaration now return void and set the invalid bit on the decl they check. There are a few minor changes to tests with this, but the only major bad result is test/SemaCXX/constructor-recovery.cpp. I'll take a look at this next. llvm-svn: 70020
* Explictly track tentative definitions within Sema, then hand thoseDouglas Gregor2009-04-211-0/+6
| | | | | | | | | | | | | | | 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
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Thanks to Eli for pointing out my misreading of 6.2.2p5Douglas Gregor2009-03-231-1/+4
| | | | llvm-svn: 67530
* Variables marked as "extern" can actually have internal linkage ifDouglas Gregor2009-03-191-1/+1
| | | | | | there is a previous declaration marked "static". This fixes PR3645. llvm-svn: 67336
* Add type checking for tentative definitions at the end of theDouglas Gregor2009-03-101-3/+6
| | | | | | | | | translation unit. Thread the various declarations of variables via VarDecl::getPreviousDeclaration. llvm-svn: 66601
* Partial fix for PR3310, concerning type-checking for tentativeDouglas Gregor2009-03-101-0/+8
| | | | | | | | | | | definitions. We were rejecting tentative definitions of incomplete (which is bad), and now we don't. This fix is partial because we don't do the end-of-translation-unit initialization for tentative definitions that don't ever have any initializers specified. llvm-svn: 66584
* Adopt a more principled approach to invalid declarations:Douglas Gregor2009-02-161-4/+6
| | | | | | | | | | | | | | | | | | | | | | | - If a declaration is an invalid redeclaration of an existing name, complain about the invalid redeclaration then avoid adding it to the AST (we can still parse the definition or initializer, if any). - If the declaration is invalid but there is no prior declaration with that name, introduce the invalid declaration into the AST (for later error recovery). - If the declaration is an invalid redeclaration of a builtin that starts with __builtin_, we produce an error and drop the redeclaration. If it is an invalid redeclaration of a library builtin (e.g., malloc, printf), warn (don't error!) and drop the redeclaration. If a user attempts to define a builtin, produce an error and (if it's a library builtin like malloc) suggest -ffreestanding. This addresses <rdar://problem/6097585> and PR2892. However, PR3588 is still going to cause some problems when builtins are redeclared without a prototype. llvm-svn: 64639
* Fix redundant errors for redefinitions with multiple existing definitions.Sebastian Redl2009-02-081-2/+0
| | | | llvm-svn: 64081
* Make the test cases failing due to exact diagnostic matching XFAIL.Sebastian Redl2009-02-081-0/+2
| | | | llvm-svn: 64080
* Make all the 'redefinition' diagnostics more consistent, and make the Chris Lattner2008-11-231-6/+6
| | | | | | "previously defined here" diagnostics all notes. llvm-svn: 59920
* Fix http://llvm.org/bugs/show_bug.cgi?id=2760.Steve Naroff2008-09-171-0/+6
| | | | llvm-svn: 56280
* Sema::CheckForFileScopedRedefinitions(): Make sure tentative decls of ↵Steve Naroff2008-08-101-0/+4
| | | | | | incomplete array types are completed (and diagnosed properly). llvm-svn: 54612
* Fix Sema::MergeVarDecl() to better handle type compatibility. The previous ↵Steve Naroff2008-08-091-0/+3
| | | | | | | | code was trying to handle arrays specially (which didn't work for pointers to array). Removed local helper function areEquivalentArrayTypes(), replacing it's use with the more general ASTContext::typesAreCompatible() predicate. Even though the test case this fixes is in "tentative-decls.c", this bug didn't have anything to do with our handling of tentative definitions (which is what I first expected). In any event, this is a tricky area of the spec. llvm-svn: 54583
* Fix issues with C "tentative" definitions.Steve Naroff2008-08-081-3/+6
| | | | | | | | | | - Move checking from MergeVarDecl->FinializeDeclaratorGroup. Since MergeVarDecl is called before the initializer is attacted, it can't be done there (this removes a long standing FIXME). - Add Sema::isTentativeDefinition() and Sema::CheckForFileScopedRedefinitions(). - Remove FIXME's and touch-up test case. Still some more work to do (forthcoming)... llvm-svn: 54533
* Fix <rdar://problem/5924576> clang -fsyntax-only generates "redefinition" ↵Steve Naroff2008-05-121-0/+3
| | | | | | | | errors when parsing AppKit that gcc does not. Teach Sema::MergeVarDecl() about __private_extern__. llvm-svn: 51005
* Many refinements to Sema::MergeVarDecl(). This routine still needs some ↵Steve Naroff2008-01-301-0/+24
re-work to fully handle tentative decls. This includes a fix to bz1908. llvm-svn: 46540
OpenPOWER on IntegriCloud