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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112458 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index 14cbbaf..d067668 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -2423,7 +2423,8 @@
   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/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index ea528c2..084bdb3 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -1199,6 +1199,11 @@
   }
 }
 
+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/lib/AST/StmtProfile.cpp b/lib/AST/StmtProfile.cpp
index 098aec0..7945474 100644
--- a/lib/AST/StmtProfile.cpp
+++ b/lib/AST/StmtProfile.cpp
@@ -828,6 +828,12 @@
     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);
 }