diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-01-25 00:20:29 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-01-25 00:20:29 +0000 |
commit | b5c6babd3d8e0233b8ea5a4eb1e2700e30c0d396 (patch) | |
tree | e5deec788a11cba4e6a7d0f20be47bb4c436d04e /lib/ARCMigrate/TransformActions.cpp | |
parent | 44fae525e792f09ecbe07c0a62cdbcb81e04306b (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148887 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ARCMigrate/TransformActions.cpp')
-rw-r--r-- | lib/ARCMigrate/TransformActions.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/ARCMigrate/TransformActions.cpp b/lib/ARCMigrate/TransformActions.cpp index 7ad9b6005d..0ecfeb54f8 100644 --- a/lib/ARCMigrate/TransformActions.cpp +++ b/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() && |