[cfe-commits] r71086 - in /cfe/branches/Apple/objective-rewrite/tools/clang: Driver/RewriteObjC.cpp Driver/clang.cpp include/clang/Basic/Diagnostic.h lib/Basic/Diagnostic.cpp lib/Driver/TextDiagnosticPrinter.cpp
Steve Naroff
snaroff at apple.com
Wed May 6 08:22:44 PDT 2009
Author: snaroff
Date: Wed May 6 10:22:38 2009
New Revision: 71086
URL: http://llvm.org/viewvc/llvm-project?rev=71086&view=rev
Log:
Finish fixing <rdar://problem/6845623> from protocol to template.
Start of fix for <rdar://problem/6309338> <rdar://problem/6309338> slightly different error message format for Visual Studio. Still waiting for feedback from Pete to finalize.
Modified:
cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
cfe/branches/Apple/objective-rewrite/tools/clang/Driver/clang.cpp
cfe/branches/Apple/objective-rewrite/tools/clang/include/clang/Basic/Diagnostic.h
cfe/branches/Apple/objective-rewrite/tools/clang/lib/Basic/Diagnostic.cpp
cfe/branches/Apple/objective-rewrite/tools/clang/lib/Driver/TextDiagnosticPrinter.cpp
Modified: cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp?rev=71086&r1=71085&r2=71086&view=diff
==============================================================================
--- cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp (original)
+++ cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp Wed May 6 10:22:38 2009
@@ -338,6 +338,8 @@
Stmt *SynthesizeBlockCall(CallExpr *Exp);
void SynthesizeBlockLiterals(SourceLocation FunLocStart,
const char *FunName);
+
+ void RewriteRecordBody(RecordDecl *RD);
void CollectBlockDeclRefInfo(BlockExpr *Exp);
void GetBlockCallExprs(Stmt *S);
@@ -1881,6 +1883,10 @@
return;
Type = proto->getResultType();
}
+ else if (FieldDecl *FD = dyn_cast<FieldDecl>(Dcl)) {
+ Loc = FD->getLocation();
+ Type = FD->getType();
+ }
else
return;
@@ -4443,6 +4449,18 @@
return S;
}
+void RewriteObjC::RewriteRecordBody(RecordDecl *RD) {
+ for (RecordDecl::field_iterator i = RD->field_begin(),
+ e = RD->field_end(); i != e; ++i) {
+ FieldDecl *FD = *i;
+ if (isTopLevelBlockPointerType(FD->getType()))
+ RewriteBlockPointerDecl(FD);
+ if (FD->getType()->isObjCQualifiedIdType() ||
+ FD->getType()->isObjCQualifiedInterfaceType())
+ RewriteObjCQualifiedInterfaceTypes(FD);
+ }
+}
+
/// HandleDeclInMainFile - This is called for each top-level decl defined in the
/// main file of the input.
void RewriteObjC::HandleDeclInMainFile(Decl *D) {
@@ -4504,6 +4522,10 @@
RewriteCastExpr(CE);
}
}
+ } else if (VD->getType()->isRecordType()) {
+ RecordDecl *RD = VD->getType()->getAsRecordType()->getDecl();
+ if (RD->isDefinition())
+ RewriteRecordBody(RD);
}
if (VD->getInit()) {
GlobalVarDecl = VD;
@@ -4531,17 +4553,16 @@
RewriteBlockPointerDecl(TD);
else if (TD->getUnderlyingType()->isFunctionPointerType())
CheckFunctionPointerDecl(TD->getUnderlyingType(), TD);
+ else if (TD->getUnderlyingType()->isRecordType()) {
+ RecordDecl *RD = TD->getUnderlyingType()->getAsRecordType()->getDecl();
+ if (RD->isDefinition())
+ RewriteRecordBody(RD);
+ }
return;
}
if (RecordDecl *RD = dyn_cast<RecordDecl>(D)) {
- if (RD->isDefinition()) {
- for (RecordDecl::field_iterator i = RD->field_begin(),
- e = RD->field_end(); i != e; ++i) {
- FieldDecl *FD = *i;
- if (isTopLevelBlockPointerType(FD->getType()))
- RewriteBlockPointerDecl(FD);
- }
- }
+ if (RD->isDefinition())
+ RewriteRecordBody(RD);
return;
}
// Nothing yet.
Modified: cfe/branches/Apple/objective-rewrite/tools/clang/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/objective-rewrite/tools/clang/Driver/clang.cpp?rev=71086&r1=71085&r2=71086&view=diff
==============================================================================
--- cfe/branches/Apple/objective-rewrite/tools/clang/Driver/clang.cpp (original)
+++ cfe/branches/Apple/objective-rewrite/tools/clang/Driver/clang.cpp Wed May 6 10:22:38 2009
@@ -1624,10 +1624,10 @@
if (!HTMLDiag.empty()) {
TmpClient.reset(CreateHTMLDiagnosticClient(HTMLDiag, PP.get(),
&PPFactory));
- Diags.setClient(TmpClient.get());
+ Diags.setClient(TmpClient.get(), &LangInfo);
}
else
- Diags.setClient(TextDiagClient);
+ Diags.setClient(TextDiagClient, &LangInfo);
// Process the source file.
ProcessInputFile(*PP, PPFactory, InFile, PCH ? GeneratePCH : ProgAction);
Modified: cfe/branches/Apple/objective-rewrite/tools/clang/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/objective-rewrite/tools/clang/include/clang/Basic/Diagnostic.h?rev=71086&r1=71085&r2=71086&view=diff
==============================================================================
--- cfe/branches/Apple/objective-rewrite/tools/clang/include/clang/Basic/Diagnostic.h (original)
+++ cfe/branches/Apple/objective-rewrite/tools/clang/include/clang/Basic/Diagnostic.h Wed May 6 10:22:38 2009
@@ -15,6 +15,7 @@
#define LLVM_CLANG_DIAGNOSTIC_H
#include "clang/Basic/SourceLocation.h"
+#include "clang/Basic/LangOptions.h"
#include <string>
#include <cassert>
@@ -94,7 +95,8 @@
bool ErrorOnExtensions; // Error on extensions: -pedantic-errors.
bool SuppressSystemWarnings;// Suppress warnings in system headers.
DiagnosticClient *Client;
-
+ LangOptions *LangOpts;
+
/// DiagMappings - Mapping information for diagnostics. Mapping info is
/// packed into two bits per diagnostic.
unsigned char DiagMappings[diag::DIAG_UPPER_LIMIT/4];
@@ -129,8 +131,11 @@
DiagnosticClient *getClient() { return Client; };
const DiagnosticClient *getClient() const { return Client; };
- void setClient(DiagnosticClient* client) { Client = client; }
-
+ void setClient(DiagnosticClient* client, LangOptions *opts = 0) {
+ Client = client; LangOpts = opts;
+ }
+ LangOptions *getLangOpts() const { return LangOpts; }
+
/// setIgnoreAllWarnings - When set to true, any unmapped warnings are
/// ignored. If this and WarningsAsErrors are both set, then this one wins.
void setIgnoreAllWarnings(bool Val) { IgnoreAllWarnings = Val; }
Modified: cfe/branches/Apple/objective-rewrite/tools/clang/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/objective-rewrite/tools/clang/lib/Basic/Diagnostic.cpp?rev=71086&r1=71085&r2=71086&view=diff
==============================================================================
--- cfe/branches/Apple/objective-rewrite/tools/clang/lib/Basic/Diagnostic.cpp (original)
+++ cfe/branches/Apple/objective-rewrite/tools/clang/lib/Basic/Diagnostic.cpp Wed May 6 10:22:38 2009
@@ -180,7 +180,7 @@
}
-Diagnostic::Diagnostic(DiagnosticClient *client) : Client(client) {
+Diagnostic::Diagnostic(DiagnosticClient *client) : Client(client), LangOpts(0) {
IgnoreAllWarnings = false;
WarningsAsErrors = false;
WarnOnExtensions = false;
Modified: cfe/branches/Apple/objective-rewrite/tools/clang/lib/Driver/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/objective-rewrite/tools/clang/lib/Driver/TextDiagnosticPrinter.cpp?rev=71086&r1=71085&r2=71086&view=diff
==============================================================================
--- cfe/branches/Apple/objective-rewrite/tools/clang/lib/Driver/TextDiagnosticPrinter.cpp (original)
+++ cfe/branches/Apple/objective-rewrite/tools/clang/lib/Driver/TextDiagnosticPrinter.cpp Wed May 6 10:22:38 2009
@@ -114,10 +114,15 @@
// Compute the column number.
ColNo = PLoc.getColumn();
if (ShowLocation) {
- OS << PLoc.getFilename() << ':' << LineNo << ':';
- if (ColNo && ShowColumn)
- OS << ColNo << ':';
- OS << ' ';
+ if (Info.getDiags()->getLangOpts()->Microsoft) {
+ OS << PLoc.getFilename() << '(' << LineNo << ')';
+ OS << " : ";
+ } else {
+ OS << PLoc.getFilename() << ':' << LineNo << ':';
+ if (ColNo && ShowColumn)
+ OS << ColNo << ':';
+ OS << ' ';
+ }
}
}
More information about the cfe-commits
mailing list