diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2010-09-17 15:48:55 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2010-09-17 15:48:55 +0000 |
commit | d39c594d39df7f283c2fb8a704a3f31c501180d9 (patch) | |
tree | 36453626c792cccd91f783a38a169d610a6b9db9 /tools/llvmc/examples/Hello | |
parent | 6144c1de6a7674dad94290650e4e14f24d42e421 (diff) |
Diffstat (limited to 'tools/llvmc/examples/Hello')
-rw-r--r-- | tools/llvmc/examples/Hello/Hello.cpp | 29 | ||||
-rw-r--r-- | tools/llvmc/examples/Hello/Makefile | 14 |
2 files changed, 43 insertions, 0 deletions
diff --git a/tools/llvmc/examples/Hello/Hello.cpp b/tools/llvmc/examples/Hello/Hello.cpp new file mode 100644 index 000000000000..71f04fdd49d7 --- /dev/null +++ b/tools/llvmc/examples/Hello/Hello.cpp @@ -0,0 +1,29 @@ +//===- Hello.cpp - Example code from "Writing an LLVMC Plugin" ------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Shows how to write llvmc-based drivers without using TableGen. +// +//===----------------------------------------------------------------------===// + +#include "llvm/CompilerDriver/AutoGenerated.h" +#include "llvm/CompilerDriver/Main.inc" + +#include "llvm/Support/raw_ostream.h" + +namespace llvmc { +namespace autogenerated { + +int PreprocessOptions () { return 0; } + +int PopulateLanguageMap (LanguageMap&) { llvm::outs() << "Hello!\n"; return 0; } + +int PopulateCompilationGraph (CompilationGraph&) { return 0; } + +} +} diff --git a/tools/llvmc/examples/Hello/Makefile b/tools/llvmc/examples/Hello/Makefile new file mode 100644 index 000000000000..c281be655dda --- /dev/null +++ b/tools/llvmc/examples/Hello/Makefile @@ -0,0 +1,14 @@ +##===- tools/llvmc/examples/Hello/Makefile -----------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LEVEL = ../../../.. + +LLVMC_BASED_DRIVER = Hello + +include $(LEVEL)/Makefile.common |