summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/clang/examples
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2010-06-09 18:11:12 +0000
committered <ed@FreeBSD.org>2010-06-09 18:11:12 +0000
commita1185afe0f653cca036f117b540fefc6f799e95d (patch)
tree8b9786210f005ec3c3b7b19ee52714d390c2b121 /contrib/llvm/tools/clang/examples
parent92026fed219b8457b0b6d9ed33a538b105a670cc (diff)
downloadFreeBSD-src-a1185afe0f653cca036f117b540fefc6f799e95d.zip
FreeBSD-src-a1185afe0f653cca036f117b540fefc6f799e95d.tar.gz
Remove unneeded directories.
Even though Roman removed these directories in his working copy, they weren't removed from the actual repository, also causing his working copy to be corrupted.
Diffstat (limited to 'contrib/llvm/tools/clang/examples')
-rw-r--r--contrib/llvm/tools/clang/examples/CMakeLists.txt4
-rw-r--r--contrib/llvm/tools/clang/examples/Makefile14
-rw-r--r--contrib/llvm/tools/clang/examples/PrintFunctionNames/CMakeLists.txt26
-rw-r--r--contrib/llvm/tools/clang/examples/PrintFunctionNames/Makefile27
-rw-r--r--contrib/llvm/tools/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp44
-rw-r--r--contrib/llvm/tools/clang/examples/PrintFunctionNames/README.txt10
-rw-r--r--contrib/llvm/tools/clang/examples/clang-interpreter/CMakeLists.txt30
-rw-r--r--contrib/llvm/tools/clang/examples/clang-interpreter/Makefile30
-rw-r--r--contrib/llvm/tools/clang/examples/clang-interpreter/README.txt17
-rw-r--r--contrib/llvm/tools/clang/examples/clang-interpreter/main.cpp155
-rw-r--r--contrib/llvm/tools/clang/examples/wpa/CMakeLists.txt23
-rw-r--r--contrib/llvm/tools/clang/examples/wpa/Makefile28
-rw-r--r--contrib/llvm/tools/clang/examples/wpa/clang-wpa.cpp56
13 files changed, 0 insertions, 464 deletions
diff --git a/contrib/llvm/tools/clang/examples/CMakeLists.txt b/contrib/llvm/tools/clang/examples/CMakeLists.txt
deleted file mode 100644
index d2738c6..0000000
--- a/contrib/llvm/tools/clang/examples/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-add_subdirectory(clang-interpreter)
-add_subdirectory(PrintFunctionNames)
-add_subdirectory(wpa)
-
diff --git a/contrib/llvm/tools/clang/examples/Makefile b/contrib/llvm/tools/clang/examples/Makefile
deleted file mode 100644
index 869197d..0000000
--- a/contrib/llvm/tools/clang/examples/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-##===- examples/Makefile -----------------------------------*- Makefile -*-===##
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../../..
-
-PARALLEL_DIRS := clang-interpreter PrintFunctionNames wpa
-
-include $(LEVEL)/Makefile.common
diff --git a/contrib/llvm/tools/clang/examples/PrintFunctionNames/CMakeLists.txt b/contrib/llvm/tools/clang/examples/PrintFunctionNames/CMakeLists.txt
deleted file mode 100644
index 49dd22a..0000000
--- a/contrib/llvm/tools/clang/examples/PrintFunctionNames/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-set(SHARED_LIBRARY TRUE)
-
-set(LLVM_NO_RTTI 1)
-
-set(LLVM_USED_LIBS
- clangIndex
- clangFrontend
- clangDriver
- clangSema
- clangAnalysis
- clangAST
- clangParse
- clangLex
- clangBasic)
-
-set( LLVM_LINK_COMPONENTS
- bitreader
- mc
- core
- )
-
-add_clang_library(PrintFunctionNames PrintFunctionNames.cpp)
-
-set_target_properties(PrintFunctionNames
- PROPERTIES
- LINKER_LANGUAGE CXX)
diff --git a/contrib/llvm/tools/clang/examples/PrintFunctionNames/Makefile b/contrib/llvm/tools/clang/examples/PrintFunctionNames/Makefile
deleted file mode 100644
index 57d3ba9..0000000
--- a/contrib/llvm/tools/clang/examples/PrintFunctionNames/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-##===- examples/PrintFunctionNames/Makefile ----------------*- Makefile -*-===##
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../../../..
-LIBRARYNAME = PrintFunctionNames
-
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
-
-# Include this here so we can get the configuration of the targets that have
-# been configured for construction. We have to do this early so we can set up
-# LINK_COMPONENTS before including Makefile.rules
-include $(LEVEL)/Makefile.config
-
-LINK_LIBS_IN_SHARED = 1
-SHARED_LIBRARY = 1
-
-LINK_COMPONENTS := bitreader mc core
-USEDLIBS = clangIndex.a clangFrontend.a clangDriver.a clangSema.a \
- clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a
-
-include $(LEVEL)/Makefile.common
diff --git a/contrib/llvm/tools/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp b/contrib/llvm/tools/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp
deleted file mode 100644
index 5b7b66a..0000000
--- a/contrib/llvm/tools/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-//===- PrintFunctionNames.cpp ---------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Example clang plugin which simply prints the names of all the top-level decls
-// in the input file.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Frontend/FrontendPluginRegistry.h"
-#include "clang/AST/ASTConsumer.h"
-#include "clang/AST/AST.h"
-#include "llvm/Support/raw_ostream.h"
-using namespace clang;
-
-namespace {
-
-class PrintFunctionsConsumer : public ASTConsumer {
-public:
- virtual void HandleTopLevelDecl(DeclGroupRef DG) {
- for (DeclGroupRef::iterator i = DG.begin(), e = DG.end(); i != e; ++i) {
- const Decl *D = *i;
- if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
- llvm::errs() << "top-level-decl: \"" << ND->getNameAsString() << "\"\n";
- }
- }
-};
-
-class PrintFunctionNamesAction : public ASTFrontendAction {
-protected:
- ASTConsumer *CreateASTConsumer(CompilerInstance &CI, llvm::StringRef) {
- return new PrintFunctionsConsumer();
- }
-};
-
-}
-
-FrontendPluginRegistry::Add<PrintFunctionNamesAction>
-X("print-fns", "print function names");
diff --git a/contrib/llvm/tools/clang/examples/PrintFunctionNames/README.txt b/contrib/llvm/tools/clang/examples/PrintFunctionNames/README.txt
deleted file mode 100644
index 267865c..0000000
--- a/contrib/llvm/tools/clang/examples/PrintFunctionNames/README.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-This is a simple example demonstrating how to use clang's facility for
-providing AST consumers using a plugin.
-
-You will probably need to build clang so that it exports all symbols (disable
-TOOL_NO_EXPORT in the tools/clang Makefile).
-
-Once the plugin is built, you can run it using:
---
-$ clang -cc1 -load path/to/PrintFunctionNames.so -plugin print-fns some-input-file.c
---
diff --git a/contrib/llvm/tools/clang/examples/clang-interpreter/CMakeLists.txt b/contrib/llvm/tools/clang/examples/clang-interpreter/CMakeLists.txt
deleted file mode 100644
index 0f63b5f..0000000
--- a/contrib/llvm/tools/clang/examples/clang-interpreter/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-set(LLVM_NO_RTTI 1)
-
-set(LLVM_USED_LIBS
- clangFrontend
- clangDriver
- clangCodeGen
- clangSema
- clangChecker
- clangAnalysis
- clangRewrite
- clangAST
- clangParse
- clangLex
- clangBasic
- )
-
-set(LLVM_LINK_COMPONENTS
- jit
- interpreter
- nativecodegen
- bitreader
- bitwriter
- ipo
- selectiondag
- )
-
-add_clang_executable(clang-interpreter
- main.cpp
- )
-add_dependencies(clang-interpreter clang-headers)
diff --git a/contrib/llvm/tools/clang/examples/clang-interpreter/Makefile b/contrib/llvm/tools/clang/examples/clang-interpreter/Makefile
deleted file mode 100644
index fecc3f5..0000000
--- a/contrib/llvm/tools/clang/examples/clang-interpreter/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-##===- examples/clang-interpreter/Makefile -----------------*- Makefile -*-===##
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../../../..
-
-TOOLNAME = clang-interpreter
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
-NO_INSTALL = 1
-
-# No plugins, optimize startup time.
-TOOL_NO_EXPORTS = 1
-
-# Include this here so we can get the configuration of the targets that have
-# been configured for construction. We have to do this early so we can set up
-# LINK_COMPONENTS before including Makefile.rules
-include $(LEVEL)/Makefile.config
-
-LINK_COMPONENTS := jit interpreter nativecodegen bitreader bitwriter ipo \
- selectiondag
-USEDLIBS = clangFrontend.a clangDriver.a clangCodeGen.a clangSema.a \
- clangChecker.a clangAnalysis.a clangRewrite.a clangAST.a \
- clangParse.a clangLex.a clangBasic.a
-
-include $(LLVM_SRC_ROOT)/Makefile.rules
diff --git a/contrib/llvm/tools/clang/examples/clang-interpreter/README.txt b/contrib/llvm/tools/clang/examples/clang-interpreter/README.txt
deleted file mode 100644
index 7dd45fa..0000000
--- a/contrib/llvm/tools/clang/examples/clang-interpreter/README.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-This is an example of Clang based interpreter, for executing standalone C
-programs.
-
-It demonstrates the following features:
- 1. Parsing standard compiler command line arguments using the Driver library.
-
- 2. Constructing a Clang compiler instance, using the appropriate arguments
- derived in step #1.
-
- 3. Invoking the Clang compiler to lex, parse, syntax check, and then generate
- LLVM code.
-
- 4. Use the LLVM JIT functionality to execute the final module.
-
-The implementation has many limitations and is not designed to be a full fledged
-C interpreter. It is designed to demonstrate a simple but functional use of the
-Clang compiler libraries.
diff --git a/contrib/llvm/tools/clang/examples/clang-interpreter/main.cpp b/contrib/llvm/tools/clang/examples/clang-interpreter/main.cpp
deleted file mode 100644
index 8623954..0000000
--- a/contrib/llvm/tools/clang/examples/clang-interpreter/main.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-//===-- examples/clang-interpreter/main.cpp - Clang C Interpreter Example -===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Driver/Compilation.h"
-#include "clang/Driver/Driver.h"
-#include "clang/Driver/Tool.h"
-#include "clang/Frontend/CodeGenAction.h"
-#include "clang/Frontend/CompilerInvocation.h"
-#include "clang/Frontend/CompilerInstance.h"
-#include "clang/Frontend/DiagnosticOptions.h"
-#include "clang/Frontend/FrontendDiagnostic.h"
-#include "clang/Frontend/TextDiagnosticPrinter.h"
-
-#include "llvm/LLVMContext.h"
-#include "llvm/Module.h"
-#include "llvm/Config/config.h"
-#include "llvm/ADT/OwningPtr.h"
-#include "llvm/ADT/SmallString.h"
-#include "llvm/Config/config.h"
-#include "llvm/ExecutionEngine/ExecutionEngine.h"
-#include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/raw_ostream.h"
-#include "llvm/System/Host.h"
-#include "llvm/System/Path.h"
-#include "llvm/Target/TargetSelect.h"
-using namespace clang;
-using namespace clang::driver;
-
-llvm::sys::Path GetExecutablePath(const char *Argv0) {
- // This just needs to be some symbol in the binary; C++ doesn't
- // allow taking the address of ::main however.
- void *MainAddr = (void*) (intptr_t) GetExecutablePath;
- return llvm::sys::Path::GetMainExecutable(Argv0, MainAddr);
-}
-
-int Execute(llvm::Module *Mod, char * const *envp) {
- llvm::InitializeNativeTarget();
-
- std::string Error;
- llvm::OwningPtr<llvm::ExecutionEngine> EE(
- llvm::ExecutionEngine::createJIT(Mod, &Error));
- if (!EE) {
- llvm::errs() << "unable to make execution engine: " << Error << "\n";
- return 255;
- }
-
- llvm::Function *EntryFn = Mod->getFunction("main");
- if (!EntryFn) {
- llvm::errs() << "'main' function not found in module.\n";
- return 255;
- }
-
- // FIXME: Support passing arguments.
- std::vector<std::string> Args;
- Args.push_back(Mod->getModuleIdentifier());
-
- return EE->runFunctionAsMain(EntryFn, Args, envp);
-}
-
-int main(int argc, const char **argv, char * const *envp) {
- void *MainAddr = (void*) (intptr_t) GetExecutablePath;
- llvm::sys::Path Path = GetExecutablePath(argv[0]);
- TextDiagnosticPrinter DiagClient(llvm::errs(), DiagnosticOptions());
-
- Diagnostic Diags(&DiagClient);
- Driver TheDriver(Path.getBasename(), Path.getDirname(),
- llvm::sys::getHostTriple(),
- "a.out", /*IsProduction=*/false, /*CXXIsProduction=*/false,
- Diags);
- TheDriver.setTitle("clang interpreter");
-
- // FIXME: This is a hack to try to force the driver to do something we can
- // recognize. We need to extend the driver library to support this use model
- // (basically, exactly one input, and the operation mode is hard wired).
- llvm::SmallVector<const char *, 16> Args(argv, argv + argc);
- Args.push_back("-fsyntax-only");
- llvm::OwningPtr<Compilation> C(TheDriver.BuildCompilation(Args.size(),
- Args.data()));
- if (!C)
- return 0;
-
- // FIXME: This is copied from ASTUnit.cpp; simplify and eliminate.
-
- // We expect to get back exactly one command job, if we didn't something
- // failed. Extract that job from the compilation.
- const driver::JobList &Jobs = C->getJobs();
- if (Jobs.size() != 1 || !isa<driver::Command>(Jobs.begin())) {
- llvm::SmallString<256> Msg;
- llvm::raw_svector_ostream OS(Msg);
- C->PrintJob(OS, C->getJobs(), "; ", true);
- Diags.Report(diag::err_fe_expected_compiler_job) << OS.str();
- return 1;
- }
-
- const driver::Command *Cmd = cast<driver::Command>(*Jobs.begin());
- if (llvm::StringRef(Cmd->getCreator().getName()) != "clang") {
- Diags.Report(diag::err_fe_expected_clang_command);
- return 1;
- }
-
- // Initialize a compiler invocation object from the clang (-cc1) arguments.
- const driver::ArgStringList &CCArgs = Cmd->getArguments();
- llvm::OwningPtr<CompilerInvocation> CI(new CompilerInvocation);
- CompilerInvocation::CreateFromArgs(*CI,
- const_cast<const char **>(CCArgs.data()),
- const_cast<const char **>(CCArgs.data()) +
- CCArgs.size(),
- Diags);
-
- // Show the invocation, with -v.
- if (CI->getHeaderSearchOpts().Verbose) {
- llvm::errs() << "clang invocation:\n";
- C->PrintJob(llvm::errs(), C->getJobs(), "\n", true);
- llvm::errs() << "\n";
- }
-
- // FIXME: This is copied from cc1_main.cpp; simplify and eliminate.
-
- // Create a compiler instance to handle the actual work.
- CompilerInstance Clang;
- Clang.setLLVMContext(new llvm::LLVMContext);
- Clang.setInvocation(CI.take());
-
- // Create the compilers actual diagnostics engine.
- Clang.createDiagnostics(int(CCArgs.size()),const_cast<char**>(CCArgs.data()));
- if (!Clang.hasDiagnostics())
- return 1;
-
- // Infer the builtin include path if unspecified.
- if (Clang.getHeaderSearchOpts().UseBuiltinIncludes &&
- Clang.getHeaderSearchOpts().ResourceDir.empty())
- Clang.getHeaderSearchOpts().ResourceDir =
- CompilerInvocation::GetResourcesPath(argv[0], MainAddr);
-
- // Create and execute the frontend to generate an LLVM bitcode module.
- llvm::OwningPtr<CodeGenAction> Act(new EmitLLVMOnlyAction());
- if (!Clang.ExecuteAction(*Act))
- return 1;
-
- int Res = 255;
- if (llvm::Module *Module = Act->takeModule())
- Res = Execute(Module, envp);
-
- // Shutdown.
-
- llvm::llvm_shutdown();
-
- return Res;
-}
diff --git a/contrib/llvm/tools/clang/examples/wpa/CMakeLists.txt b/contrib/llvm/tools/clang/examples/wpa/CMakeLists.txt
deleted file mode 100644
index 8d443d6..0000000
--- a/contrib/llvm/tools/clang/examples/wpa/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-set(LLVM_NO_RTTI 1)
-
-set(LLVM_USED_LIBS
- clangIndex
- clangFrontend
- clangDriver
- clangSema
- clangAnalysis
- clangAST
- clangParse
- clangLex
- clangBasic)
-
-set( LLVM_LINK_COMPONENTS
- bitreader
- mc
- core
- )
-
-add_clang_executable(clang-wpa
- clang-wpa.cpp
- )
-add_dependencies(clang-wpa clang-headers)
diff --git a/contrib/llvm/tools/clang/examples/wpa/Makefile b/contrib/llvm/tools/clang/examples/wpa/Makefile
deleted file mode 100644
index 6b7f407..0000000
--- a/contrib/llvm/tools/clang/examples/wpa/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-##===- examples/wpa/Makefile -------------------------------*- Makefile -*-===##
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../../../..
-
-TOOLNAME = clang-wpa
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
-NO_INSTALL = 1
-
-# No plugins, optimize startup time.
-TOOL_NO_EXPORTS = 1
-
-# Include this here so we can get the configuration of the targets that have
-# been configured for construction. We have to do this early so we can set up
-# LINK_COMPONENTS before including Makefile.rules
-include $(LEVEL)/Makefile.config
-
-LINK_COMPONENTS := bitreader mc core
-USEDLIBS = clangIndex.a clangFrontend.a clangDriver.a clangSema.a \
- clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a
-
-include $(LLVM_SRC_ROOT)/Makefile.rules
diff --git a/contrib/llvm/tools/clang/examples/wpa/clang-wpa.cpp b/contrib/llvm/tools/clang/examples/wpa/clang-wpa.cpp
deleted file mode 100644
index b515e33..0000000
--- a/contrib/llvm/tools/clang/examples/wpa/clang-wpa.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-//===--- clang-wpa.cpp - clang whole program analyzer ---------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This tool reads a sequence of precompiled AST files, and do various
-// cross translation unit analyses.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Basic/FileManager.h"
-#include "clang/Basic/SourceManager.h"
-#include "clang/Frontend/ASTUnit.h"
-#include "clang/Frontend/CompilerInstance.h"
-#include "clang/Index/CallGraph.h"
-#include "llvm/ADT/IntrusiveRefCntPtr.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/raw_ostream.h"
-using namespace clang;
-using namespace idx;
-
-static llvm::cl::list<std::string>
-InputFilenames(llvm::cl::Positional, llvm::cl::desc("<input AST files>"));
-
-int main(int argc, char **argv) {
- llvm::cl::ParseCommandLineOptions(argc, argv, "clang-wpa");
- FileManager FileMgr;
- std::vector<ASTUnit*> ASTUnits;
-
- if (InputFilenames.empty())
- return 0;
-
- DiagnosticOptions DiagOpts;
- llvm::IntrusiveRefCntPtr<Diagnostic> Diags
- = CompilerInstance::createDiagnostics(DiagOpts, argc, argv);
- for (unsigned i = 0, e = InputFilenames.size(); i != e; ++i) {
- const std::string &InFile = InputFilenames[i];
- llvm::OwningPtr<ASTUnit> AST(ASTUnit::LoadFromPCHFile(InFile, Diags));
- if (!AST)
- return 1;
-
- ASTUnits.push_back(AST.take());
- }
-
- llvm::OwningPtr<CallGraph> CG;
- CG.reset(new CallGraph());
-
- for (unsigned i = 0, e = ASTUnits.size(); i != e; ++i)
- CG->addTU(ASTUnits[i]->getASTContext());
-
- CG->ViewCallGraph();
-}
OpenPOWER on IntegriCloud