summaryrefslogtreecommitdiff
path: root/lib/CodeGen/Mangle.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-04-09 22:26:14 +0000
committerJohn McCall <rjmccall@apple.com>2010-04-09 22:26:14 +0000
commit6ae1f35cedb5a847f15f86bdb227b7bbe574a344 (patch)
treee68724a074634710735e33e25dacd94bcb8dd41e /lib/CodeGen/Mangle.cpp
parentde81063acdc999fbe1225f466ead12f7e9107acf (diff)
downloadclang-6ae1f35cedb5a847f15f86bdb227b7bbe574a344.tar.gz
clang-6ae1f35cedb5a847f15f86bdb227b7bbe574a344.tar.bz2
clang-6ae1f35cedb5a847f15f86bdb227b7bbe574a344.tar.xz
Provide an extremely unsatisfactory diagnostic (instead of crashing) when
mangling an unknown expression kind. Also conveniently tells the user what kind of expression they should add to the mangler! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100907 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/Mangle.cpp')
-rw-r--r--lib/CodeGen/Mangle.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index 649e848c99..b052f86c1e 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -1279,10 +1279,24 @@ void CXXNameMangler::mangleExpression(const Expr *E) {
// ::= L <type <value float> E # floating literal
// ::= L <mangled-name> E # external name
switch (E->getStmtClass()) {
- default:
+ case Expr::NoStmtClass:
+#define EXPR(Type, Base)
+#define STMT(Type, Base) \
+ case Expr::Type##Class:
+#include "clang/AST/StmtNodes.def"
llvm_unreachable("unexpected statement kind");
break;
+ default: {
+ // As bad as this diagnostic is, it's better than crashing.
+ Diagnostic &Diags = Context.getDiags();
+ unsigned DiagID = Diags.getCustomDiagID(Diagnostic::Error,
+ "cannot yet mangle expression type %0");
+ Diags.Report(FullSourceLoc(), DiagID)
+ << E->getStmtClassName();
+ break;
+ }
+
case Expr::CallExprClass: {
const CallExpr *CE = cast<CallExpr>(E);
Out << "cl";