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