diff options
| author | Anna Zaks <ganna@apple.com> | 2012-05-30 23:14:52 +0000 | 
|---|---|---|
| committer | Anna Zaks <ganna@apple.com> | 2012-05-30 23:14:52 +0000 | 
| commit | d08d9159c2893aa9517ce58da9d52a9c07e113ac (patch) | |
| tree | 5f0e79b3e54a7c212ea79fcd7cd4896bfd9eaf37 /clang/lib/Sema | |
| parent | 34d89b7ddc709c48baf87d68c401f3565e67a2b5 (diff) | |
| download | bcm5719-llvm-d08d9159c2893aa9517ce58da9d52a9c07e113ac.tar.gz bcm5719-llvm-d08d9159c2893aa9517ce58da9d52a9c07e113ac.zip | |
Change wording of 'memcpy' type mismatch warning and remove fixit.
As per comments following r157659.
llvm-svn: 157722
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 26 | 
1 files changed, 10 insertions, 16 deletions
| diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 004e9948f20..e35f45b89dc 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -2755,24 +2755,14 @@ void Sema::CheckMemaccessArguments(const CallExpr *Call,            // TODO: For strncpy() and friends, this could suggest sizeof(dst)            //       over sizeof(src) as well.            unsigned ActionIdx = 0; // Default is to suggest dereferencing. -          FixItHint Fixit = FixItHint(); // Default hint.            StringRef ReadableName = FnName->getName(); -          if (isa<DeclRefExpr>(SizeOfArg)) -            Fixit = FixItHint::CreateInsertion(SizeOfArg->getLocStart(), "*"); -            if (const UnaryOperator *UnaryOp = dyn_cast<UnaryOperator>(Dest)) -            if (UnaryOp->getOpcode() == UO_AddrOf) { -              Fixit = FixItHint::CreateRemoval( -                      CharSourceRange::getTokenRange(SizeOfArg->getLocStart(), -                                                     SizeOfArg->getLocStart())); +            if (UnaryOp->getOpcode() == UO_AddrOf)                ActionIdx = 1; // If its an address-of operator, just remove it. -            }            if (Context.getTypeSize(PointeeTy) == Context.getCharWidth())              ActionIdx = 2; // If the pointee's size is sizeof(char),                             // suggest an explicit length. -          unsigned DestSrcSelect = -            (BId == Builtin::BIstrndup ? 1 : ArgIdx);            // If the function is defined as a builtin macro, do not show macro            // expansion. @@ -2790,14 +2780,18 @@ void Sema::CheckMemaccessArguments(const CallExpr *Call,                               SM.getSpellingLoc(SSR.getEnd()));            } -          DiagRuntimeBehavior(SL, Dest, +          DiagRuntimeBehavior(SL, SizeOfArg,                                PDiag(diag::warn_sizeof_pointer_expr_memaccess)                                  << ReadableName -                                << DestSrcSelect -                                << ActionIdx +                                << PointeeTy +                                << DestTy                                  << DSR -                                << SSR -                                << Fixit); +                                << SSR); +          DiagRuntimeBehavior(SL, SizeOfArg, +                         PDiag(diag::warn_sizeof_pointer_expr_memaccess_note) +                                << ActionIdx +                                << SSR); +            break;          }        } | 

