[cfe-commits] [PATCH] Use static storage duration for file-scope compound literals in C++ dynamic initializers

Eric Christopher echristo at apple.com
Tue Nov 22 16:34:19 PST 2011


On Nov 22, 2011, at 2:55 PM, Richard Smith wrote:

> On Tue, November 22, 2011 22:39, Chandler Carruth wrote:
>> On Tue, Nov 22, 2011 at 2:30 PM, Richard Smith <richard at metafoo.co.uk>wrote:
>>> The attached patch fixes the compound-literals-in-C++ extension to always
>>> use static storage duration for file-scope compound literals, as per GCC's
>>> documentation for this extension. Currently we only give them static storage
>>> duration if the initializer in which they appear is a constant.
>>> 
>>> OK to commit?
>> 
>> It's not clear to me why we need the helper function? Otherwise this looks
>> fine to me...
> 
> In r145087. We need the helper function because class ConstExprEmitter is
> defined in that .cpp file.

Looks like this broke one of the clang buildbots:

******************** TEST 'Clang :: CodeGenCXX/compound-literals.cpp' FAILED ********************Script:
--
/Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-i386-darwin10-RA/clang-build/Release+Asserts/bin/clang -cc1 -internal-isystem /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-i386-darwin10-RA/clang-build/Release+Asserts/bin/../lib/clang/3.1/include -emit-llvm -o - /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-i386-darwin10-RA/clang.src/test/CodeGenCXX/compound-literals.cpp | FileCheck /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-i386-darwin10-RA/clang.src/test/CodeGenCXX/compound-literals.cpp
--
Exit Code: 1
Command Output (stderr):
--
/Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-i386-darwin10-RA/clang.src/test/CodeGenCXX/compound-literals.cpp:44:11: error: expected string not found in input
// CHECK: store i32* getelementptr inbounds (%struct.Z* @.compoundliteral, i32 0, i32 0, i32 0), i32** @p, align 8
          ^
<stdin>:59:47: note: scanning from here
define internal void @__cxx_global_var_init() nounwind section "__TEXT,__StaticInit,regular,pure_instructions" {
                                              ^
<stdin>:61:2: note: possible intended match here
 store i32* getelementptr inbounds (%struct.Z* @.compoundliteral, i32 0, i32 0, i32 0), i32** @p, align 4
 ^
--

********************


Looks like it's a difference in alignment, but I'm not sure what it's supposed to be testing without looking closer.

-eric

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111122/43a1dc46/attachment.html>


More information about the cfe-commits mailing list