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 | 65aa6885818d4b4eea2e5a9d12085b2398148662 (patch) | |
tree | 7bd303c20cc28939158f9db96576f2b39316d55f /lib/AST/Expr.cpp | |
parent | 468eb7ddd69b5d545139fc46a3b730268c458f38 (diff) |
Make more use of llvm::StringRef in various APIs. In particular, don't
use the deprecated forms of llvm::StringMap::GetOrCreateValue().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133515 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r-- | lib/AST/Expr.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index cc2bdf5cd0..2f303da7b5 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -498,8 +498,8 @@ double FloatingLiteral::getValueAsApproximateDouble() const { return V.convertToDouble(); } -StringLiteral *StringLiteral::Create(ASTContext &C, const char *StrData, - unsigned ByteLength, bool Wide, +StringLiteral *StringLiteral::Create(ASTContext &C, llvm::StringRef Str, + bool Wide, bool Pascal, QualType Ty, const SourceLocation *Loc, unsigned NumStrs) { @@ -511,10 +511,10 @@ StringLiteral *StringLiteral::Create(ASTContext &C, const char *StrData, StringLiteral *SL = new (Mem) StringLiteral(Ty); // OPTIMIZE: could allocate this appended to the StringLiteral. - char *AStrData = new (C, 1) char[ByteLength]; - memcpy(AStrData, StrData, ByteLength); + char *AStrData = new (C, 1) char[Str.size()]; + memcpy(AStrData, Str.data(), Str.size()); SL->StrData = AStrData; - SL->ByteLength = ByteLength; + SL->ByteLength = Str.size(); SL->IsWide = Wide; SL->IsPascal = Pascal; SL->TokLocs[0] = Loc[0]; |