diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-11-06 22:13:31 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-11-06 22:13:31 +0000 |
commit | 1cd1b1e987f5e2f060d7972b13d83239b36d77d6 (patch) | |
tree | 2776b50f5ad1ceafd1aae9a31001b6b1a3f9dd5d /lib/Parse/ParseDecl.cpp | |
parent | 5142af38ed0dd2f592cbfa00fa6e2e14dd6cc516 (diff) |
Parsing, ASTs, and semantic analysis for the declaration of overloaded
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".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58817 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index e1fbb6dfca..0b3063148b 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -1305,6 +1305,15 @@ void Parser::ParseDirectDeclarator(Declarator &D) { if (TypeTy *Type = ParseClassName()) D.SetDestructor(Type, II, TildeLoc); + } else if (Tok.is(tok::kw_operator)) { + SourceLocation OperatorLoc = Tok.getLocation(); + + // First try the name of an overloaded operator + if (IdentifierInfo *II = MaybeParseOperatorFunctionId()) { + D.SetIdentifier(II, OperatorLoc); + } else { + // This must be a user-defined conversion. + } } else if (Tok.is(tok::l_paren)) { // direct-declarator: '(' declarator ')' // direct-declarator: '(' attributes declarator ')' |