summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Standard conversion sequences now have a CopyConstructor field, toDouglas Gregor2008-11-031-2/+6
| | | | | | | | | | | | | | | cope with the case where a user-defined conversion is actually a copy construction, and therefore can be compared against other standard conversion sequences. While I called this a hack before, now I'm convinced that it's the right way to go. Compare overloads based on derived-to-base conversions that invoke copy constructors. Suppress user-defined conversions when attempting to call a user-defined conversion. llvm-svn: 58629
* Add implicitly-declared default and copy constructors to C++ classes,Douglas Gregor2008-11-031-0/+106
| | | | | | | | | | | when appropriate. Conversions for class types now make use of copy constructors. I've replaced the egregious hack allowing class-to-class conversions with a slightly less egregious hack calling these conversions standard conversions (for overloading reasons). llvm-svn: 58622
* Semantic checking of constructor declarations and classification of ↵Douglas Gregor2008-10-311-11/+42
| | | | | | default/copy constructors llvm-svn: 58538
* Implement basic support for converting constructors in user-defined Douglas Gregor2008-10-311-0/+18
| | | | | | | | | | | | | conversions. Notes: - Overload resolution for converting constructors need to prohibit user-defined conversions (hence, the test isn't -verify safe yet). - We still use hacks for conversions from a class type to itself. This will be the case until we start implicitly declaring the appropriate special member functions. (That's next on my list) llvm-svn: 58513
* Made the mechanism of defining preprocessor defs for maxint, ptrdiff_t, wcharSanjiv Gupta2008-10-311-1/+1
| | | | | | | | | | etc more generic. For some targets, long may not be equal to pointer size. For example: PIC16 has int as i16, ptr as i16 but long as i32. Also fixed a few build warnings in assert() functions in CFRefCount.cpp, CGDecl.cpp, SemaDeclCXX.cpp and ParseDeclCXX.cpp. llvm-svn: 58501
* Add support for parsing and representing C++ constructor declarations.Douglas Gregor2008-10-311-2/+41
| | | | | | | | | | | | | | | Notes: - Constructors are never found by name lookup, so they'll never get pushed into any scope. Instead, they are stored as an OverloadedFunctionDecl in CXXRecordDecl for easy overloading. - There's a new action isCurrentClassName that determines whether an identifier is the name of the innermost class currently being defined; we use this to identify the declarator-id grammar rule that refers to a type-name. - MinimalAction does *not* support parsing constructors. - We now handle virtual and explicit function specifiers. llvm-svn: 58499
* Improve documentation for Sema::CheckReferenceInitDouglas Gregor2008-10-291-7/+7
| | | | llvm-svn: 58404
OpenPOWER on IntegriCloud