blob: 23a13a57c2b84844358892b087ddf37d76395400 [file] [log] [blame]
Mikhail Glushenkov03c050f2009-03-03 10:04:57 +00001//===- Hello.cpp - Example code from "Writing an LLVMC Plugin" ------------===//
Mikhail Glushenkovc82ce4a2008-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 Glushenkovc8813da2008-12-07 16:43:17 +000010// Test plugin for LLVMC. Shows how to write plugins without using TableGen.
Mikhail Glushenkovc82ce4a2008-09-22 20:49:34 +000011//
12//===----------------------------------------------------------------------===//
13
Mikhail Glushenkov4a1a77c2008-09-22 20:50:40 +000014#include "llvm/CompilerDriver/CompilationGraph.h"
15#include "llvm/CompilerDriver/Plugin.h"
Mikhail Glushenkovc82ce4a2008-09-22 20:49:34 +000016
17#include <iostream>
18
19namespace {
20struct MyPlugin : public llvmc::BasePlugin {
21 void PopulateLanguageMap(llvmc::LanguageMap&) const
22 { std::cout << "Hello!\n"; }
23
24 void PopulateCompilationGraph(llvmc::CompilationGraph&) const
25 {}
26};
27
Mikhail Glushenkov14ef0592008-09-22 20:51:19 +000028static llvmc::RegisterPlugin<MyPlugin> RP("Hello", "Hello World plugin");
Mikhail Glushenkovc82ce4a2008-09-22 20:49:34 +000029
30}