|  | Commit message (Collapse) | Author | Age | Files | Lines | 
|---|
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| | half-solution; the real solution is coming when constructors and
destructors are treated like all other functions by ActOnDeclarator.
llvm-svn: 61037 | 
| | 
| 
| 
| 
| 
| | Convert a few functions.
llvm-svn: 60983 | 
| | 
| 
| 
| | llvm-svn: 60947 | 
| | 
| 
| 
| | llvm-svn: 60897 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| | llvm-svn: 60626 | 
| | 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| | "previously defined here" diagnostics all notes.
llvm-svn: 59920 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| | in the overload diagnostics.
llvm-svn: 59871 | 
| | 
| 
| 
| | llvm-svn: 59805 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| | llvm-svn: 59789 | 
| | 
| 
| 
| | llvm-svn: 59714 | 
| | 
| 
| 
| | llvm-svn: 59713 | 
| | 
| 
| 
| | llvm-svn: 59712 | 
| | 
| 
| 
| | llvm-svn: 59609 | 
| | 
| 
| 
| 
| 
| 
| 
| | strings
first.  This should allow removal of a bunch of II->getName() calls.
llvm-svn: 59601 | 
| | 
| 
| 
| | llvm-svn: 59600 | 
| | 
| 
| 
| | llvm-svn: 59589 | 
| | 
| 
| 
| 
| 
| 
| 
| | __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 | 
| | 
| 
| 
| | llvm-svn: 59561 | 
| | 
| 
| 
| | llvm-svn: 59470 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| | llvm-svn: 59443 | 
| | 
| 
| 
| 
| 
| | operators
llvm-svn: 59442 | 
| | 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| | Thanks to Doug for the review. Actual effects of mutable to follow.
llvm-svn: 59331 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| | llvm-svn: 59000 | 
| | 
| 
| 
| | llvm-svn: 58988 | 
| | 
| 
| 
| | llvm-svn: 58987 | 
| | 
| 
| 
| 
| 
| | Thanks to Sebastian for the review
llvm-svn: 58986 | 
| | 
| 
| 
| | llvm-svn: 58916 | 
| | 
| 
| 
| 
| 
| 
| 
| | Parser side.
No Sema functionality change, just the signatures of the Action/Sema methods.
llvm-svn: 58913 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| | llvm-svn: 58804 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| | initialization of non-aggregates with initializer lists.
llvm-svn: 58757 | 
| | 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | for constructor initializations, e.g.,
  class A { };
  class B : public A { 
    int m;
  public:
    B() : A(), m(17) { };
  };
llvm-svn: 58749 | 
| | 
| 
| 
| 
| 
| | expression. Remove CXXThis from PredefinedExpr
llvm-svn: 58695 | 
| | 
| 
| 
| 
| 
| | default arguments
llvm-svn: 58692 | 
| | 
| 
| 
| 
| 
| | correcting my bogus assertion about it already being handled
llvm-svn: 58691 | 
| | 
| 
| 
| 
| 
| | already implemented
llvm-svn: 58649 | 
| | 
| 
| 
| 
| 
| | X x(5, 7);
llvm-svn: 58641 |