diff options
| author | Alexis Hunt <alercah@gmail.com> | 2010-08-29 21:26:48 +0000 |
|---|---|---|
| committer | Alexis Hunt <alercah@gmail.com> | 2010-08-29 21:26:48 +0000 |
| commit | 79eb5469e04aa8906262619d1f7a3a71ba5dbd94 (patch) | |
| tree | 6c9a4252f73fd27626204a4de22602dc8802d849 /clang/lib/AST | |
| parent | c843fca2fde772c85010123556d3e3abeb75b9ab (diff) | |
| download | bcm5719-llvm-79eb5469e04aa8906262619d1f7a3a71ba5dbd94.tar.gz bcm5719-llvm-79eb5469e04aa8906262619d1f7a3a71ba5dbd94.zip | |
Implement C++0x user-defined string literals.
The extra data stored on user-defined literal Tokens is stored in extra
allocated memory, which is managed by the PreprocessorLexer because there isn't
a better place to put it that makes sure it gets deallocated, but only after
it's used up. My testing has shown no significant slowdown as a result, but
independent testing would be appreciated.
llvm-svn: 112458
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 5 | ||||
| -rw-r--r-- | clang/lib/AST/StmtProfile.cpp | 6 |
3 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 14cbbaf0e8a..d067668f4bc 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -2423,7 +2423,8 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) { case Expr::UnaryTypeTraitExprClass: return NoDiag(); case Expr::CallExprClass: - case Expr::CXXOperatorCallExprClass: { + case Expr::CXXOperatorCallExprClass: + case Expr::UDLiteralExprClass: { const CallExpr *CE = cast<CallExpr>(E); if (CE->isBuiltinCall(Ctx)) return CheckEvalInICE(E, Ctx); diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index ea528c2daec..084bdb3ed6e 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -1199,6 +1199,11 @@ void StmtPrinter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *Node) { } } +void StmtPrinter::VisitUDLiteralExpr(UDLiteralExpr *Node) { + VisitStmt(Node->getBaseLiteral()); + OS << Node->getUDSuffix()->getName(); +} + static const char *getTypeTraitName(UnaryTypeTrait UTT) { switch (UTT) { default: assert(false && "Unknown type trait"); diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index 098aec0a19c..79454748dde 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -828,6 +828,12 @@ void StmtProfiler::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *S) { VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); } +void StmtProfiler::VisitUDLiteralExpr(UDLiteralExpr *S) { + VisitExpr(S); + VisitStmt(S->getBaseLiteral()); + ID.AddString(S->getUDSuffix()->getName()); +} + void StmtProfiler::VisitObjCStringLiteral(ObjCStringLiteral *S) { VisitExpr(S); } |

