summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Place constructors and destructors into the DeclContext of the class,Douglas Gregor2008-12-151-50/+71
| | | | | | | | | | | | just like all other members, and remove the special variables in CXXRecordDecl to store them. This eliminates a lot of special-case code for constructors and destructors, including ActOnConstructor/ActOnDeclarator and special lookup rules in LookupDecl. The result is far more uniform and manageable. Diagnose the redeclaration of member functions. llvm-svn: 61048
* Removed setRecordForDecl. Added a FIXME.Fariborz Jahanian2008-12-151-0/+2
| | | | llvm-svn: 61038
* Create new EnumDecl nodes for redeclarations of enums, linking themDouglas Gregor2008-12-151-205/+75
| | | | | | | | | | together in the same way that we link RecordDecl/CXXRecordDecl nodes. Unify ActOnTag and ActOnTagStruct. Fixes PR clang/2753. llvm-svn: 61034
* Add storage layout to ObjC classes.Fariborz Jahanian2008-12-131-1/+3
| | | | llvm-svn: 60993
* Some utilities for using the smart pointers in Actions, especially Sema. ↵Sebastian Redl2008-12-131-8/+9
| | | | | | Convert a few functions. llvm-svn: 60983
* Enable out-of-line definitions of C++ constructors and destructorsDouglas Gregor2008-12-121-0/+27
| | | | llvm-svn: 60947
* Implement rdar://6138816 - [sema] named bitfields cannot have 0 widthChris Lattner2008-12-121-11/+10
| | | | llvm-svn: 60920
* In C++, set the type of each of the enumerators in an enumeration toDouglas Gregor2008-12-121-1/+19
| | | | | | | | | | | | | | | the type of the enumeration once the enumeration has been defined. Fix the overloading test-case to properly create enums that promote the way we want them to. Implement C++0x promotions from enumeration types to long long/unsigned long long. We're using these promotions in Carbon.h (since long long is a common extension). Fixes PR clang/2954: http://llvm.org/bugs/show_bug.cgi?id=2954 llvm-svn: 60917
* Address some comments on the name lookup/DeclContext patch from ChrisDouglas Gregor2008-12-111-36/+35
| | | | llvm-svn: 60897
* Unifies the name-lookup mechanisms used in various parts of the ASTDouglas Gregor2008-12-111-88/+209
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and separates lexical name lookup from qualified name lookup. In particular: * Make DeclContext the central data structure for storing and looking up declarations within existing declarations, e.g., members of structs/unions/classes, enumerators in C++0x enums, members of C++ namespaces, and (later) members of Objective-C interfaces/implementations. DeclContext uses a lazily-constructed data structure optimized for fast lookup (array for small contexts, hash table for larger contexts). * Implement C++ qualified name lookup in terms of lookup into DeclContext. * Implement C++ unqualified name lookup in terms of qualified+unqualified name lookup (since unqualified lookup is not purely lexical in C++!) * Limit the use of the chains of declarations stored in IdentifierInfo to those names declared lexically. * Eliminate CXXFieldDecl, collapsing its behavior into FieldDecl. (FieldDecl is now a ScopedDecl). * Make RecordDecl into a DeclContext and eliminates its Members/NumMembers fields (since one can just iterate through the DeclContext to get the fields). llvm-svn: 60878
* Move Sema::isTemplateParameterDecl to Decl::isTemplateParameter, where it ↵Douglas Gregor2008-12-081-5/+5
| | | | | | belongs llvm-svn: 60708
* fix 80-col violation.Zhongxing Xu2008-12-081-1/+1
| | | | llvm-svn: 60693
* Pass the VLA size expr range to the VLA diagsAnders Carlsson2008-12-071-3/+13
| | | | llvm-svn: 60645
* Improve VLA diagnostics/sema checking. Fixes PR2361 and PR2352.Anders Carlsson2008-12-071-10/+30
| | | | llvm-svn: 60638
* Add diagnostics for bitfields.Anders Carlsson2008-12-061-19/+40
| | | | llvm-svn: 60628
* Introduce basic support for dependent types, type-dependentDouglas Gregor2008-12-051-3/+2
| | | | | | | | | | | | expressions, and value-dependent expressions. This permits us to parse some template definitions. This is not a complete solution; we're missing type- and value-dependent computations for most of the expression types, and we're missing checks for dependent types and type-dependent expressions throughout Sema. llvm-svn: 60615
* Representation of template type parameters and non-type templateDouglas Gregor2008-12-051-5/+46
| | | | | | | | | | | | | | | parameters, with some semantic analysis: - Template parameters are introduced into template parameter scope - Complain about template parameter shadowing (except in Microsoft mode) Note that we leak template parameter declarations like crazy, a problem we'll remedy once we actually create proper declarations for templates. Next up: dependent types and value-dependent/type-dependent expressions. llvm-svn: 60597
* Use VerifyIntegerConstantExpression instead of isIntegerConstantExpr. Fixes ↵Anders Carlsson2008-12-051-2/+1
| | | | | | PR2963 llvm-svn: 60591
* Make Sema::CheckForConstantInitializer use Expr::Evaluate. This fixes PR3130.Anders Carlsson2008-12-051-0/+8
| | | | llvm-svn: 60580
* Initialize storage class even if we got an erroneous mutableDouglas Gregor2008-12-011-0/+1
| | | | llvm-svn: 60377
* Remove some bad characters from comment.Sebastian Redl2008-11-241-1/+1
| | | | llvm-svn: 59979
* Change a whole lot of diagnostics to take QualType's directly Chris Lattner2008-11-241-7/+4
| | | | | | | | instead of converting them to strings first. This also fixes a bunch of minor inconsistencies in the diagnostics emitted by clang and adds a bunch of FIXME's to DiagnosticKinds.def. llvm-svn: 59948
* Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of Chris Lattner2008-11-241-24/+24
| | | | | | | | | | | uses of getName() with uses of getDeclName(). This upgrades a bunch of diags to take DeclNames instead of std::strings. This also tweaks a couple of diagnostics to be cleaner and changes CheckInitializerTypes/PerformInitializationByConstructor to pass around DeclarationNames instead of std::strings. llvm-svn: 59947
* Make all the 'redefinition' diagnostics more consistent, and make the Chris Lattner2008-11-231-24/+24
| | | | | | "previously defined here" diagnostics all notes. llvm-svn: 59920
* Convert IdentifierInfo's to be printed the same as DeclarationNames Chris Lattner2008-11-231-12/+11
| | | | | | | | | | | | | | | | | | | | | with implicit quotes around them. This has a bunch of follow-on effects and requires tweaking to a whole lot of code. This causes a regression in two tests (xfailed) by causing it to emit things like: Line 10: duplicate interface declaration for category 'MyClass1' ('Category1') instead of: Line 10: duplicate interface declaration for category 'MyClass1(Category1)' I will fix this in a follow-up commit. As part of this, I had to start switching stuff to use ->getDeclName() instead of Decl::getName() for consistency. This is good, but I was planning to do this as an independent patch. There will be several follow-on patches to clean up some of the mess, but this patch is already too big. llvm-svn: 59917
* add support for inserting a DeclarationName into a diagnostic directlyChris Lattner2008-11-231-3/+2
| | | | | | | without calling getAsString(). This implicitly puts quotes around the name, so diagnostics need to be tweaked to accommodate this. llvm-svn: 59916
* Use Expr::Evaluate for case statements. Fixes PR2525Anders Carlsson2008-11-221-1/+1
| | | | llvm-svn: 59881
* Allow redeclaration of typedefs in C++Douglas Gregor2008-11-211-1/+8
| | | | llvm-svn: 59822
* remove the last old-fashioned Diag method. Transition complete!Chris Lattner2008-11-201-48/+45
| | | | llvm-svn: 59714
* remove another old Diag method.Chris Lattner2008-11-201-9/+9
| | | | llvm-svn: 59713
* remove another old-school Diag method.Chris Lattner2008-11-201-8/+6
| | | | llvm-svn: 59712
* compared to the rest of the code in Sema::GetStdNamespace(),Chris Lattner2008-11-201-1/+2
| | | | | | | looking up the "std" identifier is trivial. Just do it, particularly since this is only done if the namespace hasn't already been looked up. llvm-svn: 59710
* remove some other identifiers that are looked up really early and onlyChris Lattner2008-11-201-5/+15
| | | | | | used in one cold place. llvm-svn: 59709
* Take care another assert:Argyrios Kyrtzidis2008-11-191-3/+3
| | | | | | | | | | | | | | | | | | | | struct A { struct B; }; struct A::B { void m() {} // Assertion failed: getContainingDC(DC) == CurContext && "The next DeclContext should be lexically contained in the current one." }; Introduce DeclContext::getLexicalParent which may be different from DeclContext::getParent when nested-names are involved, e.g: namespace A { struct S; } struct A::S {}; // getParent() == namespace 'A' // getLexicalParent() == translation unit llvm-svn: 59650
* Fix silly code, use IdentifierInfo* instead of std::string inDaniel Dunbar2008-11-191-1/+1
| | | | | | PragmaPackStack. Thanks Chris! llvm-svn: 59616
* stop calling II::getName() unnecesarily in semaChris Lattner2008-11-191-23/+20
| | | | llvm-svn: 59609
* convert some diags to use numbers instead of strings.Chris Lattner2008-11-191-2/+1
| | | | llvm-svn: 59600
* remove one more old-style Diag method.Chris Lattner2008-11-191-17/+13
| | | | llvm-svn: 59589
* Switch several more Sema Diag methods over. This simplifies theChris Lattner2008-11-191-4/+4
| | | | | | | | __builtin_prefetch code to only emit one diagnostic per builtin_prefetch. While this has nothing to do with the rest of the patch, the code seemed like overkill when I was updating it. llvm-svn: 59588
* start converting Sema over to using its canonical Diag method.Chris Lattner2008-11-181-7/+5
| | | | llvm-svn: 59561
* Extend DeclarationName to support C++ overloaded operators, e.g.,Douglas Gregor2008-11-181-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | operator+, directly, using the same mechanism as all other special names. Removed the "special" identifiers for the overloaded operators from the identifier table and IdentifierInfo data structure. IdentifierInfo is back to representing only real identifiers. Added a new Action, ActOnOperatorFunctionIdExpr, that builds an expression from an parsed operator-function-id (e.g., "operator +"). ActOnIdentifierExpr used to do this job, but operator-function-ids are no longer represented by IdentifierInfo's. Extended Declarator to store overloaded operator names. Sema::GetNameForDeclarator now knows how to turn the operator name into a DeclarationName for the overloaded operator. Except for (perhaps) consolidating the functionality of ActOnIdentifier, ActOnOperatorFunctionIdExpr, and ActOnConversionFunctionExpr into a common routine that builds an appropriate DeclRefExpr by looking up a DeclarationName, all of the work on normalizing declaration names should be complete with this commit. llvm-svn: 59526
* Implement effects of 'mutable', and a few comments from Chris on its parsing.Sebastian Redl2008-11-171-1/+4
| | | | llvm-svn: 59470
* Eliminate all of the placeholder identifiers used for constructors,Douglas Gregor2008-11-171-29/+59
| | | | | | | | | destructors, and conversion functions. The placeholders were used to work around the fact that the parser and some of Sema really wanted declarators to have simple identifiers; now, the code that deals with declarators will use DeclarationNames. llvm-svn: 59469
* Updated IdentifierResolver to deal with DeclarationNames. The names ofDouglas Gregor2008-11-171-11/+15
| | | | | | | | | | | | | | | | | | | | | C++ constructors, destructors, and conversion functions now have a FETokenInfo field that IdentifierResolver can access, so that these special names are handled just like ordinary identifiers. A few other Sema routines now use DeclarationNames instead of IdentifierInfo*'s. To validate this design, this code also implements parsing and semantic analysis for id-expressions that name conversion functions, e.g., return operator bool(); The new parser action ActOnConversionFunctionExpr takes the result of parsing "operator type-id" and turning it into an expression, using the IdentifierResolver with the DeclarationName of the conversion function. ActOnDeclarator pushes those conversion function names into scope so that the IdentifierResolver can find them, of course. llvm-svn: 59462
* Introduction the DeclarationName class, as a single, general method ofDouglas Gregor2008-11-171-3/+17
| | | | | | | | representing the names of declarations in the C family of languages. DeclarationName is used in NamedDecl to store the name of the declaration (naturally), and ObjCMethodDecl is now a NamedDecl. llvm-svn: 59441
* rename Expr::tryEvaluate to Expr::Evaluate.Chris Lattner2008-11-161-4/+4
| | | | llvm-svn: 59426
* Implement parsing and semantic checking of the 'mutable' keyword.Sebastian Redl2008-11-141-6/+12
| | | | | | Thanks to Doug for the review. Actual effects of mutable to follow. llvm-svn: 59331
* Add a new expression node, CXXOperatorCallExpr, which expresses aDouglas Gregor2008-11-141-1/+3
| | | | | | | | | | | | | | | | | | | function call created in response to the use of operator syntax that resolves to an overloaded operator in C++, e.g., "str1 + str2" that resolves to std::operator+(str1, str2)". We now build a CXXOperatorCallExpr in C++ when we pick an overloaded operator. (But only for binary operators, where we actually implement overloading) I decided *not* to refactor the current CallExpr to make it abstract (with FunctionCallExpr and CXXOperatorCallExpr as derived classes). Doing so would allow us to make CXXOperatorCallExpr a little bit smaller, at the cost of making the argument and callee accessors virtual. We won't know if this is going to be a win until we can parse lots of C++ code to determine how much memory we'll save by making this change vs. the performance penalty due to the extra virtual calls. llvm-svn: 59306
* don't highlight field name, just put a caret on it.Chris Lattner2008-11-131-2/+2
| | | | llvm-svn: 59255
* Don't build identifiers for C++ constructors, destructors, orDouglas Gregor2008-11-121-5/+0
| | | | | | | | | | | | | | conversion functions. Instead, we just use a placeholder identifier for these (e.g., "<constructor>") and override NamedDecl::getName() to provide a human-readable name. This is one potential solution to the problem; another solution would be to replace the use of IdentifierInfo* in NamedDecl with a different class that deals with identifiers better. I'm also prototyping that to see how it compares, but this commit is better than what we had previously. llvm-svn: 59193
OpenPOWER on IntegriCloud