From 6b2d47d8299ffd74c4418936da2322ce988340f5 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Fri, 4 Nov 2011 23:43:03 +0000 Subject: [arcmt] In GC, error out when there is a call that returns a pointer to GC managed non-objc object memory. llvm-svn: 143747 --- clang/lib/ARCMigrate/TransformActions.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'clang/lib/ARCMigrate/TransformActions.cpp') diff --git a/clang/lib/ARCMigrate/TransformActions.cpp b/clang/lib/ARCMigrate/TransformActions.cpp index ec676e909a3..7ad9b6005dc 100644 --- a/clang/lib/ARCMigrate/TransformActions.cpp +++ b/clang/lib/ARCMigrate/TransformActions.cpp @@ -122,6 +122,8 @@ public: ASTContext &ctx, Preprocessor &PP) : CapturedDiags(capturedDiags), Ctx(ctx), PP(PP), IsInTransaction(false) { } + ASTContext &getASTContext() { return Ctx; } + void startTransaction(); bool commitTransaction(); void abortTransaction(); @@ -674,6 +676,12 @@ void TransformActions::reportError(StringRef error, SourceLocation loc, SourceRange range) { assert(!static_cast(Impl)->isInTransaction() && "Errors should be emitted out of a transaction"); + + SourceManager &SM = static_cast(Impl)-> + getASTContext().getSourceManager(); + if (SM.isInSystemHeader(SM.getExpansionLoc(loc))) + return; + // FIXME: Use a custom category name to distinguish rewriter errors. std::string rewriteErr = "[rewriter] "; rewriteErr += error; @@ -688,6 +696,12 @@ void TransformActions::reportNote(StringRef note, SourceLocation loc, SourceRange range) { assert(!static_cast(Impl)->isInTransaction() && "Errors should be emitted out of a transaction"); + + SourceManager &SM = static_cast(Impl)-> + getASTContext().getSourceManager(); + if (SM.isInSystemHeader(SM.getExpansionLoc(loc))) + return; + // FIXME: Use a custom category name to distinguish rewriter errors. std::string rewriteNote = "[rewriter] "; rewriteNote += note; -- cgit v1.2.3