diff options
author | Alp Toker <alp@nuanti.com> | 2014-05-19 22:51:11 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2014-05-19 22:51:11 +0000 |
commit | 403a4f9b826da18c593b1863558e2ad28db867a9 (patch) | |
tree | c090dbc86c74dbe10296e5fdd9775d6e08f162b0 /clang | |
parent | 156a853ccb1030220fc6b407e2a9517dff380bb5 (diff) | |
download | bcm5719-llvm-403a4f9b826da18c593b1863558e2ad28db867a9.tar.gz bcm5719-llvm-403a4f9b826da18c593b1863558e2ad28db867a9.zip |
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.
llvm-svn: 209172
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); } |