summaryrefslogtreecommitdiffstats
path: root/clang/lib/ARCMigrate/TransformActions.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-01-25 00:20:29 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-01-25 00:20:29 +0000
commitaa7b9aa10dd90f79c37e0af7f4c6a0f9efeb288c (patch)
treee14b7c78706eeb22d22287ee913952085a911a53 /clang/lib/ARCMigrate/TransformActions.cpp
parentc454afedff4c709449d76b5700cc33b503f1d5b7 (diff)
downloadbcm5719-llvm-aa7b9aa10dd90f79c37e0af7f4c6a0f9efeb288c.tar.gz
bcm5719-llvm-aa7b9aa10dd90f79c37e0af7f4c6a0f9efeb288c.zip
arc migrator: Provide infrastructure to add options
specific to migrator. Use its first option to warn migrating from GC to arc when NSAllocateCollectable/NSReallocateCollectable is used. // rdar://10532541 llvm-svn: 148887
Diffstat (limited to 'clang/lib/ARCMigrate/TransformActions.cpp')
-rw-r--r--clang/lib/ARCMigrate/TransformActions.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/lib/ARCMigrate/TransformActions.cpp b/clang/lib/ARCMigrate/TransformActions.cpp
index 7ad9b6005dc..0ecfeb54f85 100644
--- a/clang/lib/ARCMigrate/TransformActions.cpp
+++ b/clang/lib/ARCMigrate/TransformActions.cpp
@@ -692,6 +692,25 @@ void TransformActions::reportError(StringRef error, SourceLocation loc,
ReportedErrors = true;
}
+void TransformActions::reportWarning(StringRef warning, SourceLocation loc,
+ SourceRange range) {
+ assert(!static_cast<TransformActionsImpl*>(Impl)->isInTransaction() &&
+ "Warning should be emitted out of a transaction");
+
+ SourceManager &SM = static_cast<TransformActionsImpl*>(Impl)->
+ getASTContext().getSourceManager();
+ if (SM.isInSystemHeader(SM.getExpansionLoc(loc)))
+ return;
+
+ // FIXME: Use a custom category name to distinguish rewriter errors.
+ std::string rewriterWarn = "[rewriter] ";
+ rewriterWarn += warning;
+ unsigned diagID
+ = Diags.getDiagnosticIDs()->getCustomDiagID(DiagnosticIDs::Warning,
+ rewriterWarn);
+ Diags.Report(loc, diagID) << range;
+}
+
void TransformActions::reportNote(StringRef note, SourceLocation loc,
SourceRange range) {
assert(!static_cast<TransformActionsImpl*>(Impl)->isInTransaction() &&
OpenPOWER on IntegriCloud