diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang/Basic/DiagnosticCommonKinds.td | 2 | ||||
-rw-r--r-- | clang/lib/ARCMigrate/ARCMT.cpp | 7 | ||||
-rw-r--r-- | clang/lib/ARCMigrate/TransGCCalls.cpp | 2 | ||||
-rw-r--r-- | clang/test/ARCMT/GC-check-warn-nsalloc.m | 9 |
4 files changed, 10 insertions, 10 deletions
diff --git a/clang/include/clang/Basic/DiagnosticCommonKinds.td b/clang/include/clang/Basic/DiagnosticCommonKinds.td index 0430b1dc27a..b6260627c73 100644 --- a/clang/include/clang/Basic/DiagnosticCommonKinds.td +++ b/clang/include/clang/Basic/DiagnosticCommonKinds.td @@ -143,7 +143,7 @@ def warn_mt_message : Warning<"[rewriter] %0">; def note_mt_message : Note<"[rewriter] %0">; // ARCMigrate -def err_arcmt_nsalloc_realloc : Error<"[rewriter] call returns pointer to GC managed memory; it will become unmanaged in ARC">; +def warn_arcmt_nsalloc_realloc : Warning<"[rewriter] call returns pointer to GC managed memory; it will become unmanaged in ARC">, InGroup<DiagGroup<"arcmt-ns-alloc">>, DefaultError; def err_arcmt_nsinvocation_ownership : Error<"NSInvocation's %0 is not safe to be used with an object with ownership other than __unsafe_unretained">; } diff --git a/clang/lib/ARCMigrate/ARCMT.cpp b/clang/lib/ARCMigrate/ARCMT.cpp index 178ec84e201..88ff50fcf96 100644 --- a/clang/lib/ARCMigrate/ARCMT.cpp +++ b/clang/lib/ARCMigrate/ARCMT.cpp @@ -311,10 +311,9 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI, MigrationPass pass(Ctx, OrigGCMode, Unit->getSema(), testAct, capturedDiags, ARCMTMacroLocs); pass.setNoFinalizeRemoval(NoFinalizeRemoval); - Diags->setDiagnosticMapping(diag::err_arcmt_nsalloc_realloc, - NoNSAllocReallocError ? diag::MAP_WARNING - : diag::MAP_ERROR, - SourceLocation()); + if (NoNSAllocReallocError) + Diags->setDiagnosticMapping(diag::warn_arcmt_nsalloc_realloc, + diag::MAP_IGNORE, SourceLocation()); for (unsigned i=0, e = transforms.size(); i != e; ++i) transforms[i](pass); diff --git a/clang/lib/ARCMigrate/TransGCCalls.cpp b/clang/lib/ARCMigrate/TransGCCalls.cpp index 401e7880844..3a236d34cd4 100644 --- a/clang/lib/ARCMigrate/TransGCCalls.cpp +++ b/clang/lib/ARCMigrate/TransGCCalls.cpp @@ -38,7 +38,7 @@ public: TransformActions &TA = MigrateCtx.Pass.TA; if (MigrateCtx.isGCOwnedNonObjC(E->getType())) { - TA.report(E->getLocStart(), diag::err_arcmt_nsalloc_realloc, + TA.report(E->getLocStart(), diag::warn_arcmt_nsalloc_realloc, E->getSourceRange()); return true; } diff --git a/clang/test/ARCMT/GC-check-warn-nsalloc.m b/clang/test/ARCMT/GC-check-warn-nsalloc.m index 6be05b6a7a9..ec3cd0ce334 100644 --- a/clang/test/ARCMT/GC-check-warn-nsalloc.m +++ b/clang/test/ARCMT/GC-check-warn-nsalloc.m @@ -1,11 +1,12 @@ -// RUN: %clang_cc1 -arcmt-check -verify -no-ns-alloc-error -triple x86_64-apple-darwin10 -fobjc-gc-only %s -// RUN: %clang_cc1 -arcmt-check -verify -no-ns-alloc-error -triple x86_64-apple-darwin10 -fobjc-gc-only -x objective-c++ %s +// RUN: %clang_cc1 -arcmt-check -no-ns-alloc-error -triple x86_64-apple-darwin10 -fobjc-gc-only %s | not grep warning +// RUN: %clang_cc1 -arcmt-check -Wno-error=arcmt-ns-alloc -triple x86_64-apple-darwin10 -fobjc-gc-only %s 2>&1 | grep 'warning: \[rewriter\] call returns pointer to GC managed memory' +// RUN: %clang_cc1 -arcmt-check -no-ns-alloc-error -triple x86_64-apple-darwin10 -fobjc-gc-only -x objective-c++ %s | not grep warning +// TODO: Investigate VerifyDiagnosticConsumer failures on these tests when using -verify. // rdar://10532541 -// XFAIL: * typedef unsigned NSUInteger; void *__strong NSAllocateCollectable(NSUInteger size, NSUInteger options); void test1() { - NSAllocateCollectable(100, 0); // expected-warning {{call returns pointer to GC managed memory; it will become unmanaged in ARC}} + NSAllocateCollectable(100, 0); } |