summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-11-06 22:13:31 +0000
committerDouglas Gregor <dgregor@apple.com>2008-11-06 22:13:31 +0000
commit11d0c4c0985fc37a844c0c3033db9f49291e2e1f (patch)
tree4437dd5182125f02765bdb5e19309bd3cacf0e1f /clang/lib/Parse/ParseDecl.cpp
parent193e4c025efda046c3db4be1efb098a491767ff9 (diff)
downloadbcm5719-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.cpp9
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 ')'
OpenPOWER on IntegriCloud