forked from OSchip/llvm-project
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>) llvm-svn: 44501
This commit is contained in:
parent
963540dc28
commit
c8dbe1e5d6
|
@ -19,6 +19,9 @@
|
|||
using namespace clang;
|
||||
using namespace CodeGen;
|
||||
|
||||
#include "clang/Basic/Diagnostic.h"
|
||||
#include "CodeGenModule.h"
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Statement Emission
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -38,8 +41,11 @@ void CodeGenFunction::EmitStmt(const Stmt *S) {
|
|||
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;
|
||||
|
|
|
@ -26,8 +26,9 @@ using namespace CodeGen;
|
|||
|
||||
|
||||
CodeGenModule::CodeGenModule(ASTContext &C, const LangOptions &LO,
|
||||
llvm::Module &M, const llvm::TargetData &TD)
|
||||
: Context(C), Features(LO), TheModule(M), TheTargetData(TD),
|
||||
llvm::Module &M, const llvm::TargetData &TD,
|
||||
Diagnostic &diags)
|
||||
: Context(C), Features(LO), TheModule(M), TheTargetData(TD), Diags(diags),
|
||||
Types(C, M, TD), MemCpyFn(0), CFConstantStringClassRef(0) {}
|
||||
|
||||
llvm::Constant *CodeGenModule::GetAddrOfGlobalDecl(const ValueDecl *D) {
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace clang {
|
|||
class ValueDecl;
|
||||
class FileVarDecl;
|
||||
struct LangOptions;
|
||||
class Diagnostic;
|
||||
|
||||
namespace CodeGen {
|
||||
|
||||
|
@ -44,6 +45,7 @@ class CodeGenModule {
|
|||
const LangOptions &Features;
|
||||
llvm::Module &TheModule;
|
||||
const llvm::TargetData &TheTargetData;
|
||||
Diagnostic &Diags;
|
||||
CodeGenTypes Types;
|
||||
|
||||
llvm::Function *MemCpyFn;
|
||||
|
@ -56,12 +58,13 @@ class CodeGenModule {
|
|||
std::vector<llvm::Function *> BuiltinFunctions;
|
||||
public:
|
||||
CodeGenModule(ASTContext &C, const LangOptions &Features, llvm::Module &M,
|
||||
const llvm::TargetData &TD);
|
||||
const llvm::TargetData &TD, Diagnostic &Diags);
|
||||
|
||||
ASTContext &getContext() const { return Context; }
|
||||
const LangOptions &getLangOptions() const { return Features; }
|
||||
llvm::Module &getModule() const { return TheModule; }
|
||||
CodeGenTypes &getTypes() { return Types; }
|
||||
Diagnostic &getDiags() const { return Diags; }
|
||||
|
||||
llvm::Constant *GetAddrOfGlobalDecl(const ValueDecl *D);
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@ using namespace clang;
|
|||
/// Init - Create an ModuleBuilder with the specified ASTContext.
|
||||
clang::CodeGen::CodeGenModule *
|
||||
clang::CodeGen::Init(ASTContext &Context, const LangOptions &Features,
|
||||
llvm::Module &M, const llvm::TargetData &TD) {
|
||||
return new CodeGenModule(Context, Features, M, TD);
|
||||
llvm::Module &M, const llvm::TargetData &TD,
|
||||
Diagnostic &Diags) {
|
||||
return new CodeGenModule(Context, Features, M, TD, Diags);
|
||||
}
|
||||
|
||||
void clang::CodeGen::Terminate(CodeGenModule *B) {
|
||||
|
|
|
@ -570,7 +570,7 @@ namespace {
|
|||
M = new llvm::Module("foo");
|
||||
M->setTargetTriple(Ctx->Target.getTargetTriple());
|
||||
TD = new llvm::TargetData(Ctx->Target.getTargetDescription());
|
||||
Builder = CodeGen::Init(Context, Features, *M, *TD);
|
||||
Builder = CodeGen::Init(Context, Features, *M, *TD, Diags);
|
||||
}
|
||||
|
||||
virtual void HandleTopLevelDecl(Decl *D) {
|
||||
|
|
|
@ -24,13 +24,15 @@ namespace clang {
|
|||
class FunctionDecl;
|
||||
class FileVarDecl;
|
||||
struct LangOptions;
|
||||
class Diagnostic;
|
||||
|
||||
namespace CodeGen {
|
||||
class CodeGenModule;
|
||||
|
||||
/// Init - Create an ModuleBuilder with the specified ASTContext.
|
||||
CodeGenModule *Init(ASTContext &Context, const LangOptions &Features,
|
||||
llvm::Module &M, const llvm::TargetData &TD);
|
||||
llvm::Module &M, const llvm::TargetData &TD,
|
||||
Diagnostic &Diags);
|
||||
|
||||
/// CodeGenFunction - Convert the AST node for a FunctionDecl into LLVM.
|
||||
///
|
||||
|
|
Loading…
Reference in New Issue