Warn about unsupported codegen with the diags machinery, giving us:
t.c:3322:5: warning: cannot codegen this yet
__asm__ ("bswap %0" : "+r" (_data));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
instead of:
Unimplemented stmt!
(AsmStmt 0x80eaa0 <t.c:3331:5, line:3334:28>)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44501 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CGStmt.cpp b/CodeGen/CGStmt.cpp
index b010e81..d41d2de 100644
--- a/CodeGen/CGStmt.cpp
+++ b/CodeGen/CGStmt.cpp
@@ -19,6 +19,9 @@
using namespace clang;
using namespace CodeGen;
+#include "clang/Basic/Diagnostic.h"
+#include "CodeGenModule.h"
+
//===----------------------------------------------------------------------===//
// Statement Emission
//===----------------------------------------------------------------------===//
@@ -38,8 +41,11 @@
else
EmitAggExpr(E, 0, false);
} else {
- fprintf(stderr, "Unimplemented stmt!\n");
- S->dump(getContext().SourceMgr);
+
+ unsigned DiagID = CGM.getDiags().getCustomDiagID(Diagnostic::Warning,
+ "cannot codegen this yet");
+ SourceRange Range = S->getSourceRange();
+ CGM.getDiags().Report(S->getLocStart(), DiagID, 0, 0, &Range, 1);
}
break;
case Stmt::NullStmtClass: break;