зеркало из https://github.com/microsoft/clang-1.git
Make constant emission for @encode use the common string emission code.
This is a bit cleaner, and also "fixes" bad code that compares the addresses of the string constants. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66346 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
11894a4ad6
Коммит
a210f350fa
|
@ -1133,11 +1133,7 @@ CodeGenModule::GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *E) {
|
|||
std::string Str;
|
||||
getContext().getObjCEncodingForType(E->getEncodedType(), Str);
|
||||
|
||||
llvm::Constant *C = llvm::ConstantArray::get(Str);
|
||||
C = new llvm::GlobalVariable(C->getType(), true,
|
||||
llvm::GlobalValue::InternalLinkage,
|
||||
C, ".str", &getModule());
|
||||
return C;
|
||||
return GetAddrOfConstantCString(Str);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
// RUN: clang -emit-llvm -o - %s -O2 | grep "ret i32 1"
|
||||
|
||||
int a() {
|
||||
return @encode(int) == @encode(int);
|
||||
}
|
Загрузка…
Ссылка в новой задаче