Random temporary string cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110807 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2010-08-11 14:47:12 +00:00
Родитель 7f1c547ee6
Коммит 476d8b863c
7 изменённых файлов: 10 добавлений и 12 удалений

Просмотреть файл

@ -671,7 +671,7 @@ static char DecodeTrigraphChar(const char *CP, Lexer *L) {
} }
if (!L->isLexingRawMode()) if (!L->isLexingRawMode())
L->Diag(CP-2, diag::trigraph_converted) << std::string()+Res; L->Diag(CP-2, diag::trigraph_converted) << llvm::StringRef(&Res, 1);
return Res; return Res;
} }

Просмотреть файл

@ -323,7 +323,7 @@ NumericLiteralParser(const char *begin, const char *end,
// Done. // Done.
} else if (isxdigit(*s) && !(*s == 'e' || *s == 'E')) { } else if (isxdigit(*s) && !(*s == 'e' || *s == 'E')) {
PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-begin), PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-begin),
diag::err_invalid_decimal_digit) << std::string(s, s+1); diag::err_invalid_decimal_digit) << llvm::StringRef(s, 1);
hadError = true; hadError = true;
return; return;
} else if (*s == '.') { } else if (*s == '.') {
@ -439,7 +439,7 @@ NumericLiteralParser(const char *begin, const char *end,
PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-begin), PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-begin),
isFPConstant ? diag::err_invalid_suffix_float_constant : isFPConstant ? diag::err_invalid_suffix_float_constant :
diag::err_invalid_suffix_integer_constant) diag::err_invalid_suffix_integer_constant)
<< std::string(SuffixBegin, ThisTokEnd); << llvm::StringRef(SuffixBegin, ThisTokEnd-SuffixBegin);
hadError = true; hadError = true;
return; return;
} }
@ -510,7 +510,7 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
// Done. // Done.
} else if (isxdigit(*s)) { } else if (isxdigit(*s)) {
PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-ThisTokBegin), PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-ThisTokBegin),
diag::err_invalid_binary_digit) << std::string(s, s+1); diag::err_invalid_binary_digit) << llvm::StringRef(s, 1);
hadError = true; hadError = true;
} }
// Other suffixes will be diagnosed by the caller. // Other suffixes will be diagnosed by the caller.
@ -540,7 +540,7 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
// the code is using an incorrect base. // the code is using an incorrect base.
if (isxdigit(*s) && *s != 'e' && *s != 'E') { if (isxdigit(*s) && *s != 'e' && *s != 'E') {
PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-ThisTokBegin), PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-ThisTokBegin),
diag::err_invalid_octal_digit) << std::string(s, s+1); diag::err_invalid_octal_digit) << llvm::StringRef(s, 1);
hadError = true; hadError = true;
return; return;
} }

Просмотреть файл

@ -164,7 +164,7 @@ void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const {
llvm::errs() << " [ExpandDisabled]"; llvm::errs() << " [ExpandDisabled]";
if (Tok.needsCleaning()) { if (Tok.needsCleaning()) {
const char *Start = SourceMgr.getCharacterData(Tok.getLocation()); const char *Start = SourceMgr.getCharacterData(Tok.getLocation());
llvm::errs() << " [UnClean='" << std::string(Start, Start+Tok.getLength()) llvm::errs() << " [UnClean='" << llvm::StringRef(Start, Tok.getLength())
<< "']"; << "']";
} }

Просмотреть файл

@ -492,7 +492,7 @@ bool TokenLexer::PasteTokens(Token &Tok) {
PP.Diag(Loc, PP.Diag(Loc,
PP.getLangOptions().Microsoft ? diag::err_pp_bad_paste_ms PP.getLangOptions().Microsoft ? diag::err_pp_bad_paste_ms
: diag::err_pp_bad_paste) : diag::err_pp_bad_paste)
<< std::string(Buffer.begin(), Buffer.end()); << Buffer.str();
} }
// Do not consume the RHS. // Do not consume the RHS.

Просмотреть файл

@ -26,7 +26,6 @@
#include "clang/Lex/Preprocessor.h" #include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/BitVector.h" #include "llvm/ADT/BitVector.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include "clang/Basic/TargetBuiltins.h" #include "clang/Basic/TargetBuiltins.h"
#include "clang/Basic/TargetInfo.h" #include "clang/Basic/TargetInfo.h"
@ -315,8 +314,7 @@ bool Sema::CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
unsigned Val = Result.getZExtValue(); unsigned Val = Result.getZExtValue();
if (Val < l || Val > (u + l)) if (Val < l || Val > (u + l))
return Diag(TheCall->getLocStart(), diag::err_argument_invalid_range) return Diag(TheCall->getLocStart(), diag::err_argument_invalid_range)
<< llvm::utostr(l) << llvm::utostr(u+l) << l << u+l << TheCall->getArg(i)->getSourceRange();
<< TheCall->getArg(i)->getSourceRange();
// FIXME: VFP Intrinsics should error if VFP not present. // FIXME: VFP Intrinsics should error if VFP not present.
return false; return false;

Просмотреть файл

@ -2436,7 +2436,7 @@ CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc,
// We didn't get to the end of the string. This means the component names // We didn't get to the end of the string. This means the component names
// didn't come from the same set *or* we encountered an illegal name. // didn't come from the same set *or* we encountered an illegal name.
Diag(OpLoc, diag::err_ext_vector_component_name_illegal) Diag(OpLoc, diag::err_ext_vector_component_name_illegal)
<< std::string(compStr,compStr+1) << SourceRange(CompLoc); << llvm::StringRef(compStr, 1) << SourceRange(CompLoc);
return QualType(); return QualType();
} }

Просмотреть файл

@ -3862,7 +3862,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
else else
Diag(Param->getLocation(), Diag(Param->getLocation(),
diag::note_partial_spec_unused_parameter) diag::note_partial_spec_unused_parameter)
<< std::string("<anonymous>"); << "<anonymous>";
} }
} }
} }