]> granicus.if.org Git - clang/commitdiff
add a libDriver, for now only move the text diangostics stuff from Driver to there
authorNico Weber <nicolasweber@gmx.de>
Tue, 5 Aug 2008 23:33:20 +0000 (23:33 +0000)
committerNico Weber <nicolasweber@gmx.de>
Tue, 5 Aug 2008 23:33:20 +0000 (23:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54383 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/DiagChecker.cpp
Driver/Makefile
Driver/clang.cpp
include/clang/Driver/TextDiagnosticBuffer.h [moved from Driver/TextDiagnosticBuffer.h with 97% similarity]
include/clang/Driver/TextDiagnosticPrinter.h [moved from Driver/TextDiagnosticPrinter.h with 85% similarity]
include/clang/Driver/TextDiagnostics.h [moved from Driver/TextDiagnostics.h with 100% similarity]
lib/Driver/Makefile [new file with mode: 0644]
lib/Driver/TextDiagnosticBuffer.cpp [moved from Driver/TextDiagnosticBuffer.cpp with 97% similarity]
lib/Driver/TextDiagnosticPrinter.cpp [moved from Driver/TextDiagnosticPrinter.cpp with 93% similarity]
lib/Driver/TextDiagnostics.cpp [moved from Driver/TextDiagnostics.cpp with 97% similarity]
lib/Makefile

index 643c17ee4296ed5f0a51539e15afc4846f1f7cf2..e11d2f0c6a1680a6cc76eb539b035d6c530da7aa 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "clang.h"
 #include "ASTConsumers.h"
-#include "TextDiagnosticBuffer.h"
+#include "clang/Driver/TextDiagnosticBuffer.h"
 #include "clang/Sema/ParseAST.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/Basic/SourceManager.h"
index 1e6d80be6321673414517871eee278cc5c81fa98..16a8c6308c17ccbb02027ba5c51c46838bbd5ccb 100644 (file)
@@ -4,7 +4,7 @@ CXXFLAGS = -fno-rtti
 
 TOOLNAME = clang
 USEDLIBS = clangCodeGen.a clangAnalysis.a clangRewrite.a clangSEMA.a \
-           clangAST.a clangParse.a clangLex.a clangBasic.a \
+           clangDriver.a clangAST.a clangParse.a clangLex.a clangBasic.a \
            LLVMCore.a LLVMSupport.a LLVMSystem.a \
            LLVMBitWriter.a LLVMBitReader.a LLVMCodeGen.a LLVMAnalysis.a \
            LLVMTarget.a
index 56389dfb69390f42116f7e66271d1bf366dadd33..1aa7651aa6f65e3711bf3c5d9dd776d677dd9df7 100644 (file)
@@ -24,9 +24,9 @@
 
 #include "clang.h"
 #include "ASTConsumers.h"
-#include "TextDiagnosticBuffer.h"
-#include "TextDiagnosticPrinter.h"
 #include "HTMLDiagnostics.h"
+#include "clang/Driver/TextDiagnosticBuffer.h"
+#include "clang/Driver/TextDiagnosticPrinter.h"
 #include "clang/Analysis/PathDiagnostic.h"
 #include "clang/AST/TranslationUnit.h"
 #include "clang/CodeGen/ModuleBuilder.h"
@@ -143,6 +143,16 @@ HTMLDiag("html-diags",
          llvm::cl::desc("Generate HTML to report diagnostics"),
          llvm::cl::value_desc("HTML directory"));
 
+static llvm::cl::opt<bool>
+NoShowColumn("fno-show-column",
+             llvm::cl::desc("Do not include column number on diagnostics"));
+
+static llvm::cl::opt<bool>
+NoCaretDiagnostics("fno-caret-diagnostics",
+                   llvm::cl::desc("Do not include source line and caret with"
+                                  " diagnostics"));
+
+
 //===----------------------------------------------------------------------===//
 // Analyzer Options
 //===----------------------------------------------------------------------===//
@@ -426,7 +436,7 @@ ObjCExclusiveGC("fobjc-gc-only",
 
 static llvm::cl::opt<bool>
 ObjCEnableGC("fobjc-gc",
-             llvm::cl::desc("Enable Objective-C garbage collection"));             
+             llvm::cl::desc("Enable Objective-C garbage collection"));
 
 void InitializeGCMode(LangOptions &Options) {
   if (ObjCExclusiveGC)
@@ -1392,7 +1402,8 @@ int main(int argc, char **argv) {
   else { // Use Text diagnostics.
     if (!VerifyDiagnostics) {
       // Print diagnostics to stderr by default.
-      TextDiagClient = new TextDiagnosticPrinter();
+      TextDiagClient = new TextDiagnosticPrinter(!NoShowColumn,
+          !NoCaretDiagnostics);
     } else {
       // When checking diagnostics, just buffer them up.
       TextDiagClient = new TextDiagnosticBuffer();
similarity index 97%
rename from Driver/TextDiagnosticBuffer.h
rename to include/clang/Driver/TextDiagnosticBuffer.h
index e0230cf70884c86e991a3e4a4ce99b747e5640d9..99df075fb4e35c629dc82ce59eb19a60908cd6f4 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef DRIVER_TEXT_DIAGNOSTIC_BUFFER_H_
 #define DRIVER_TEXT_DIAGNOSTIC_BUFFER_H_
 
-#include "TextDiagnostics.h"
+#include "clang/Driver/TextDiagnostics.h"
 #include <vector>
 
 namespace clang {
similarity index 85%
rename from Driver/TextDiagnosticPrinter.h
rename to include/clang/Driver/TextDiagnosticPrinter.h
index 633f29edbefefb9edb5be0883d15eadb51ca4481..f96eb21bfe5b1948d323a24befc996ae629b5136 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef TEXT_DIAGNOSTIC_PRINTER_H_
 #define TEXT_DIAGNOSTIC_PRINTER_H_
 
-#include "TextDiagnostics.h"
+#include "clang/Driver/TextDiagnostics.h"
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/Support/Streams.h"
 
@@ -26,8 +26,12 @@ class TextDiagnosticPrinter : public TextDiagnostics {
   FullSourceLoc LastWarningLoc;
   FullSourceLoc LastLoc;
   llvm::OStream OS;
+  bool ShowColumn;
+  bool CaretDiagnostics;
 public:
-  TextDiagnosticPrinter(llvm::OStream &os = llvm::cerr) : OS(os) {}
+  TextDiagnosticPrinter(bool showColumn = true, bool caretDiagnistics = true,
+      llvm::OStream &os = llvm::cerr)
+    : OS(os), ShowColumn(showColumn), CaretDiagnostics(caretDiagnistics) {}
 
   void PrintIncludeStack(FullSourceLoc Pos);
 
diff --git a/lib/Driver/Makefile b/lib/Driver/Makefile
new file mode 100644 (file)
index 0000000..01902fd
--- /dev/null
@@ -0,0 +1,22 @@
+##===- clang/lib/Analysis/Makefile -------------------------*- Makefile -*-===##
+# 
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+# 
+##===----------------------------------------------------------------------===##
+#
+# This implements analyses built on top of source-level CFGs. 
+#
+##===----------------------------------------------------------------------===##
+
+LEVEL = ../../../..
+LIBRARYNAME := clangDriver
+BUILD_ARCHIVE = 1
+CXXFLAGS = -fno-rtti
+
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+
+include $(LEVEL)/Makefile.common
+
similarity index 97%
rename from Driver/TextDiagnosticBuffer.cpp
rename to lib/Driver/TextDiagnosticBuffer.cpp
index aa6fbe9ab5e3119112a3a2c4eb89d27ac31b3750..35aba58aad91d1e0c70dd025e70fa459cc743170 100644 (file)
@@ -11,7 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "TextDiagnosticBuffer.h"
+#include "clang/Driver/TextDiagnosticBuffer.h"
 #include "clang/Basic/SourceManager.h"
 using namespace clang;
 
similarity index 93%
rename from Driver/TextDiagnosticPrinter.cpp
rename to lib/Driver/TextDiagnosticPrinter.cpp
index 16c7645862da039e1cc711e2eec67a295896904d..5188f4dfa1105106d796c2189614f495f8bc1b65 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "TextDiagnosticPrinter.h"
+#include "clang/Driver/TextDiagnosticPrinter.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Lex/HeaderSearch.h"
 #include "clang/Lex/Lexer.h"
-#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include <string>
 using namespace clang;
 
-static llvm::cl::opt<bool>
-NoShowColumn("fno-show-column",
-             llvm::cl::desc("Do not include column number on diagnostics"));
-static llvm::cl::opt<bool>
-NoCaretDiagnostics("fno-caret-diagnostics",
-                   llvm::cl::desc("Do not include source line and caret with"
-                                  " diagnostics"));
-
 void TextDiagnosticPrinter::
 PrintIncludeStack(FullSourceLoc Pos) {
   if (Pos.isInvalid()) return;
@@ -144,7 +135,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic &Diags,
       ++LineEnd;
   
     OS << Buffer->getBufferIdentifier() << ":" << LineNo << ":";
-    if (ColNo && !NoShowColumn) 
+    if (ColNo && ShowColumn) 
       OS << ColNo << ":";
     OS << " ";
   }
@@ -160,7 +151,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic &Diags,
   
   OS << FormatDiagnostic(Diags, Level, ID, Strs, NumStrs) << "\n";
   
-  if (!NoCaretDiagnostics && Pos.isValid() && ((LastLoc != Pos) || Ranges)) {
+  if (CaretDiagnostics && Pos.isValid() && ((LastLoc != Pos) || Ranges)) {
     // Cache the LastLoc, it allows us to omit duplicate source/caret spewage.
     LastLoc = Pos;
     
similarity index 97%
rename from Driver/TextDiagnostics.cpp
rename to lib/Driver/TextDiagnostics.cpp
index 7a78e9478331ea55be68d8aae085a612682a3eb6..ae7b57dc2c149cb2159edc0ca213c3f948a990bb 100644 (file)
@@ -11,7 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "TextDiagnostics.h"
+#include "clang/Driver/TextDiagnostics.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Lex/HeaderSearch.h"
index f6514d57c777bc8e152523748dbcd61e785587e4..c72c353f8b531c4a3460c43b39672d634b3f0aa2 100755 (executable)
@@ -8,7 +8,7 @@
 ##===----------------------------------------------------------------------===##
 LEVEL = ../../..
 
-PARALLEL_DIRS = Headers Basic Lex Parse AST Sema CodeGen Analysis Rewrite  
+PARALLEL_DIRS = Headers Basic Lex Parse AST Sema CodeGen Analysis Rewrite Driver
 
 include $(LEVEL)/Makefile.common