diff options
author | John McCall <rjmccall@apple.com> | 2010-04-09 22:26:14 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-04-09 22:26:14 +0000 |
commit | 6936c863b0117dfee60d8f57ef8d63106ae6890a (patch) | |
tree | ef23cc52414e38459e07df8a698f5850e9b7528d /clang/lib/CodeGen/Mangle.cpp | |
parent | 607e02b33a7f9f6ed7ed854a77ef802f3136d8e1 (diff) | |
download | bcm5719-llvm-6936c863b0117dfee60d8f57ef8d63106ae6890a.tar.gz bcm5719-llvm-6936c863b0117dfee60d8f57ef8d63106ae6890a.zip |
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!
llvm-svn: 100907
Diffstat (limited to 'clang/lib/CodeGen/Mangle.cpp')
-rw-r--r-- | clang/lib/CodeGen/Mangle.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/Mangle.cpp b/clang/lib/CodeGen/Mangle.cpp index 649e848c996..b052f86c1eb 100644 --- a/clang/lib/CodeGen/Mangle.cpp +++ b/clang/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"; |