blob: 9c96bd0a416bf69dd35834ae9ace0f0bea4b98db [file] [log] [blame]
Mikhail Glushenkov8aac6002009-03-03 10:04:57 +00001//===- Hello.cpp - Example code from "Writing an LLVMC Plugin" ------------===//
Mikhail Glushenkov945522f2008-09-22 20:49:34 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
Mikhail Glushenkov4815b072008-12-07 16:43:17 +000010// Test plugin for LLVMC. Shows how to write plugins without using TableGen.
Mikhail Glushenkov945522f2008-09-22 20:49:34 +000011//
12//===----------------------------------------------------------------------===//
13
Mikhail Glushenkov62ab3112008-09-22 20:50:40 +000014#include "llvm/CompilerDriver/CompilationGraph.h"
15#include "llvm/CompilerDriver/Plugin.h"
Dan Gohmanb714fab2009-07-16 15:30:09 +000016#include "llvm/Support/raw_ostream.h"
Mikhail Glushenkov945522f2008-09-22 20:49:34 +000017
18namespace {
19struct MyPlugin : public llvmc::BasePlugin {
20 void PopulateLanguageMap(llvmc::LanguageMap&) const
Dan Gohmanb714fab2009-07-16 15:30:09 +000021 { outs() << "Hello!\n"; }
Mikhail Glushenkov945522f2008-09-22 20:49:34 +000022
23 void PopulateCompilationGraph(llvmc::CompilationGraph&) const
24 {}
25};
26
Mikhail Glushenkovb52720a2008-09-22 20:51:19 +000027static llvmc::RegisterPlugin<MyPlugin> RP("Hello", "Hello World plugin");
Mikhail Glushenkov945522f2008-09-22 20:49:34 +000028
29}