summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* add parser and sema support for the funny ObjC '@defs' thing.Chris Lattner2008-06-211-0/+29
| | | | | | Patch by David Chisnall! llvm-svn: 52586
* Change self/_cmd to be instances of ImplicitParamDecl instead of ParmVarDecl.Chris Lattner2008-06-171-3/+3
| | | | | | Patch by David Chisnall! llvm-svn: 52422
* Don't crash if we can't find FileEntry info for a typedef, since one Eli Friedman2008-06-111-14/+17
| | | | | | | | | | | isn't guaranteed to exist. This fixes a crash with conflicting typedefs coming from stdin. This also fixes the crash in PR2406, but doesn't completely fix the issue; it appears there's something strange about the physical location for the definition of int64_t in stdlib.h. llvm-svn: 52209
* -Add DeclChain member to DeclContext.Argyrios Kyrtzidis2008-06-101-20/+14
| | | | | | | -ScopedDecls get chained to their DeclContext. -DeclContext's DeclChain replaces FunctionDecl's DeclChain and EnumDecl's ElementList. llvm-svn: 52164
* -Changes to TagDecl:Argyrios Kyrtzidis2008-06-091-16/+12
| | | | | | | | | Added TagKind enum. Added getTagKind() method. Added convenience methods: isEnum(), isStruct(), isUnion(), isClass(). -RecordDecl/CXXRecordDecl::Create() accept a TagKind enum instead of a DeclKind one. llvm-svn: 52160
* Add code to make test/CodeGen/struct-init.c work correctly without the Eli Friedman2008-06-091-0/+105
| | | | | | | | | | | | | | | pointer cast hack currently in isIntegerConstantExpr (in lib/AST/Expr.cpp). Also removes an odd test that even gcc doesn't accept. The reason the pointer cast hack is relevant here is that it makes Sema end up misinterpreting the relevant expression as a null pointer constant. The reason for this patch is that I plan to remove the pointer cast hack sometime soon because it causes strange issues, especially in its current form; see my recent email to cfe-dev "[PATCH] add constant expression evaluation to the AST and fix PR2413". llvm-svn: 52120
* implement the alias attirbute (in both Sema and Codegen)Nuno Lopes2008-06-081-0/+29
| | | | llvm-svn: 52092
* Clean up dead code from SemaInit landing.Eli Friedman2008-06-061-210/+1
| | | | llvm-svn: 52054
* Re-fix r51907 in a way which doesn't affect valid code. This essentially Eli Friedman2008-06-031-3/+55
| | | | | | | | | | | | | moves the check for the invalid construct to a point where it doesn't affect other uses of isIntegerConstantExpr, and we can warn properly when the extension is used. This makes it a bit more complicated, but it's a lot cleaner. Steve, please tell me if this check is sufficient to handle the relevant system header. I know it's enough to handle the testcase, but I don't know what exactly the original looks like. llvm-svn: 51918
* fix decl attributes cleaningNuno Lopes2008-06-011-1/+2
| | | | | | this plugs the leak of attributes and also fixes a crash in the test llvm-svn: 51862
* Allow a pointer implicitly cast to a bool as a constant expression, as Eli Friedman2008-05-301-17/+34
| | | | | | | | | | required by the standard (the standard doesn't know anything about implicit casts). Disallow pointers cast to non-integral arithmetic types as constant expressions. This was previously allowed by accident. llvm-svn: 51779
* Don't swap function decls, and add them to the scope as they are Eli Friedman2008-05-271-7/+1
| | | | | | | | | | | | | encountered. Mixing up the decls is unintuitive, and confuses the AST destruction code. Fixes PR2360. Note that there is a need to look up the characteristics and declarations of a function associated with a particular name or decl, but the original swapping code doesn't solve it properly. http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-May/001644.html is one suggestion for how to fix that. llvm-svn: 51584
* Implementation of gcc mode attribute; this is significant because Eli Friedman2008-05-271-0/+11
| | | | | | | | | | it fixes PR2204. Not too much to say about the implementation; it works in a similar way to the vector size attribute. At some point, we need to modify the targets to provide information about the appropriate types. llvm-svn: 51577
* Revert r51498: ↵Ted Kremenek2008-05-231-4/+2
| | | | | | | | | http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=51498&r1=51497&r2=51498&view=diff Turns out that there are multiple places where a redefinition diagnostic can be emitted. A cleaner solution (without touching Sema) is to have the Driver turn off these diagnostics. (will submit this patch soon) llvm-svn: 51502
* Remove a diagnostic (temporary hack that will be removed next week).Steve Naroff2008-05-231-2/+4
| | | | llvm-svn: 51498
* Patch for PR2350; the issue was tnat we were allowing (with an error) Eli Friedman2008-05-221-2/+3
| | | | | | void f(const void) in one place and rejecting it in another. llvm-svn: 51424
* Move getAccessedFieldNo out of lib/AST/Expr.cpp intoDan Gohman2008-05-221-5/+5
| | | | | | | | | lib/CodeGen/CGExpr.cpp and to change include/clang/AST/Attr.h to use its own enum for visibility types instead of using llvm::GlobalValue::VisibilityTypes. These changes eliminate dependencies in the AST library on LLVM's VMCore library. llvm-svn: 51398
* Fix a couple of bugs found by Neil Booth in the const-ness checking.Eli Friedman2008-05-211-3/+8
| | | | llvm-svn: 51361
* initialize variable and fix a bunch of test failuresNuno Lopes2008-05-201-1/+1
| | | | llvm-svn: 51326
* Perform stricter/more accurate checking for C99 constant expressionsEli Friedman2008-05-201-7/+344
| | | | | | | | | | | | | in Sema, per discussion on mailing list. This doesn't cause any changes in the test results. I'll probably add some more tests at some point, but it's an open question what we need to accept to be compatible with real code. This doesn't touch the existing isConstantExpr method on Expr; that should be addressed somehow eventually (either removed or refined to whatever is appropriate). llvm-svn: 51318
* Switch on SemaInit; this makes some code in SemaDecl dead, but I'll give Eli Friedman2008-05-191-1/+1
| | | | | | it a few days to make sure there aren't any significant regressions. llvm-svn: 51273
* Fix <rdar://problem/5924576> clang -fsyntax-only generates "redefinition" ↵Steve Naroff2008-05-121-1/+4
| | | | | | | | errors when parsing AppKit that gcc does not. Teach Sema::MergeVarDecl() about __private_extern__. llvm-svn: 51005
* -Implement proper name lookup for namespaces.Argyrios Kyrtzidis2008-05-091-21/+51
| | | | | | | -identifierResolver exposes an iterator interface to get all decls through the scope chain. -The semantic staff (checking IdentifierNamespace and Doug's checking for shadowed tags were moved out of IdentifierResolver and back into Sema. IdentifierResolver just gives an iterator for all reachable decls of an identifier. llvm-svn: 50923
* Add attribute "format" support for typedefs of function pointers.Ted Kremenek2008-05-091-0/+2
| | | | llvm-svn: 50906
* Handle all attributes on a parameterNate Begeman2008-05-091-1/+2
| | | | llvm-svn: 50903
* Fix rdar://5921025 a crash on the included testcase.Chris Lattner2008-05-091-1/+2
| | | | llvm-svn: 50885
* Added initial support for supporting __NSString__ in attribute "format".Ted Kremenek2008-05-081-8/+58
| | | | | | | Still need to iron out some of the semantics (fixmes are present). This addresses <rdar://problem/5916348> llvm-svn: 50866
* Diagnose attempts to use C++ default arguments outside of a function declarationDouglas Gregor2008-05-071-1/+13
| | | | llvm-svn: 50799
* Fix rdar://5905347 a crash on invalid builtin, due to theChris Lattner2008-05-051-4/+16
| | | | | | params not getting installed for builtins when synthesized. llvm-svn: 50676
* Add support for -Wimplicit-function-declaration, rdar://5907433Chris Lattner2008-05-051-2/+3
| | | | llvm-svn: 50672
* Replace Sema::CheckInitializerListTypes() with a helper class ↵Steve Naroff2008-05-011-0/+5
| | | | | | | (InitListChecker) that synthesizes implicit InitListExpr's when appropriate (see InitListExpr comments in Expr.h for more details). I also moved the code to SemaInit.cpp, to help reduce clutter in SemaDecl.cpp. NOTE: This work is incomplete and still fails many tests (as a result, it isn't enabled yet). Nevertheless, I wanted to check it in so I can work on it from home. llvm-svn: 50544
* Implicitly defined functions were getting the DeclContext of the function ↵Argyrios Kyrtzidis2008-05-011-7/+9
| | | | | | | | where they appeared, causing the bug: http://llvm.org/bugs/show_bug.cgi?id=2266. Fix it by making implicitly defined functions get the DeclContext of translation unit. llvm-svn: 50538
* fix 'var unused' warning.Chris Lattner2008-04-301-2/+2
| | | | llvm-svn: 50484
* Parsing of namespaces:Argyrios Kyrtzidis2008-04-271-35/+46
| | | | | | | | | -NamespaceDecl for the AST -Checks for name clashes between namespaces and tag/normal declarations. This commit doesn't implement proper name lookup for namespaces. llvm-svn: 50321
* initial support for recognizing __transparent_union__ attributesNuno Lopes2008-04-251-0/+26
| | | | | | comments on the ML will follow llvm-svn: 50262
* "This patch renames Chris Lattner2008-04-221-4/+4
| | | | | | | | | | | DeclContext *CtxDecl -> DeclContext *DeclCtx DeclContext *CD -> DeclContext *DC It makes the code more consistent." Patch by Zhongxing Xu! llvm-svn: 50105
* Clean up handling of function redeclarationsDouglas Gregor2008-04-211-9/+25
| | | | llvm-svn: 50021
* OCUVector -> ExtVector, shorthand for extended vector, per feedback from Chris.Nate Begeman2008-04-181-7/+7
| | | | llvm-svn: 49942
* fix __attribute__(format) for struct function pointer fieldsNuno Lopes2008-04-181-3/+7
| | | | llvm-svn: 49938
* Use TranslationUnitDecl as DeclContext of builtin functions.Argyrios Kyrtzidis2008-04-171-1/+2
| | | | llvm-svn: 49856
* Addition of TranslationUnitDecl to the AST:Argyrios Kyrtzidis2008-04-171-2/+6
| | | | | | | | -Added TranslationUnitDecl class to serve as top declaration context -ASTContext gets a TUDecl member and a getTranslationUnitDecl() function -All ScopedDecls get the TUDecl as DeclContext when declared at global scope llvm-svn: 49855
* Remove FileVarDecl and BlockVarDecl. They are replaced by ↵Steve Naroff2008-04-151-31/+27
| | | | | | | | VarDecl::isBlockVarDecl() and VarDecl::isFileVarDecl(). This is a fairly mechanical/large change. As a result, I avoided making any changes/simplifications that weren't directly related. I did break two Analysis tests. I also have a couple FIXME's in UninitializedValues.cpp. Ted, can you take a look? If the bug isn't obvious, I am happy to dig in and fix it (since I broke it). llvm-svn: 49748
* Introduce support for finding class and enum names via ordinary name lookup ↵Douglas Gregor2008-04-131-4/+14
| | | | | | in C++ llvm-svn: 49621
* This patch is just the easy part of the class names patch, whichChris Lattner2008-04-131-1/+1
| | | | | | | | | | | | | | | | allows the parsing of "class" in addition to "struct" and "union" to declare a record. So this patch allows: class C { }; class C c1; But it does not contain the lookup bits, so this won't work yet: C c2; Patch by Doug Gregor! llvm-svn: 49613
* Added PushOnScopeChains method to Sema, that adds a decl to both the ↵Argyrios Kyrtzidis2008-04-121-20/+16
| | | | | | IdResolver and the Scope. llvm-svn: 49567
* Minor changes per Chris L's review.Fariborz Jahanian2008-04-111-12/+9
| | | | llvm-svn: 49539
* Switch sema to maintaining its own scope chain information for variableChris Lattner2008-04-111-50/+18
| | | | | | | shadowing, instead of threading it through the AST. This patch contributed by Argiris Kirtzidis! llvm-svn: 49520
* Patch for:Fariborz Jahanian2008-04-101-22/+59
| | | | | | | | 1) objc ivar processing is split out of ActOnField into its own ActOnIvar method. 2) the new objc ivar action takes visibility info directly, eliminating AllVisibilities in ParseObjCClassInstanceVariables. llvm-svn: 49506
* typedef void T;Chris Lattner2008-04-101-3/+3
| | | | | | | | void f(T); is only invalid in C++ mode, not C89 mode. llvm-svn: 49460
* Several improvements from Doug Gregor related to defaultChris Lattner2008-04-101-6/+10
| | | | | | argument handling. I'll fix up the c89 (void) thing next. llvm-svn: 49459
OpenPOWER on IntegriCloud