diff options
author | Michael Liao <michael.hliao@gmail.com> | 2019-02-21 19:40:20 +0000 |
---|---|---|
committer | Michael Liao <michael.hliao@gmail.com> | 2019-02-21 19:40:20 +0000 |
commit | 0ee7bd4ac5862ed18ba41faa5d67160734d4b493 (patch) | |
tree | 3d143234aacd4be398c05cdfc57583020230d9fd /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 948c9f93c4017262db155e57e107a76d4276bd8b (diff) | |
download | bcm5719-llvm-0ee7bd4ac5862ed18ba41faa5d67160734d4b493.tar.gz bcm5719-llvm-0ee7bd4ac5862ed18ba41faa5d67160734d4b493.zip |
[CodeGen] Fix string literal address space casting.
Summary:
- If a string literal is reused directly, need to add necessary address
space casting if the target requires that.
Reviewers: yaxunl
Subscribers: jvesely, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58509
llvm-svn: 354610
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 972d2afa8e6..65116dba095 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -4522,7 +4522,8 @@ CodeGenModule::GetAddrOfConstantStringFromLiteral(const StringLiteral *S, if (auto GV = *Entry) { if (Alignment.getQuantity() > GV->getAlignment()) GV->setAlignment(Alignment.getQuantity()); - return ConstantAddress(GV, Alignment); + return ConstantAddress(castStringLiteralToDefaultAddressSpace(*this, GV), + Alignment); } } @@ -4584,7 +4585,8 @@ ConstantAddress CodeGenModule::GetAddrOfConstantCString( if (auto GV = *Entry) { if (Alignment.getQuantity() > GV->getAlignment()) GV->setAlignment(Alignment.getQuantity()); - return ConstantAddress(GV, Alignment); + return ConstantAddress(castStringLiteralToDefaultAddressSpace(*this, GV), + Alignment); } } |