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 | 11d0c4c0985fc37a844c0c3033db9f49291e2e1f (patch) | |
| tree | 4437dd5182125f02765bdb5e19309bd3cacf0e1f /clang/lib/Parse/ParseDecl.cpp | |
| parent | 193e4c025efda046c3db4be1efb098a491767ff9 (diff) | |
| download | bcm5719-llvm-11d0c4c0985fc37a844c0c3033db9f49291e2e1f.tar.gz bcm5719-llvm-11d0c4c0985fc37a844c0c3033db9f49291e2e1f.zip | |
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".
llvm-svn: 58817
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
| -rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index e1fbb6dfcab..0b3063148b5 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/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 ')' |

