diff options
author | Nico Weber <nicolasweber@gmx.de> | 2008-08-05 23:33:20 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2008-08-05 23:33:20 +0000 |
commit | fd54ebcaaf9a165846fdfafb32362238458e7f2d (patch) | |
tree | ed47385606c70808f06c6fba7d71842d4500a5ef | |
parent | 3c827a79cb7d04c255db8080e682ee2c6912373d (diff) |
add a libDriver, for now only move the text diangostics stuff from Driver to there
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54383 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Driver/DiagChecker.cpp | 2 | ||||
-rw-r--r-- | Driver/Makefile | 2 | ||||
-rw-r--r-- | Driver/clang.cpp | 19 | ||||
-rw-r--r-- | include/clang/Driver/TextDiagnosticBuffer.h (renamed from Driver/TextDiagnosticBuffer.h) | 2 | ||||
-rw-r--r-- | include/clang/Driver/TextDiagnosticPrinter.h (renamed from Driver/TextDiagnosticPrinter.h) | 8 | ||||
-rw-r--r-- | include/clang/Driver/TextDiagnostics.h (renamed from Driver/TextDiagnostics.h) | 0 | ||||
-rw-r--r-- | lib/Driver/Makefile | 22 | ||||
-rw-r--r-- | lib/Driver/TextDiagnosticBuffer.cpp (renamed from Driver/TextDiagnosticBuffer.cpp) | 2 | ||||
-rw-r--r-- | lib/Driver/TextDiagnosticPrinter.cpp (renamed from Driver/TextDiagnosticPrinter.cpp) | 15 | ||||
-rw-r--r-- | lib/Driver/TextDiagnostics.cpp (renamed from Driver/TextDiagnostics.cpp) | 2 | ||||
-rwxr-xr-x | lib/Makefile | 2 |
11 files changed, 52 insertions, 24 deletions
diff --git a/Driver/DiagChecker.cpp b/Driver/DiagChecker.cpp index 643c17ee42..e11d2f0c6a 100644 --- a/Driver/DiagChecker.cpp +++ b/Driver/DiagChecker.cpp @@ -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" diff --git a/Driver/Makefile b/Driver/Makefile index 1e6d80be63..16a8c6308c 100644 --- a/Driver/Makefile +++ b/Driver/Makefile @@ -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 diff --git a/Driver/clang.cpp b/Driver/clang.cpp index 56389dfb69..1aa7651aa6 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -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(); diff --git a/Driver/TextDiagnosticBuffer.h b/include/clang/Driver/TextDiagnosticBuffer.h index e0230cf708..99df075fb4 100644 --- a/Driver/TextDiagnosticBuffer.h +++ b/include/clang/Driver/TextDiagnosticBuffer.h @@ -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 { diff --git a/Driver/TextDiagnosticPrinter.h b/include/clang/Driver/TextDiagnosticPrinter.h index 633f29edbe..f96eb21bfe 100644 --- a/Driver/TextDiagnosticPrinter.h +++ b/include/clang/Driver/TextDiagnosticPrinter.h @@ -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/Driver/TextDiagnostics.h b/include/clang/Driver/TextDiagnostics.h index 9b8d9fb27d..9b8d9fb27d 100644 --- a/Driver/TextDiagnostics.h +++ b/include/clang/Driver/TextDiagnostics.h diff --git a/lib/Driver/Makefile b/lib/Driver/Makefile new file mode 100644 index 0000000000..01902fd88a --- /dev/null +++ b/lib/Driver/Makefile @@ -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 + diff --git a/Driver/TextDiagnosticBuffer.cpp b/lib/Driver/TextDiagnosticBuffer.cpp index aa6fbe9ab5..35aba58aad 100644 --- a/Driver/TextDiagnosticBuffer.cpp +++ b/lib/Driver/TextDiagnosticBuffer.cpp @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#include "TextDiagnosticBuffer.h" +#include "clang/Driver/TextDiagnosticBuffer.h" #include "clang/Basic/SourceManager.h" using namespace clang; diff --git a/Driver/TextDiagnosticPrinter.cpp b/lib/Driver/TextDiagnosticPrinter.cpp index 16c7645862..5188f4dfa1 100644 --- a/Driver/TextDiagnosticPrinter.cpp +++ b/lib/Driver/TextDiagnosticPrinter.cpp @@ -11,24 +11,15 @@ // //===----------------------------------------------------------------------===// -#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; diff --git a/Driver/TextDiagnostics.cpp b/lib/Driver/TextDiagnostics.cpp index 7a78e94783..ae7b57dc2c 100644 --- a/Driver/TextDiagnostics.cpp +++ b/lib/Driver/TextDiagnostics.cpp @@ -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" diff --git a/lib/Makefile b/lib/Makefile index f6514d57c7..c72c353f8b 100755 --- a/lib/Makefile +++ b/lib/Makefile @@ -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 |