summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclSerialization.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-11-18 14:39:36 +0000
committerDouglas Gregor <dgregor@apple.com>2008-11-18 14:39:36 +0000
commit163c58502abf01db880cefb8a6c0b55c88142446 (patch)
tree68da1673552e303c25be80e9913ceb666eb3d6e1 /clang/lib/AST/DeclSerialization.cpp
parent383ccc1e75427d78f13ffb10698ba3f8c7b601df (diff)
downloadbcm5719-llvm-163c58502abf01db880cefb8a6c0b55c88142446.tar.gz
bcm5719-llvm-163c58502abf01db880cefb8a6c0b55c88142446.zip
Extend DeclarationName to support C++ overloaded operators, e.g.,
operator+, directly, using the same mechanism as all other special names. Removed the "special" identifiers for the overloaded operators from the identifier table and IdentifierInfo data structure. IdentifierInfo is back to representing only real identifiers. Added a new Action, ActOnOperatorFunctionIdExpr, that builds an expression from an parsed operator-function-id (e.g., "operator +"). ActOnIdentifierExpr used to do this job, but operator-function-ids are no longer represented by IdentifierInfo's. Extended Declarator to store overloaded operator names. Sema::GetNameForDeclarator now knows how to turn the operator name into a DeclarationName for the overloaded operator. Except for (perhaps) consolidating the functionality of ActOnIdentifier, ActOnOperatorFunctionIdExpr, and ActOnConversionFunctionExpr into a common routine that builds an appropriate DeclRefExpr by looking up a DeclarationName, all of the work on normalizing declaration names should be complete with this commit. llvm-svn: 59526
Diffstat (limited to 'clang/lib/AST/DeclSerialization.cpp')
-rw-r--r--clang/lib/AST/DeclSerialization.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclSerialization.cpp b/clang/lib/AST/DeclSerialization.cpp
index 5137b720c5b..8a4612b6745 100644
--- a/clang/lib/AST/DeclSerialization.cpp
+++ b/clang/lib/AST/DeclSerialization.cpp
@@ -147,6 +147,10 @@ void NamedDecl::EmitInRec(Serializer& S) const {
case DeclarationName::CXXConversionFunctionName:
Name.getCXXNameType().Emit(S);
break;
+
+ case DeclarationName::CXXOperatorName:
+ S.EmitInt(Name.getCXXOverloadedOperator());
+ break;
}
}
@@ -178,8 +182,16 @@ void NamedDecl::ReadInRec(Deserializer& D, ASTContext& C) {
break;
case DeclarationName::CXXConversionFunctionName:
- Name = C.DeclarationNames.getCXXConversionFunctionName(QualType::ReadVal(D));
+ Name
+ = C.DeclarationNames.getCXXConversionFunctionName(QualType::ReadVal(D));
break;
+
+ case DeclarationName::CXXOperatorName: {
+ OverloadedOperatorKind Op
+ = static_cast<OverloadedOperatorKind>(D.ReadInt());
+ Name = C.DeclarationNames.getCXXOperatorName(Op);
+ break;
+ }
}
}
OpenPOWER on IntegriCloud