在构建到设备但不在模拟器中时出现LLVM错误

时间:2011-07-28 08:37:42

标签: ios ios4 xcode4 llvm-gcc gh-unit

当我尝试将我的测试目标构建到我的iPad1(4.3.5)或iPhone4(4.3.5)时,我从Xcode 4(Build 4A304a)收到以下错误:

Internal compiler error: tree check: expected tree that contains 'decl with visibility' structure, have 'const_decl' in c_common_truthvalue_conversion

但是当测试目标切换到模拟器中构建时不会。

borking的代码行是

GHAssertNotNULL(xxxObject, @"xxxObject could not be created");

(对象已被重命名以保护无辜者;-)但我可以说这是一个单身人士。

我搜索谷歌并没有得到任何与此错误相关的内容。

提前感谢你 伊恩。

1 个答案:

答案 0 :(得分:2)

我遇到了相同的编译错误:

internal compiler error: tree check: expected tree that contains 'decl with visibility' structure, have 'const_decl'  in c_common_truthvalue_conversion, at c-common.c:2836

在为iOS设备构建时使用Xcode 4.1和GHUnitIOS-0.4.32(以及GHUnitIOS-0.4.31)。请注意,构建模拟器时没有问题。

编译器错误涉及对GHAssertNotEqualObjectsGHAssertNotEquals的调用。

我收到编译器错误时使用的代码模式如下:

- (void) test_isEqual {
    SomeObject *foo = [[SomeObject alloc] initWithValue: 1];
    SomeObject *bar = [[SomeObject alloc] initWithValue: 2];

    GHAssertNotEquals(bar, foo, @"Different Objects, different values - different pointers");
    GHAssertNotEqualObjects(bar, foo, @"Different Objects, different values - different pointers (calls isEqual)");
}

我能够通过以下修改来编译代码:

- (void) test_isEqual {
    NSString *comment;
    SomeObject *foo = [[SomeObject alloc] initWithValue: 1];
    SomeObject *bar = [[SomeObject alloc] initWithValue: 2];

    comment = @"Different Objects, different values - different pointers";
    GHAssertNotEquals(bar, foo, comment);

    comment = @"Different Objects, different values - different pointers (calls isEqual)";
    GHAssertNotEqualObjects(bar, foo, comment);
}

请注意,使用GHAssertEqualObjectsGHAssertEqualStringsGHAssertEqualsGHAssertFalseGHAssertNilGHAssertNotNilGHAssertTrue的电话const NSString,即@“some string”,不会导致编译器错误。

查看#define GHAssertNotEquals(a1, a2, description, ...)#define GHAssertEqualObjects(a1, a2, description, ...)以及description的使用情况,都会调用GHComposeString(description, ##__VA_ARGS__),但其他宏也可以调用。