diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/CodeGen/CGExprConstant.cpp | 5 | ||||
-rw-r--r-- | clang/test/CodeGen/address-space-compound-literal.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index 2be22f98ab2..593406f5d0d 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -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: diff --git a/clang/test/CodeGen/address-space-compound-literal.c b/clang/test/CodeGen/address-space-compound-literal.c new file mode 100644 index 00000000000..79d19ed6b6b --- /dev/null +++ b/clang/test/CodeGen/address-space-compound-literal.c @@ -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}; + |