[cfe-commits] r54383 - in /cfe/trunk: Driver/ include/clang/Driver/ lib/ lib/Driver/
Nico Weber
nicolasweber at gmx.de
Tue Aug 5 16:33:20 PDT 2008
Author: nico
Date: Tue Aug 5 18:33:20 2008
New Revision: 54383
URL: http://llvm.org/viewvc/llvm-project?rev=54383&view=rev
Log:
add a libDriver, for now only move the text diangostics stuff from Driver to there
Added:
cfe/trunk/include/clang/Driver/
cfe/trunk/include/clang/Driver/TextDiagnosticBuffer.h
- copied, changed from r54380, cfe/trunk/Driver/TextDiagnosticBuffer.h
cfe/trunk/include/clang/Driver/TextDiagnosticPrinter.h
- copied, changed from r54380, cfe/trunk/Driver/TextDiagnosticPrinter.h
cfe/trunk/include/clang/Driver/TextDiagnostics.h
- copied unchanged from r54380, cfe/trunk/Driver/TextDiagnostics.h
cfe/trunk/lib/Driver/
cfe/trunk/lib/Driver/Makefile
cfe/trunk/lib/Driver/TextDiagnosticBuffer.cpp
- copied, changed from r54380, cfe/trunk/Driver/TextDiagnosticBuffer.cpp
cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp
- copied, changed from r54380, cfe/trunk/Driver/TextDiagnosticPrinter.cpp
cfe/trunk/lib/Driver/TextDiagnostics.cpp
- copied, changed from r54380, cfe/trunk/Driver/TextDiagnostics.cpp
Removed:
cfe/trunk/Driver/TextDiagnosticBuffer.cpp
cfe/trunk/Driver/TextDiagnosticBuffer.h
cfe/trunk/Driver/TextDiagnosticPrinter.cpp
cfe/trunk/Driver/TextDiagnosticPrinter.h
cfe/trunk/Driver/TextDiagnostics.cpp
cfe/trunk/Driver/TextDiagnostics.h
Modified:
cfe/trunk/Driver/DiagChecker.cpp
cfe/trunk/Driver/Makefile
cfe/trunk/Driver/clang.cpp
cfe/trunk/lib/Makefile
Modified: cfe/trunk/Driver/DiagChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/DiagChecker.cpp?rev=54383&r1=54382&r2=54383&view=diff
==============================================================================
--- cfe/trunk/Driver/DiagChecker.cpp (original)
+++ cfe/trunk/Driver/DiagChecker.cpp Tue Aug 5 18:33:20 2008
@@ -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"
Modified: cfe/trunk/Driver/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/Makefile?rev=54383&r1=54382&r2=54383&view=diff
==============================================================================
--- cfe/trunk/Driver/Makefile (original)
+++ cfe/trunk/Driver/Makefile Tue Aug 5 18:33:20 2008
@@ -4,7 +4,7 @@
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
Removed: cfe/trunk/Driver/TextDiagnosticBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/TextDiagnosticBuffer.cpp?rev=54382&view=auto
==============================================================================
--- cfe/trunk/Driver/TextDiagnosticBuffer.cpp (original)
+++ cfe/trunk/Driver/TextDiagnosticBuffer.cpp (removed)
@@ -1,41 +0,0 @@
-//===--- TextDiagnosticBuffer.cpp - Buffer Text Diagnostics ---------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This is a concrete diagnostic client, which buffers the diagnostic messages.
-//
-//===----------------------------------------------------------------------===//
-
-#include "TextDiagnosticBuffer.h"
-#include "clang/Basic/SourceManager.h"
-using namespace clang;
-
-/// HandleDiagnostic - Store the errors & warnings that are reported.
-///
-void TextDiagnosticBuffer::HandleDiagnostic(Diagnostic &Diags,
- Diagnostic::Level Level,
- FullSourceLoc Pos,
- diag::kind ID,
- const std::string *Strs,
- unsigned NumStrs,
- const SourceRange *,
- unsigned) {
- switch (Level) {
- default: assert(0 && "Diagnostic not handled during diagnostic buffering!");
- case Diagnostic::Warning:
- Warnings.push_back(std::make_pair(Pos.getLocation(),
- FormatDiagnostic(Diags, Level, ID,
- Strs, NumStrs)));
- break;
- case Diagnostic::Error:
- Errors.push_back(std::make_pair(Pos.getLocation(),
- FormatDiagnostic(Diags, Level, ID,
- Strs, NumStrs)));
- break;
- }
-}
Removed: cfe/trunk/Driver/TextDiagnosticBuffer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/TextDiagnosticBuffer.h?rev=54382&view=auto
==============================================================================
--- cfe/trunk/Driver/TextDiagnosticBuffer.h (original)
+++ cfe/trunk/Driver/TextDiagnosticBuffer.h (removed)
@@ -1,53 +0,0 @@
-//===--- TextDiagnosticBuffer.h - Buffer Text Diagnostics -------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This is a concrete diagnostic client, which buffers the diagnostic messages.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef DRIVER_TEXT_DIAGNOSTIC_BUFFER_H_
-#define DRIVER_TEXT_DIAGNOSTIC_BUFFER_H_
-
-#include "TextDiagnostics.h"
-#include <vector>
-
-namespace clang {
-
-class Preprocessor;
-class SourceManager;
-
-class TextDiagnosticBuffer : public TextDiagnostics {
-public:
- typedef std::vector<std::pair<SourceLocation, std::string> > DiagList;
- typedef DiagList::iterator iterator;
- typedef DiagList::const_iterator const_iterator;
-private:
- DiagList Errors, Warnings;
-public:
- TextDiagnosticBuffer() {}
-
- const_iterator err_begin() const { return Errors.begin(); }
- const_iterator err_end() const { return Errors.end(); }
-
- const_iterator warn_begin() const { return Warnings.begin(); }
- const_iterator warn_end() const { return Warnings.end(); }
-
- virtual void HandleDiagnostic(Diagnostic &Diags,
- Diagnostic::Level DiagLevel,
- FullSourceLoc Pos,
- diag::kind ID,
- const std::string *Strs,
- unsigned NumStrs,
- const SourceRange *Ranges,
- unsigned NumRanges);
-};
-
-} // end namspace clang
-
-#endif
Removed: cfe/trunk/Driver/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/TextDiagnosticPrinter.cpp?rev=54382&view=auto
==============================================================================
--- cfe/trunk/Driver/TextDiagnosticPrinter.cpp (original)
+++ cfe/trunk/Driver/TextDiagnosticPrinter.cpp (removed)
@@ -1,212 +0,0 @@
-//===--- TextDiagnosticPrinter.cpp - Diagnostic Printer -------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This diagnostic client prints out their diagnostic messages.
-//
-//===----------------------------------------------------------------------===//
-
-#include "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;
-
- Pos = Pos.getLogicalLoc();
-
- // Print out the other include frames first.
- PrintIncludeStack(Pos.getIncludeLoc());
- unsigned LineNo = Pos.getLineNumber();
-
- OS << "In file included from " << Pos.getSourceName()
- << ":" << LineNo << ":\n";
-}
-
-/// HighlightRange - Given a SourceRange and a line number, highlight (with ~'s)
-/// any characters in LineNo that intersect the SourceRange.
-void TextDiagnosticPrinter::HighlightRange(const SourceRange &R,
- SourceManager& SourceMgr,
- unsigned LineNo, unsigned FileID,
- std::string &CaratLine,
- const std::string &SourceLine) {
- assert(CaratLine.size() == SourceLine.size() &&
- "Expect a correspondence between source and carat line!");
- if (!R.isValid()) return;
-
- SourceLocation LogicalStart = SourceMgr.getLogicalLoc(R.getBegin());
- unsigned StartLineNo = SourceMgr.getLineNumber(LogicalStart);
- if (StartLineNo > LineNo || LogicalStart.getFileID() != FileID)
- return; // No intersection.
-
- SourceLocation LogicalEnd = SourceMgr.getLogicalLoc(R.getEnd());
- unsigned EndLineNo = SourceMgr.getLineNumber(LogicalEnd);
- if (EndLineNo < LineNo || LogicalEnd.getFileID() != FileID)
- return; // No intersection.
-
- // Compute the column number of the start.
- unsigned StartColNo = 0;
- if (StartLineNo == LineNo) {
- StartColNo = SourceMgr.getLogicalColumnNumber(R.getBegin());
- if (StartColNo) --StartColNo; // Zero base the col #.
- }
-
- // Pick the first non-whitespace column.
- while (StartColNo < SourceLine.size() &&
- (SourceLine[StartColNo] == ' ' || SourceLine[StartColNo] == '\t'))
- ++StartColNo;
-
- // Compute the column number of the end.
- unsigned EndColNo = CaratLine.size();
- if (EndLineNo == LineNo) {
- EndColNo = SourceMgr.getLogicalColumnNumber(R.getEnd());
- if (EndColNo) {
- --EndColNo; // Zero base the col #.
-
- // Add in the length of the token, so that we cover multi-char tokens.
- EndColNo += Lexer::MeasureTokenLength(R.getEnd(), SourceMgr);
- } else {
- EndColNo = CaratLine.size();
- }
- }
-
- // Pick the last non-whitespace column.
- if (EndColNo <= SourceLine.size())
- while (EndColNo-1 &&
- (SourceLine[EndColNo-1] == ' ' || SourceLine[EndColNo-1] == '\t'))
- --EndColNo;
- else
- EndColNo = SourceLine.size();
-
- // Fill the range with ~'s.
- assert(StartColNo <= EndColNo && "Invalid range!");
- for (unsigned i = StartColNo; i < EndColNo; ++i)
- CaratLine[i] = '~';
-}
-
-void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic &Diags,
- Diagnostic::Level Level,
- FullSourceLoc Pos,
- diag::kind ID,
- const std::string *Strs,
- unsigned NumStrs,
- const SourceRange *Ranges,
- unsigned NumRanges) {
- unsigned LineNo = 0, ColNo = 0;
- unsigned FileID = 0;
- const char *LineStart = 0, *LineEnd = 0;
-
- if (Pos.isValid()) {
- FullSourceLoc LPos = Pos.getLogicalLoc();
- LineNo = LPos.getLineNumber();
- FileID = LPos.getLocation().getFileID();
-
- // First, if this diagnostic is not in the main file, print out the
- // "included from" lines.
- if (LastWarningLoc != LPos.getIncludeLoc()) {
- LastWarningLoc = LPos.getIncludeLoc();
- PrintIncludeStack(LastWarningLoc);
- }
-
- // Compute the column number. Rewind from the current position to the start
- // of the line.
- ColNo = LPos.getColumnNumber();
- const char *TokLogicalPtr = LPos.getCharacterData();
- LineStart = TokLogicalPtr-ColNo+1; // Column # is 1-based
-
- // Compute the line end. Scan forward from the error position to the end of
- // the line.
- const llvm::MemoryBuffer *Buffer = LPos.getBuffer();
- const char *BufEnd = Buffer->getBufferEnd();
- LineEnd = TokLogicalPtr;
- while (LineEnd != BufEnd &&
- *LineEnd != '\n' && *LineEnd != '\r')
- ++LineEnd;
-
- OS << Buffer->getBufferIdentifier() << ":" << LineNo << ":";
- if (ColNo && !NoShowColumn)
- OS << ColNo << ":";
- OS << " ";
- }
-
- switch (Level) {
- default: assert(0 && "Unknown diagnostic type!");
- case Diagnostic::Note: OS << "note: "; break;
- case Diagnostic::Warning: OS << "warning: "; break;
- case Diagnostic::Error: OS << "error: "; break;
- case Diagnostic::Fatal: OS << "fatal error: "; break;
- break;
- }
-
- OS << FormatDiagnostic(Diags, Level, ID, Strs, NumStrs) << "\n";
-
- if (!NoCaretDiagnostics && Pos.isValid() && ((LastLoc != Pos) || Ranges)) {
- // Cache the LastLoc, it allows us to omit duplicate source/caret spewage.
- LastLoc = Pos;
-
- // Get the line of the source file.
- std::string SourceLine(LineStart, LineEnd);
-
- // Create a line for the carat that is filled with spaces that is the same
- // length as the line of source code.
- std::string CaratLine(LineEnd-LineStart, ' ');
-
- // Highlight all of the characters covered by Ranges with ~ characters.
- for (unsigned i = 0; i != NumRanges; ++i)
- HighlightRange(Ranges[i], Pos.getManager(), LineNo, FileID,
- CaratLine, SourceLine);
-
- // Next, insert the carat itself.
- if (ColNo-1 < CaratLine.size())
- CaratLine[ColNo-1] = '^';
- else
- CaratLine.push_back('^');
-
- // Scan the source line, looking for tabs. If we find any, manually expand
- // them to 8 characters and update the CaratLine to match.
- for (unsigned i = 0; i != SourceLine.size(); ++i) {
- if (SourceLine[i] != '\t') continue;
-
- // Replace this tab with at least one space.
- SourceLine[i] = ' ';
-
- // Compute the number of spaces we need to insert.
- unsigned NumSpaces = ((i+8)&~7) - (i+1);
- assert(NumSpaces < 8 && "Invalid computation of space amt");
-
- // Insert spaces into the SourceLine.
- SourceLine.insert(i+1, NumSpaces, ' ');
-
- // Insert spaces or ~'s into CaratLine.
- CaratLine.insert(i+1, NumSpaces, CaratLine[i] == '~' ? '~' : ' ');
- }
-
- // Finally, remove any blank spaces from the end of CaratLine.
- while (CaratLine[CaratLine.size()-1] == ' ')
- CaratLine.erase(CaratLine.end()-1);
-
- // Emit what we have computed.
- OS << SourceLine << "\n";
- OS << CaratLine << "\n";
- }
-}
Removed: cfe/trunk/Driver/TextDiagnosticPrinter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/TextDiagnosticPrinter.h?rev=54382&view=auto
==============================================================================
--- cfe/trunk/Driver/TextDiagnosticPrinter.h (original)
+++ cfe/trunk/Driver/TextDiagnosticPrinter.h (removed)
@@ -1,52 +0,0 @@
-//===--- TextDiagnosticPrinter.h - Text Diagnostic Client -------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This is a concrete diagnostic client, which prints the diagnostics to
-// standard error.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef TEXT_DIAGNOSTIC_PRINTER_H_
-#define TEXT_DIAGNOSTIC_PRINTER_H_
-
-#include "TextDiagnostics.h"
-#include "clang/Basic/SourceLocation.h"
-#include "llvm/Support/Streams.h"
-
-namespace clang {
-class SourceManager;
-
-class TextDiagnosticPrinter : public TextDiagnostics {
- FullSourceLoc LastWarningLoc;
- FullSourceLoc LastLoc;
- llvm::OStream OS;
-public:
- TextDiagnosticPrinter(llvm::OStream &os = llvm::cerr) : OS(os) {}
-
- void PrintIncludeStack(FullSourceLoc Pos);
-
- void HighlightRange(const SourceRange &R,
- SourceManager& SrcMgr,
- unsigned LineNo, unsigned FileID,
- std::string &CaratLine,
- const std::string &SourceLine);
-
- virtual void HandleDiagnostic(Diagnostic &Diags,
- Diagnostic::Level DiagLevel,
- FullSourceLoc Pos,
- diag::kind ID,
- const std::string *Strs,
- unsigned NumStrs,
- const SourceRange *Ranges,
- unsigned NumRanges);
-};
-
-} // end namspace clang
-
-#endif
Removed: cfe/trunk/Driver/TextDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/TextDiagnostics.cpp?rev=54382&view=auto
==============================================================================
--- cfe/trunk/Driver/TextDiagnostics.cpp (original)
+++ cfe/trunk/Driver/TextDiagnostics.cpp (removed)
@@ -1,53 +0,0 @@
-//===--- TextDiagnostics.cpp - Text Diagnostics Parent Class --------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This is the parent class for all text diagnostics.
-//
-//===----------------------------------------------------------------------===//
-
-#include "TextDiagnostics.h"
-#include "clang/Basic/SourceLocation.h"
-#include "clang/Basic/SourceManager.h"
-#include "clang/Lex/HeaderSearch.h"
-using namespace clang;
-
-TextDiagnostics:: ~TextDiagnostics() {}
-
-std::string TextDiagnostics::FormatDiagnostic(Diagnostic &Diags,
- Diagnostic::Level Level,
- diag::kind ID,
- const std::string *Strs,
- unsigned NumStrs) {
- std::string Msg = Diags.getDescription(ID);
-
- // Replace all instances of %0 in Msg with 'Extra'.
- for (unsigned i = 0; i < Msg.size() - 1; ++i) {
- if (Msg[i] == '%' && isdigit(Msg[i + 1])) {
- unsigned StrNo = Msg[i + 1] - '0';
- Msg = std::string(Msg.begin(), Msg.begin() + i) +
- (StrNo < NumStrs ? Strs[StrNo] : "<<<INTERNAL ERROR>>>") +
- std::string(Msg.begin() + i + 2, Msg.end());
- }
- }
-
- return Msg;
-}
-
-bool TextDiagnostics::isInSystemHeader(FullSourceLoc Pos) const {
- if (!Pos.isValid()) return false;
-
- if (const FileEntry *F = Pos.getFileEntryForLoc()) {
- DirectoryLookup::DirType DirInfo = TheHeaderSearch->getFileDirFlavor(F);
- if (DirInfo == DirectoryLookup::SystemHeaderDir ||
- DirInfo == DirectoryLookup::ExternCSystemHeaderDir)
- return true;
- }
-
- return false;
-}
Removed: cfe/trunk/Driver/TextDiagnostics.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/TextDiagnostics.h?rev=54382&view=auto
==============================================================================
--- cfe/trunk/Driver/TextDiagnostics.h (original)
+++ cfe/trunk/Driver/TextDiagnostics.h (removed)
@@ -1,50 +0,0 @@
-//===--- TextDiagnostics.h - Text Diagnostics Checkers ----------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This is the parent class for all text diagnostics.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef TEXT_DIAGNOSTICS_H_
-#define TEXT_DIAGNOSTICS_H_
-
-#include "clang/Basic/Diagnostic.h"
-
-namespace clang {
-class SourceManager;
-class HeaderSearch;
-class Preprocessor;
-
-class TextDiagnostics : public DiagnosticClient {
- HeaderSearch *TheHeaderSearch;
-protected:
- std::string FormatDiagnostic(Diagnostic &Diags, Diagnostic::Level Level,
- diag::kind ID,
- const std::string *Strs,
- unsigned NumStrs);
-public:
- TextDiagnostics() {}
- virtual ~TextDiagnostics();
-
- void setHeaderSearch(HeaderSearch &HS) { TheHeaderSearch = &HS; }
-
- virtual bool isInSystemHeader(FullSourceLoc Pos) const;
-
- virtual void HandleDiagnostic(Diagnostic &Diags, Diagnostic::Level DiagLevel,
- FullSourceLoc Pos,
- diag::kind ID,
- const std::string *Strs,
- unsigned NumStrs,
- const SourceRange *Ranges,
- unsigned NumRanges) = 0;
-};
-
-} // end namspace clang
-
-#endif
Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=54383&r1=54382&r2=54383&view=diff
==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Tue Aug 5 18:33:20 2008
@@ -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 @@
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 @@
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 @@
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();
Copied: cfe/trunk/include/clang/Driver/TextDiagnosticBuffer.h (from r54380, cfe/trunk/Driver/TextDiagnosticBuffer.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/TextDiagnosticBuffer.h?p2=cfe/trunk/include/clang/Driver/TextDiagnosticBuffer.h&p1=cfe/trunk/Driver/TextDiagnosticBuffer.h&r1=54380&r2=54383&rev=54383&view=diff
==============================================================================
--- cfe/trunk/Driver/TextDiagnosticBuffer.h (original)
+++ cfe/trunk/include/clang/Driver/TextDiagnosticBuffer.h Tue Aug 5 18:33:20 2008
@@ -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 {
Copied: cfe/trunk/include/clang/Driver/TextDiagnosticPrinter.h (from r54380, cfe/trunk/Driver/TextDiagnosticPrinter.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/TextDiagnosticPrinter.h?p2=cfe/trunk/include/clang/Driver/TextDiagnosticPrinter.h&p1=cfe/trunk/Driver/TextDiagnosticPrinter.h&r1=54380&r2=54383&rev=54383&view=diff
==============================================================================
--- cfe/trunk/Driver/TextDiagnosticPrinter.h (original)
+++ cfe/trunk/include/clang/Driver/TextDiagnosticPrinter.h Tue Aug 5 18:33:20 2008
@@ -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 @@
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);
Added: cfe/trunk/lib/Driver/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Makefile?rev=54383&view=auto
==============================================================================
--- cfe/trunk/lib/Driver/Makefile (added)
+++ cfe/trunk/lib/Driver/Makefile Tue Aug 5 18:33:20 2008
@@ -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
+
Copied: cfe/trunk/lib/Driver/TextDiagnosticBuffer.cpp (from r54380, cfe/trunk/Driver/TextDiagnosticBuffer.cpp)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/TextDiagnosticBuffer.cpp?p2=cfe/trunk/lib/Driver/TextDiagnosticBuffer.cpp&p1=cfe/trunk/Driver/TextDiagnosticBuffer.cpp&r1=54380&r2=54383&rev=54383&view=diff
==============================================================================
--- cfe/trunk/Driver/TextDiagnosticBuffer.cpp (original)
+++ cfe/trunk/lib/Driver/TextDiagnosticBuffer.cpp Tue Aug 5 18:33:20 2008
@@ -11,7 +11,7 @@
//
//===----------------------------------------------------------------------===//
-#include "TextDiagnosticBuffer.h"
+#include "clang/Driver/TextDiagnosticBuffer.h"
#include "clang/Basic/SourceManager.h"
using namespace clang;
Copied: cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp (from r54380, cfe/trunk/Driver/TextDiagnosticPrinter.cpp)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp?p2=cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp&p1=cfe/trunk/Driver/TextDiagnosticPrinter.cpp&r1=54380&r2=54383&rev=54383&view=diff
==============================================================================
--- cfe/trunk/Driver/TextDiagnosticPrinter.cpp (original)
+++ cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp Tue Aug 5 18:33:20 2008
@@ -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 @@
++LineEnd;
OS << Buffer->getBufferIdentifier() << ":" << LineNo << ":";
- if (ColNo && !NoShowColumn)
+ if (ColNo && ShowColumn)
OS << ColNo << ":";
OS << " ";
}
@@ -160,7 +151,7 @@
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;
Copied: cfe/trunk/lib/Driver/TextDiagnostics.cpp (from r54380, cfe/trunk/Driver/TextDiagnostics.cpp)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/TextDiagnostics.cpp?p2=cfe/trunk/lib/Driver/TextDiagnostics.cpp&p1=cfe/trunk/Driver/TextDiagnostics.cpp&r1=54380&r2=54383&rev=54383&view=diff
==============================================================================
--- cfe/trunk/Driver/TextDiagnostics.cpp (original)
+++ cfe/trunk/lib/Driver/TextDiagnostics.cpp Tue Aug 5 18:33:20 2008
@@ -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"
Modified: cfe/trunk/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Makefile?rev=54383&r1=54382&r2=54383&view=diff
==============================================================================
--- cfe/trunk/lib/Makefile (original)
+++ cfe/trunk/lib/Makefile Tue Aug 5 18:33:20 2008
@@ -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
More information about the cfe-commits
mailing list