[cfe-commits] r90642 - in /cfe/trunk: include/clang/Basic/Diagnostic.h lib/Basic/Diagnostic.cpp lib/Frontend/TextDiagnosticPrinter.cpp tools/clang-cc/clang-cc.cpp
Steve Naroff
snaroff at apple.com
Fri Dec 4 18:14:08 PST 2009
Author: snaroff
Date: Fri Dec 4 20:14:08 2009
New Revision: 90642
URL: http://llvm.org/viewvc/llvm-project?rev=90642&view=rev
Log:
Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=71086
Note - This commit only includes the fix for:
<rdar://problem/6309338> slightly different error message format for Visual Studio.
The fix for <rdar://problem/6845623> from protocol to template. is separate/forthcoming.
Modified:
cfe/trunk/include/clang/Basic/Diagnostic.h
cfe/trunk/lib/Basic/Diagnostic.cpp
cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=90642&r1=90641&r2=90642&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Fri Dec 4 20:14:08 2009
@@ -182,6 +182,7 @@
bool SuppressAllDiagnostics; // Suppress all diagnostics.
ExtensionHandling ExtBehavior; // Map extensions onto warnings or errors?
DiagnosticClient *Client;
+ LangOptions *LangOpts;
/// DiagMappings - Mapping information for diagnostics. Mapping info is
/// packed into four bits per diagnostic. The low three bits are the mapping
@@ -238,7 +239,9 @@
DiagnosticClient *getClient() { return Client; }
const DiagnosticClient *getClient() const { return Client; }
-
+ LangOptions *getLangOpts() const { return LangOpts; }
+ void setLangOpts(LangOptions *LOpts) { LangOpts = LOpts; }
+
/// pushMappings - Copies the current DiagMappings and pushes the new copy
/// onto the top of the stack.
void pushMappings();
Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=90642&r1=90641&r2=90642&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Fri Dec 4 20:14:08 2009
@@ -210,7 +210,8 @@
ErrorOccurred = false;
FatalErrorOccurred = false;
NumDiagnostics = 0;
-
+ LangOpts = 0;
+
NumErrors = 0;
CustomDiagInfo = 0;
CurDiagID = ~0U;
Modified: cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp?rev=90642&r1=90641&r2=90642&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp Fri Dec 4 20:14:08 2009
@@ -653,11 +653,19 @@
if (DiagOpts->ShowLocation) {
if (DiagOpts->ShowColors)
OS.changeColor(savedColor, true);
- OS << PLoc.getFilename() << ':' << LineNo << ':';
- if (DiagOpts->ShowColumn)
- if (unsigned ColNo = PLoc.getColumn())
- OS << ColNo << ':';
-
+
+ // Emit a Visual Studio compatible line number syntax.
+ // This check is a bit paranoid (in case LangOpts isn't set).
+ if (Info.getDiags() && Info.getDiags()->getLangOpts() &&
+ Info.getDiags()->getLangOpts()->Microsoft) {
+ OS << PLoc.getFilename() << '(' << LineNo << ')';
+ OS << " : ";
+ } else {
+ OS << PLoc.getFilename() << ':' << LineNo << ':';
+ if (DiagOpts->ShowColumn)
+ if (unsigned ColNo = PLoc.getColumn())
+ OS << ColNo << ':';
+ }
if (DiagOpts->ShowSourceRanges && Info.getNumRanges()) {
FileID CaretFileID =
SM.getFileID(SM.getInstantiationLoc(Info.getLocation()));
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=90642&r1=90641&r2=90642&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Fri Dec 4 20:14:08 2009
@@ -237,6 +237,8 @@
if (!Clang.hasDiagnostics())
return 1;
+ Clang.getDiagnostics().setLangOpts(&Clang.getLangOpts());
+
// Set an error handler, so that any LLVM backend diagnostics go through our
// error handler.
llvm::llvm_install_error_handler(LLVMErrorHandler,
More information about the cfe-commits
mailing list