summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Re-land the patch that merges two diagnostics into one now that it passes ↵Anders Carlsson2010-04-221-1/+1
| | | | | | self-host :) llvm-svn: 102050
* Remove an unused declaration.Anders Carlsson2010-04-211-1/+0
| | | | llvm-svn: 102037
* Keep tack of whether a base in an InitializedEntity is an inherited virtual ↵Anders Carlsson2010-04-211-6/+19
| | | | | | base or not. Use this in CheckConstructorAccess. llvm-svn: 102020
* Factor some common code out into a separate function.Anders Carlsson2010-04-201-37/+40
| | | | llvm-svn: 101952
* Keep track of the actual storage specifier written on a variable orDouglas Gregor2010-04-191-2/+7
| | | | | | | | function declaration, since it may end up being changed (e.g., "extern" can become "static" if a prior declaration was static). Patch by Enea Zaffanella and Paolo Bolzoni. llvm-svn: 101826
* Vtable -> VTable renames across the board.Anders Carlsson2010-04-171-2/+2
| | | | llvm-svn: 101666
* Collapse the three separate initialization paths inDouglas Gregor2010-04-161-107/+0
| | | | | | | | | | | | | | | | | | TryStaticImplicitCast (for references, class types, and everything else, respectively) into a single invocation of InitializationSequence. One of the paths (for class types) was the only client of Sema::TryInitializationByConstructor, which I have eliminated. This also simplified the interface for much of the cast-checking logic, eliminating yet more code. I've kept the representation of C++ functional casts with <> 1 arguments the same, despite the fact that I hate it. That fix will come soon. To satisfy my paranoia, I've bootstrapped + tested Clang with these changes. llvm-svn: 101549
* Silence warning.Benjamin Kramer2010-04-161-1/+1
| | | | llvm-svn: 101495
* Audit uses of Sema::LookupSingleName for those lookups that areDouglas Gregor2010-04-151-1/+2
| | | | | | | | | | | intended for redeclarations, fixing those that need it. Fixes PR6831. This uncovered an issue where the C++ type-specifier-seq parsing logic would try to perform name lookup on an identifier after it already had a type-specifier, which could also lead to spurious ambiguity errors (as in PR6831, but with a different test case). llvm-svn: 101419
* Feed proper source-location information into Sema::LookupSingleResult,Douglas Gregor2010-04-151-3/+5
| | | | | | | | in case it ends up doing something that might trigger diagnostics (template instantiation, ambiguity reporting, access reporting). Noticed while working on PR6831. llvm-svn: 101412
* Warn about non-aggregate classes with no user-declared constructorsDouglas Gregor2010-04-151-0/+24
| | | | | | | that have reference or const scalar members, since those members can never be initializer or modified. Fixes <rdar://problem/7804350>. llvm-svn: 101316
* Teach typo correction about various language keywords. We can'tDouglas Gregor2010-04-141-1/+2
| | | | | | | | | | | | | generally recover from typos in keywords (since we would effectively have to mangle the token stream). However, there are still benefits to typo-correcting with keywords: - We don't make stupid suggestions when the user typed something that is similar to a keyword. - We can suggest the keyword in a diagnostic (did you mean "static_cast"?), even if we can't recover and therefore don't have a fix-it. llvm-svn: 101274
* Refactor and simplify the computation of implicit conversion sequencesDouglas Gregor2010-04-131-468/+0
| | | | | | | | | | | | | for reference binding. The code attempted to handle both the computation of the ICS and the actual conversion, but the latter is an anachronism: we now use InitializationSequence for that. Sema::CheckReferenceInit is now a static function TryReferenceInit that's only use within overload resolution, and has been simplified slightly. It still needs to be updated per C++ [over.ics.ref], by eliminating more of the lvalue/rvalue checks. llvm-svn: 101136
* During referencing binding, only consider conversion functions forDouglas Gregor2010-04-131-7/+9
| | | | | | | direct reference binding when the source and target types are not reference-related. Fixes PR6066. llvm-svn: 101132
* Allow classes to befriend implicitly-declared members. Fixes PR6207 forJohn McCall2010-04-131-2/+6
| | | | | | members of non-templated classes. llvm-svn: 101122
* Diagnose declarations of conversion functions with declarators other than '()'.John McCall2010-04-131-13/+25
| | | | llvm-svn: 101098
* When creating the implicitly-declared special member functions, beDouglas Gregor2010-04-121-8/+23
| | | | | | | | sure to introduce them into the current Scope (when we have one) in addition to the DeclContext for the class, so that they can be found by name lookup for inline members of the class. Fixes PR6570. llvm-svn: 101047
* Have the CXXBaseOrMemberInitializer keep track of whether an initializer ↵Anders Carlsson2010-04-121-0/+5
| | | | | | initializes a virtual base or not. llvm-svn: 101004
* Diagnose more cases of initializing distinct members of an anonymous unionJohn McCall2010-04-101-26/+95
| | | | | | | member. Use a better diagnostic for this case. Also fix a bug with nested anonymous structs/unions for -Wreorder; this last was PR6575. llvm-svn: 100923
* Diagnose misordered initializers in constructor templates immediately instead ofJohn McCall2010-04-101-57/+56
| | | | | | | | | | when they're instantiated. Merge the note into the -Wreorder warning; it doesn't really contribute much, and it was splitting a thought across diagnostics anyway. Don't crash in the parser when a constructor's initializers end in a comma and there's no body; the recovery here is still terrible, but anything's better than a crash. llvm-svn: 100922
* Suppress access control diagnostics when looking up a base or member nameJohn McCall2010-04-091-0/+3
| | | | | | | fails to find a type. There are no cases where it's valid for this to produce an error. llvm-svn: 100878
* Make CXXScopeSpec invalid when incomplete, and propagate that into anyJeffrey Yasskin2010-04-081-5/+5
| | | | | | | Declarator that depends on it. This fixes several redundant errors and bad recoveries. llvm-svn: 100779
* Implement dependent friend function template specializations.John McCall2010-04-081-3/+0
| | | | llvm-svn: 100753
* Implement checking for template literal operator functions. ThisAlexis Hunt2010-04-071-4/+21
| | | | | | | code won't actually get used yet because we don't handle non-type parameter packs, but when we do, this code should jump in and work. llvm-svn: 100716
* Updated comment to reflect changes made in the most recent draft.Alexis Hunt2010-04-071-5/+3
| | | | llvm-svn: 100707
* Improve handling of friend types in several ways:Douglas Gregor2010-04-071-35/+37
| | | | | | | | | | | - When instantiating a friend type template, perform semantic analysis on the resulting type. - Downgrade the errors concerning friend type declarations that do not refer to classes to ExtWarns in C++98/03. C++0x allows practically any type to be befriended, and ignores the friend declaration if the type is not a class. llvm-svn: 100635
* Split Sema::ActOnFriendTypeDecl into Sema::CheckFriendTypeDecl (forDouglas Gregor2010-04-071-35/+61
| | | | | | | | semantic analysis) and Sema::ActOnFriendTypeDecl (the action callback). This is a prerequisite for improving template instantiation of friend type declarations. llvm-svn: 100633
* Rework our handling of copy construction of temporaries, which was aDouglas Gregor2010-04-021-27/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | poor (and wrong) approximation of the actual rules governing when to build a copy and when it can be elided. The correct implementation is actually simpler than the approximation. When we only enumerate constructors as part of initialization (e.g., for direct initialization or when we're copying from a class type or one of its derived classes), we don't create a copy. When we enumerate all conversion functions, we do create a copy. Before, we created some extra copies and missed some others. The new test copy-initialization.cpp shows a case where we missed creating a (required, non-elidable) copy as part of a user-defined conversion, which resulted in a miscompile. This commit also fixes PR6757, where the missing copy made us reject well-formed code in the ternary operator. This commit also cleans up our handling of copy elision in the case where we create an extra copy of a temporary object, which became necessary now that we produce the right copies. The code that seeks to find the temporary object being copied has moved into Expr::getTemporaryObject(); it used to have two different not-quite-the-same implementations, one in Sema and one in CodeGen. Note that we still do not attempt to perform the named return value optimization, so we miss copy elisions for return values and throw expressions. llvm-svn: 100196
* If a constructor is a dependent context, just set the base and member ↵Anders Carlsson2010-04-021-107/+77
| | | | | | initializers as they are written. Fixes a bug where we wouldn't show initialization order warnings when instantiating. llvm-svn: 100180
* Diagnose multiple base and member initializers in class templates.Anders Carlsson2010-04-021-46/+40
| | | | llvm-svn: 100179
* More cleanup.Anders Carlsson2010-04-021-13/+7
| | | | llvm-svn: 100175
* Constify.Anders Carlsson2010-04-021-5/+5
| | | | llvm-svn: 100174
* Minor cleanup.Anders Carlsson2010-04-021-68/+79
| | | | llvm-svn: 100173
* Change the representation of dependent elaborated-type-specifiersDouglas Gregor2010-03-311-2/+2
| | | | | | | | | | | | | | (such as "class T::foo") from an ElaboratedType of a TypenameType to a DependentNameType, which more accurately models the underlying concept. Improve template instantiation for DependentNameType nodes that represent nested-name-specifiers, by performing tag name lookup and checking the resulting tag appropriately. Fixes PR5681. There is still much testing and cleanup to do in this area. llvm-svn: 100054
* Reinstate my CodeModificationHint -> FixItHint renaming patch, withoutDouglas Gregor2010-03-311-9/+7
| | | | | | the C-only "optimization". llvm-svn: 100022
* Revert r100008, which inexplicably breaks the clang-i686-darwin10 builderDouglas Gregor2010-03-311-7/+9
| | | | llvm-svn: 100018
* Rename CodeModificationHint to FixItHint, since we've been using theDouglas Gregor2010-03-311-9/+7
| | | | | | | term "fix-it" everywhere and even *I* get tired of long names sometimes. No functionality change. llvm-svn: 100008
* Regularize support for naming conversion functions in using decls.John McCall2010-03-311-1/+10
| | | | llvm-svn: 99979
* Propagate the "found declaration" (i.e. the using declaration instead ofJohn McCall2010-03-301-3/+5
| | | | | | | | | | | | | the underlying/instantiated decl) through a lot of API, including "intermediate" MemberExprs required for (e.g.) template instantiation. This is necessary because of the access semantics of member accesses to using declarations: only the base class *containing the using decl* need be accessible from the naming class. This allows us to complete an access-controlled selfhost, if there are no recent regressions. llvm-svn: 99936
* the big refactoring bits of PR3782.Rafael Espindola2010-03-301-13/+10
| | | | | | | | This introduces FunctionType::ExtInfo to hold the calling convention and the noreturn attribute. The next patch will extend it to include the regparm attribute and fix the bug. llvm-svn: 99920
* Fix a bug where we would incorrectly report an error about initializing two ↵Anders Carlsson2010-03-301-11/+14
| | | | | | fields in an anonymous struct. llvm-svn: 99891
* Reduce nesting.Anders Carlsson2010-03-301-15/+15
| | | | llvm-svn: 99889
* Optimize PartialDiagnostic's memory-allocation behavior by placing aDouglas Gregor2010-03-291-11/+8
| | | | | | | | | | | | | | cache of PartialDiagnostic::Storage objects into an allocator within the ASTContext. This eliminates a significant amount of malloc traffic, for a 10% performance improvement in -fsyntax-only wall-clock time with 403.gcc's combine.c. Also, eliminate the RequireNonAbstractType hack I put in earlier, which was but a symptom of this larger problem. Fixes <rdar://problem/7806091>. llvm-svn: 99849
* Exit early from the simple form of Sema::RequireNonAbstractType(), forDouglas Gregor2010-03-291-0/+3
| | | | | | a 2.47% speedup in 403.gcc. llvm-svn: 99830
* Support __attribute__((packed)) (along with other attributes) at theDouglas Gregor2010-03-291-2/+3
| | | | | | end of a struct/class/union in C++, from Justin Bogner! llvm-svn: 99811
* Compare namespaces properly when looking for redeclarations ofDouglas Gregor2010-03-261-1/+3
| | | | | | namespace aliases. Fixes PR6341. llvm-svn: 99664
* When adding initializers to a constructor, be sure that we are lookingDouglas Gregor2010-03-261-1/+5
| | | | | | | | through the bases and fields of the definition of the class in which the constructor is declared, rather than some other declaration of that class. llvm-svn: 99661
* Mark virtual methods that are used in tables included in VTTs as used.Rafael Espindola2010-03-261-1/+17
| | | | | | Fixes PR6706. llvm-svn: 99582
* Preserve type-source information in friend declarations.John McCall2010-03-251-3/+8
| | | | llvm-svn: 99525
* Make sure to properly track the anonymous namespace that lives insideDouglas Gregor2010-03-241-1/+2
| | | | | | | | | | each namespace, even when the outer namespace has multiple definitions. As part of this, collapsed two pointers worth of storage (original namespace and inner anonymous namespace) into a single pointer with a distinguishing bit, since the two are mutually exclusive, saving a pointer per NamespaceDecl. Fixes PR6620. llvm-svn: 99368
OpenPOWER on IntegriCloud