summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Place constructors and destructors into the DeclContext of the class,Douglas Gregor2008-12-151-105/+47
| | | | | | | | | | | | 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
* Don't double-destroy constructors defined out-of-line. This is aDouglas Gregor2008-12-151-8/+12
| | | | | | | half-solution; the real solution is coming when constructors and destructors are treated like all other functions by ActOnDeclarator. llvm-svn: 61037
* Some utilities for using the smart pointers in Actions, especially Sema. ↵Sebastian Redl2008-12-131-1/+1
| | | | | | Convert a few functions. llvm-svn: 60983
* Enable out-of-line definitions of C++ constructors and destructorsDouglas Gregor2008-12-121-15/+24
| | | | llvm-svn: 60947
* Address some comments on the name lookup/DeclContext patch from ChrisDouglas Gregor2008-12-111-2/+2
| | | | llvm-svn: 60897
* Unifies the name-lookup mechanisms used in various parts of the ASTDouglas Gregor2008-12-111-35/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Simplify some diagnostics.Anders Carlsson2008-12-061-7/+7
| | | | llvm-svn: 60626
* Change a whole lot of diagnostics to take QualType's directly Chris Lattner2008-11-241-11/+9
| | | | | | | | 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-10/+9
| | | | | | | | | | | 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-8/+8
| | | | | | "previously defined here" diagnostics all notes. llvm-svn: 59920
* Convert IdentifierInfo's to be printed the same as DeclarationNames Chris Lattner2008-11-231-4/+4
| | | | | | | | | | | | | | | | | | | | | 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
* Implement a %plural modifier for complex plural forms in diagnostics. Use it ↵Sebastian Redl2008-11-221-7/+3
| | | | | | in the overload diagnostics. llvm-svn: 59871
* merge 3 more diagnostics into 1.Chris Lattner2008-11-211-5/+6
| | | | llvm-svn: 59805
* Add the concept of "modifiers" to the clang diagnostic format Chris Lattner2008-11-211-23/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | strings. This allows us to have considerable flexibility in how these things are displayed and provides extra information that allows us to merge away diagnostics that are very similar. Diagnostic modifiers are a string of characters with the regex [-a-z]+ that occur between the % and digit. They may optionally have an argument that can parameterize them. For now, I've added two example modifiers. One is a very useful tool that allows you to factor commonality across diagnostics that need single words or phrases combined. Basically you can use %select{a|b|c}4 with with an integer argument that selects either a/b/c based on an integer value in the range [0..3). The second modifier is also an integer modifier, aimed to help English diagnostics handle plurality. "%s3" prints to 's' if integer argument #3 is not 1, otherwise it prints to nothing. I'm fully aware that 's' is an English concept and doesn't apply to all situations (mouse vs mice). However, this is very useful and we can add other crazy modifiers once we add support for polish! ;-) I converted a couple C++ diagnostics over to use this as an example, I'd appreciate it if others could merge the other likely candiates. If you have other modifiers that you want, lets talk on cfe-dev. llvm-svn: 59803
* Don't print canonical types in overloading-related diagnosticsDouglas Gregor2008-11-211-2/+2
| | | | llvm-svn: 59789
* remove the last old-fashioned Diag method. Transition complete!Chris Lattner2008-11-201-11/+10
| | | | llvm-svn: 59714
* remove another old Diag method.Chris Lattner2008-11-201-10/+9
| | | | llvm-svn: 59713
* remove another old-school Diag method.Chris Lattner2008-11-201-12/+10
| | | | llvm-svn: 59712
* stop calling II::getName() unnecesarily in semaChris Lattner2008-11-191-6/+6
| | | | llvm-svn: 59609
* Allow sending IdentifierInfo*'s into Diagnostics without turning them into ↵Chris Lattner2008-11-191-1/+1
| | | | | | | | strings first. This should allow removal of a bunch of II->getName() calls. llvm-svn: 59601
* convert some diags to use numbers instead of strings.Chris Lattner2008-11-191-6/+1
| | | | llvm-svn: 59600
* remove one more old-style Diag method.Chris Lattner2008-11-191-2/+2
| | | | llvm-svn: 59589
* Switch several more Sema Diag methods over. This simplifies theChris Lattner2008-11-191-118/+81
| | | | | | | | __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-8/+8
| | | | llvm-svn: 59561
* Implement effects of 'mutable', and a few comments from Chris on its parsing.Sebastian Redl2008-11-171-0/+4
| | | | llvm-svn: 59470
* Eliminate all of the placeholder identifiers used for constructors,Douglas Gregor2008-11-171-9/+9
| | | | | | | | | 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
* Some cleanups for C++ operator overloadingDouglas Gregor2008-11-171-57/+37
| | | | llvm-svn: 59443
* Simplify error messages for two-parameter overloaded increment/decrement ↵Douglas Gregor2008-11-171-11/+4
| | | | | | operators llvm-svn: 59442
* Introduction the DeclarationName class, as a single, general method ofDouglas Gregor2008-11-171-6/+12
| | | | | | | | 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
* Implement parsing and semantic checking of the 'mutable' keyword.Sebastian Redl2008-11-141-2/+32
| | | | | | Thanks to Doug for the review. Actual effects of mutable to follow. llvm-svn: 59331
* Don't build identifiers for C++ constructors, destructors, orDouglas Gregor2008-11-121-5/+3
| | | | | | | | | | | | | | 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
* Implement support for operator overloading using candidate operatorDouglas Gregor2008-11-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | functions for built-in operators, e.g., the builtin bool operator==(int const*, int const*) can be used for the expression "x1 == x2" given: struct X { operator int const*(); } x1, x2; The scheme for handling these built-in operators is relatively simple: for each candidate required by the standard, create a special kind of candidate function for the built-in. If overload resolution picks the built-in operator, we perform the appropriate conversions on the arguments and then let the normal built-in operator take care of it. There may be some optimization opportunity left: if we can reduce the number of built-in operator overloads we generate, overload resolution for these cases will go faster. However, one must be careful when doing this: GCC generates too few operator overloads in our little test program, and fails to compile it because none of the overloads it generates match. Note that we only support operator overload for non-member binary operators at the moment. The other operators will follow. As part of this change, ImplicitCastExpr can now be an lvalue. llvm-svn: 59148
* Basic support for taking the address of an overloaded functionDouglas Gregor2008-11-101-0/+16
| | | | llvm-svn: 59000
* Allow user-defined conversions during reference bindingDouglas Gregor2008-11-101-2/+62
| | | | llvm-svn: 58988
* Don't create a typedef for the injected-class-nameDouglas Gregor2008-11-101-14/+5
| | | | llvm-svn: 58987
* Some cleanups to the declaration/checking of overloaded operators in C++. ↵Douglas Gregor2008-11-101-92/+40
| | | | | | Thanks to Sebastian for the review llvm-svn: 58986
* Implement Sema support for C++ nested-name-specifiers.Argyrios Kyrtzidis2008-11-081-2/+9
| | | | llvm-svn: 58916
* Implement support for C++ nested-name-specifiers ('foo::bar::x') in the ↵Argyrios Kyrtzidis2008-11-081-2/+3
| | | | | | | | Parser side. No Sema functionality change, just the signatures of the Action/Sema methods. llvm-svn: 58913
* Parsing, ASTs, and semantic analysis for the declaration of conversionDouglas Gregor2008-11-071-0/+135
| | | | | | | | | | | | | functions in C++, e.g., struct X { operator bool() const; }; Note that these conversions don't actually do anything, since we don't yet have the ability to use them for implicit or explicit conversions. llvm-svn: 58860
* Parsing, ASTs, and semantic analysis for the declaration of overloadedDouglas Gregor2008-11-061-0/+239
| | | | | | | | | operators in C++. Overloaded operators can be called directly via their operator-function-ids, e.g., "operator+(foo, bar)", but we don't yet implement the semantics of operator overloading to handle, e.g., "foo + bar". llvm-svn: 58817
* Sema-check virtual declarations. Complete dynamic_cast checking.Sebastian Redl2008-11-061-2/+19
| | | | llvm-svn: 58804
* Parsing, representation, and preliminary semantic analysis of destructors.Douglas Gregor2008-11-051-2/+230
| | | | | | | | | | | Implicit declaration of destructors (when necessary). Extended Declarator to store information about parsed constructors and destructors; this will be extended to deal with declarators that name overloaded operators (e.g., "operator +") and user-defined conversion operators (e.g., "operator int"). llvm-svn: 58767
* Keep track of whether a C++ class is an aggregate. Don't allow ↵Douglas Gregor2008-11-051-0/+9
| | | | | | initialization of non-aggregates with initializer lists. llvm-svn: 58757
* Implement C++ copy-initialization for declarations. There is now someDouglas Gregor2008-11-051-26/+46
| | | | | | | | duplication in the handling of copy-initialization by constructor, which occurs both for initialization of a declaration and for overloading. The initialization code is due for some refactoring. llvm-svn: 58756
* Initial implementation of parsing, semantic analysis, and AST-buildingDouglas Gregor2008-11-051-0/+106
| | | | | | | | | | | | | for constructor initializations, e.g., class A { }; class B : public A { int m; public: B() : A(), m(17) { }; }; llvm-svn: 58749
* Create a new expression class, CXXThisExpr, to handle the C++ 'this' primary ↵Douglas Gregor2008-11-041-13/+9
| | | | | | expression. Remove CXXThis from PredefinedExpr llvm-svn: 58695
* Now that we have copy initialization support, use it for checking the ↵Douglas Gregor2008-11-041-11/+3
| | | | | | default arguments llvm-svn: 58692
* Diagnose use of 'this' in a C++ default argument. Thanks to Eli for ↵Douglas Gregor2008-11-041-7/+14
| | | | | | correcting my bogus assertion about it already being handled llvm-svn: 58691
* Check that this cannot be used in a default argument. Happily, it was ↵Douglas Gregor2008-11-031-2/+7
| | | | | | already implemented llvm-svn: 58649
* Implicit support for direct initialization of objects of class type, e.g.,Douglas Gregor2008-11-031-6/+78
| | | | | | X x(5, 7); llvm-svn: 58641
OpenPOWER on IntegriCloud