Author: alp Date: Mon May 19 17:51:11 2014 New Revision: 209172 URL: http://llvm.org/viewvc/llvm-project?rev=209172&view=rev Log: Get ARCMT/GC-check-warn-nsalloc.m working
The -no-ns-alloc-error migration option now causes the diagnostic to be ignored completely. If this isn't desired, the error can be downgraded to a warning using the usual -Wno-error=arcmt-ns-alloc. Note that we can't use -verify right now on this test because VerifyDiagnosticConsumer gets confused by multiple SourceManager instances, which is presumably the reason it was XFAILed in the first place and why the regression wasn't detected. We'll grep instead for now. Modified: cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td cfe/trunk/lib/ARCMigrate/ARCMT.cpp cfe/trunk/lib/ARCMigrate/TransGCCalls.cpp cfe/trunk/test/ARCMT/GC-check-warn-nsalloc.m Modified: cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=209172&r1=209171&r2=209172&view=diff ============================================================================== --- cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td Mon May 19 17:51:11 2014 @@ -143,7 +143,7 @@ def warn_mt_message : Warning<"[rewriter 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">; } Modified: cfe/trunk/lib/ARCMigrate/ARCMT.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ARCMT.cpp?rev=209172&r1=209171&r2=209172&view=diff ============================================================================== --- cfe/trunk/lib/ARCMigrate/ARCMT.cpp (original) +++ cfe/trunk/lib/ARCMigrate/ARCMT.cpp Mon May 19 17:51:11 2014 @@ -311,10 +311,9 @@ bool arcmt::checkForManualIssues(Compile 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); Modified: cfe/trunk/lib/ARCMigrate/TransGCCalls.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/TransGCCalls.cpp?rev=209172&r1=209171&r2=209172&view=diff ============================================================================== --- cfe/trunk/lib/ARCMigrate/TransGCCalls.cpp (original) +++ cfe/trunk/lib/ARCMigrate/TransGCCalls.cpp Mon May 19 17:51:11 2014 @@ -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; } Modified: cfe/trunk/test/ARCMT/GC-check-warn-nsalloc.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/GC-check-warn-nsalloc.m?rev=209172&r1=209171&r2=209172&view=diff ============================================================================== --- cfe/trunk/test/ARCMT/GC-check-warn-nsalloc.m (original) +++ cfe/trunk/test/ARCMT/GC-check-warn-nsalloc.m Mon May 19 17:51:11 2014 @@ -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); } _______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits