diff options
| author | Jay Foad <jay.foad@gmail.com> | 2011-06-21 15:13:30 +0000 |
|---|---|---|
| committer | Jay Foad <jay.foad@gmail.com> | 2011-06-21 15:13:30 +0000 |
| commit | 9a6b09874dab1247224f04d3dc5e9e900c9110a9 (patch) | |
| tree | f870578396e39c1a4d958ff1adec70ab7f67f9d4 /clang/lib/Lex | |
| parent | ccbb77f2396eff2f782b3aab8fff1cc79a7c5cb6 (diff) | |
| download | bcm5719-llvm-9a6b09874dab1247224f04d3dc5e9e900c9110a9.tar.gz bcm5719-llvm-9a6b09874dab1247224f04d3dc5e9e900c9110a9.zip | |
Make more use of llvm::StringRef in various APIs. In particular, don't
use the deprecated forms of llvm::StringMap::GetOrCreateValue().
llvm-svn: 133515
Diffstat (limited to 'clang/lib/Lex')
| -rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 6 | ||||
| -rw-r--r-- | clang/lib/Lex/Pragma.cpp | 11 |
2 files changed, 6 insertions, 11 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 66e44bbc6dd..b6925b70b70 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -784,8 +784,7 @@ void Preprocessor::HandleLineDirective(Token &Tok) { Diag(StrTok, diag::err_pp_linemarker_invalid_filename); return DiscardUntilEndOfDirective(); } - FilenameID = SourceMgr.getLineTableFilenameID(Literal.GetString(), - Literal.GetStringLength()); + FilenameID = SourceMgr.getLineTableFilenameID(Literal.GetString()); // Verify that there is nothing after the string, other than EOD. Because // of C99 6.10.4p5, macros that expand to empty tokens are ok. @@ -918,8 +917,7 @@ void Preprocessor::HandleDigitDirective(Token &DigitTok) { Diag(StrTok, diag::err_pp_linemarker_invalid_filename); return DiscardUntilEndOfDirective(); } - FilenameID = SourceMgr.getLineTableFilenameID(Literal.GetString(), - Literal.GetStringLength()); + FilenameID = SourceMgr.getLineTableFilenameID(Literal.GetString()); // If a filename was present, read any flags that are present. if (ReadLineMarkerFlags(IsFileEntry, IsFileExit, diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp index 23855d4a474..512b024ad8c 100644 --- a/clang/lib/Lex/Pragma.cpp +++ b/clang/lib/Lex/Pragma.cpp @@ -326,9 +326,7 @@ void Preprocessor::HandlePragmaSystemHeader(Token &SysHeaderTok) { if (PLoc.isInvalid()) return; - unsigned FilenameLen = strlen(PLoc.getFilename()); - unsigned FilenameID = SourceMgr.getLineTableFilenameID(PLoc.getFilename(), - FilenameLen); + unsigned FilenameID = SourceMgr.getLineTableFilenameID(PLoc.getFilename()); // Notify the client, if desired, that we are in a new source file. if (Callbacks) @@ -454,8 +452,7 @@ void Preprocessor::HandlePragmaComment(Token &Tok) { return; } - ArgumentString = std::string(Literal.GetString(), - Literal.GetString()+Literal.GetStringLength()); + ArgumentString = Literal.GetString(); } // FIXME: If the kind is "compiler" warn if the string is present (it is @@ -531,7 +528,7 @@ void Preprocessor::HandlePragmaMessage(Token &Tok) { return; } - llvm::StringRef MessageString(Literal.GetString(), Literal.GetStringLength()); + llvm::StringRef MessageString(Literal.GetString()); if (ExpectClosingParen) { if (Tok.isNot(tok::r_paren)) { @@ -906,7 +903,7 @@ public: return; } - llvm::StringRef WarningName(Literal.GetString(), Literal.GetStringLength()); + llvm::StringRef WarningName(Literal.GetString()); if (WarningName.size() < 3 || WarningName[0] != '-' || WarningName[1] != 'W') { |

