Make address-space qualification work correctly for compound literals.

Issue reported on cfe-dev.

Also fixed the code to use isConstant to determine whether to generate a 
constant global, to be consistent with CodeGenModule.  This probably 
needs to be refactored to deal with C++, though.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80131 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eli Friedman 2009-08-26 20:01:39 +00:00
Родитель 2cf738f194
Коммит d15d8c6395
2 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -591,9 +591,10 @@ public:
// FIXME: "Leaked" on failure.
if (C)
C = new llvm::GlobalVariable(CGM.getModule(), C->getType(),
E->getType().isConstQualified(),
E->getType().isConstant(CGM.getContext()),
llvm::GlobalValue::InternalLinkage,
C, ".compoundliteral");
C, ".compoundliteral", 0, false,
E->getType().getAddressSpace());
return C;
}
case Expr::DeclRefExprClass:

Просмотреть файл

@ -0,0 +1,5 @@
// RUN: clang-cc -emit-llvm < %s | grep "internal addrspace(1) global i32 1"
typedef int a __attribute__((address_space(1)));
a* x = &(a){1};