summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorMichael Liao <michael.hliao@gmail.com>2019-02-21 19:40:20 +0000
committerMichael Liao <michael.hliao@gmail.com>2019-02-21 19:40:20 +0000
commit0ee7bd4ac5862ed18ba41faa5d67160734d4b493 (patch)
tree3d143234aacd4be398c05cdfc57583020230d9fd /clang/lib/CodeGen/CodeGenModule.cpp
parent948c9f93c4017262db155e57e107a76d4276bd8b (diff)
downloadbcm5719-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.cpp6
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);
}
}
OpenPOWER on IntegriCloud