[cfe-commits] r88825 - in /cfe/trunk: Makefile examples/ examples/Makefile examples/wpa/ examples/wpa/CMakeLists.txt examples/wpa/Makefile examples/wpa/clang-wpa.cpp tools/wpa/CMakeLists.txt tools/wpa/Makefile tools/wpa/clang-wpa.cpp

Daniel Dunbar daniel at zuster.org
Sat Nov 14 18:22:34 CST 2009


Author: ddunbar
Date: Sat Nov 14 18:22:33 2009
New Revision: 88825

URL: http://llvm.org/viewvc/llvm-project?rev=88825&view=rev
Log:
Add examples dir, built with BUILD_EXAMPLES=1 (Makefiles, no CMake equivalent yet).

Move tools/wpa to examples/wpa, and unbreak its build.

Added:
    cfe/trunk/examples/
    cfe/trunk/examples/Makefile
    cfe/trunk/examples/wpa/
    cfe/trunk/examples/wpa/CMakeLists.txt
      - copied, changed from r88824, cfe/trunk/tools/wpa/CMakeLists.txt
    cfe/trunk/examples/wpa/Makefile
      - copied, changed from r88824, cfe/trunk/tools/wpa/Makefile
    cfe/trunk/examples/wpa/clang-wpa.cpp
      - copied, changed from r88824, cfe/trunk/tools/wpa/clang-wpa.cpp
Removed:
    cfe/trunk/tools/wpa/CMakeLists.txt
    cfe/trunk/tools/wpa/Makefile
    cfe/trunk/tools/wpa/clang-wpa.cpp
Modified:
    cfe/trunk/Makefile

Modified: cfe/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Makefile?rev=88825&r1=88824&r2=88825&view=diff

==============================================================================
--- cfe/trunk/Makefile (original)
+++ cfe/trunk/Makefile Sat Nov 14 18:22:33 2009
@@ -1,6 +1,12 @@
 LEVEL = ../..
 DIRS := include lib tools docs
 
+PARALLEL_DIRS :=
+
+ifeq ($(BUILD_EXAMPLES),1)
+  PARALLEL_DIRS += examples
+endif
+
 include $(LEVEL)/Makefile.common
 
 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))

Added: cfe/trunk/examples/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/Makefile?rev=88825&view=auto

==============================================================================
--- cfe/trunk/examples/Makefile (added)
+++ cfe/trunk/examples/Makefile Sat Nov 14 18:22:33 2009
@@ -0,0 +1,14 @@
+##===- 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 := wpa
+
+include $(LEVEL)/Makefile.common

Copied: cfe/trunk/examples/wpa/CMakeLists.txt (from r88824, cfe/trunk/tools/wpa/CMakeLists.txt)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/wpa/CMakeLists.txt?p2=cfe/trunk/examples/wpa/CMakeLists.txt&p1=cfe/trunk/tools/wpa/CMakeLists.txt&r1=88824&r2=88825&rev=88825&view=diff

==============================================================================
    (empty)

Copied: cfe/trunk/examples/wpa/Makefile (from r88824, cfe/trunk/tools/wpa/Makefile)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/wpa/Makefile?p2=cfe/trunk/examples/wpa/Makefile&p1=cfe/trunk/tools/wpa/Makefile&r1=88824&r2=88825&rev=88825&view=diff

==============================================================================
    (empty)

Copied: cfe/trunk/examples/wpa/clang-wpa.cpp (from r88824, cfe/trunk/tools/wpa/clang-wpa.cpp)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/wpa/clang-wpa.cpp?p2=cfe/trunk/examples/wpa/clang-wpa.cpp&p1=cfe/trunk/tools/wpa/clang-wpa.cpp&r1=88824&r2=88825&rev=88825&view=diff

==============================================================================
--- cfe/trunk/tools/wpa/clang-wpa.cpp (original)
+++ cfe/trunk/examples/wpa/clang-wpa.cpp Sat Nov 14 18:22:33 2009
@@ -34,7 +34,6 @@
     return 0;
 
   TextDiagnosticBuffer DiagClient;
-  Diagnostic Diags(&DiagClient);
 
   for (unsigned i = 0, e = InputFilenames.size(); i != e; ++i) {
     const std::string &InFile = InputFilenames[i];
@@ -42,7 +41,7 @@
     std::string ErrMsg;
     llvm::OwningPtr<ASTUnit> AST;
 
-    AST.reset(ASTUnit::LoadFromPCHFile(InFile, Diags, FileMgr, &ErrMsg));
+    AST.reset(ASTUnit::LoadFromPCHFile(InFile, &ErrMsg, &DiagClient));
 
     if (!AST) {
       llvm::errs() << "[" << InFile << "] error: " << ErrMsg << '\n';

Removed: cfe/trunk/tools/wpa/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/wpa/CMakeLists.txt?rev=88824&view=auto

==============================================================================
--- cfe/trunk/tools/wpa/CMakeLists.txt (original)
+++ cfe/trunk/tools/wpa/CMakeLists.txt (removed)
@@ -1,20 +0,0 @@
-set(LLVM_NO_RTTI 1)
-
-set( LLVM_USED_LIBS
-  clangFrontend
-  clangAnalysis
-  clangSema
-  clangAST
-  clangLex
-  clangBasic
-  clangIndex
-  )
-
-set( LLVM_LINK_COMPONENTS
-    mc
-  )
-
-add_clang_executable(clang-wpa
-  clang-wpa.cpp
-  )
-add_dependencies(clang-wpa clang-headers)

Removed: cfe/trunk/tools/wpa/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/wpa/Makefile?rev=88824&view=auto

==============================================================================
--- cfe/trunk/tools/wpa/Makefile (original)
+++ cfe/trunk/tools/wpa/Makefile (removed)
@@ -1,16 +0,0 @@
-LEVEL = ../../../..
-
-TOOLNAME = clang-wpa
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
-CXXFLAGS = -fno-rtti
-NO_INSTALL = 1
-
-# No plugins, optimize startup time.
-TOOL_NO_EXPORTS = 1
-
-include $(LEVEL)/Makefile.config
-
-LINK_COMPONENTS := bitreader mc
-USEDLIBS = clangFrontend.a clangSema.a clangAST.a clangLex.a clangBasic.a clangAnalysis.a clangIndex.a
-
-include $(LLVM_SRC_ROOT)/Makefile.rules

Removed: cfe/trunk/tools/wpa/clang-wpa.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/wpa/clang-wpa.cpp?rev=88824&view=auto

==============================================================================
--- cfe/trunk/tools/wpa/clang-wpa.cpp (original)
+++ cfe/trunk/tools/wpa/clang-wpa.cpp (removed)
@@ -1,62 +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/Analysis/CallGraph.h"
-#include "clang/Frontend/ASTUnit.h"
-#include "clang/Basic/FileManager.h"
-#include "clang/Basic/SourceManager.h"
-#include "clang/Frontend/TextDiagnosticBuffer.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;
-
-  TextDiagnosticBuffer DiagClient;
-  Diagnostic Diags(&DiagClient);
-
-  for (unsigned i = 0, e = InputFilenames.size(); i != e; ++i) {
-    const std::string &InFile = InputFilenames[i];
-
-    std::string ErrMsg;
-    llvm::OwningPtr<ASTUnit> AST;
-
-    AST.reset(ASTUnit::LoadFromPCHFile(InFile, Diags, FileMgr, &ErrMsg));
-
-    if (!AST) {
-      llvm::errs() << "[" << InFile << "] error: " << ErrMsg << '\n';
-      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();
-}




More information about the cfe-commits mailing list