[cfe-commits] r44553 - in /cfe/trunk: Driver/RewriteTest.cpp test/Sema/undef-field-reference-1.m

Ted Kremenek kremenek at apple.com
Mon Dec 3 14:59:32 PST 2007


Hi Fariborz,

This test case fails for me.  It has something to do with the piping  
of the results to clang:

(kremenek at grue:Sema)$ clang -rewrite-test undef-field-reference-1.m |  
clang
0   clang                               0x001fef25  
_ZN40_GLOBAL__N_Signals.cpp_00000000_4191753915PrintStackTraceEv + 45
1   clang                               0x001ff2cb  
_ZN40_GLOBAL__N_Signals.cpp_00000000_4191753913SignalHandlerEi + 323
2   libSystem.B.dylib                   0x9322297b _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   clang                               0x000ea4ce  
_ZN5clang12HeaderSearch24LookupSubframeworkHeaderEPKcS2_PKNS_9FileEntryE 
  + 84
5   clang                               0x000fe9fc  
_ZN5clang12Preprocessor10LookupFileEPKcS2_bPKNS_15DirectoryLookupERS5_  
+ 258
6   clang                               0x00102752  
_ZN5clang12Preprocessor22HandleIncludeDirectiveERNS_5TokenEPKNS_15DirectoryLookupEb 
  + 600
7   clang                               0x00103920  
_ZN5clang12Preprocessor15HandleDirectiveERNS_5TokenE + 572
8   clang                               0x000f00d0  
_ZN5clang5Lexer16LexTokenInternalERNS_5TokenE + 6148
9   clang                               0x00006e78  
_ZN5clang5Lexer3LexERNS_5TokenE + 72
10  clang                               0x00006f09  
_ZN5clang12Preprocessor3LexERNS_5TokenE + 37
11  clang                               0x000e8d9b  
_ZN5clang6Parser12ConsumeTokenEv + 173
12  clang                               0x000d6a6d  
_ZN5clang6Parser43ParseInitDeclaratorListAfterFirstDeclaratorERNS_10DeclaratorE 
  + 449
13  clang                               0x000e84ed  
_ZN5clang6Parser36ParseDeclarationOrFunctionDefinitionEv + 945
14  clang                               0x000e856f  
_ZN5clang6Parser24ParseExternalDeclarationEv + 83
15  clang                               0x000e874b  
_ZN5clang6Parser17ParseTopLevelDeclERPv + 61
16  clang                               0x00068214  
_ZN37_GLOBAL__N__ZN5clang11ASTConsumerD2Ev11ASTStreamer16ReadTopLevelDeclEv 
  + 24
17  clang                               0x00068366  
_ZN5clang8ParseASTERNS_12PreprocessorEjPNS_11ASTConsumerEb + 272
18  clang                               0x00024910  
_ZNSsC1IN9__gnu_cxx17__normal_iteratorIPcSsEEEET_S4_RKSaIcE + 1872
19  clang                               0x00026a76 main + 1036
20  clang                               0x00001a22 start + 54


but this "works":

(kremenek at grue:Sema)$ clang -rewrite-test undef-field-reference-1.m >  
t.m
(kremenek at grue:Sema)$ clang t.m
t.m:13:10: error: 'Objc/objc.h' file not found
#include <Objc/objc.h>
          ^
1 diagnostic generated.
(kremenek at grue:Sema)$ cat t.m
struct objc_selector; struct objc_class; struct objc_super;
extern struct objc_object *objc_msgSend(struct objc_object *, struct  
objc_selector *, ...);
extern struct objc_object *objc_msgSendSuper(struct objc_super *,  
struct objc_selector *, ...);
extern struct objc_object *objc_msgSend_stret(struct objc_object *,  
struct objc_selector *, ...);
extern struct objc_object *objc_msgSendSuper_stret(struct objc_super  
*, struct objc_selector *, ...);
extern struct objc_object *objc_msgSend_fpret(struct objc_object *,  
struct objc_selector *, ...);
extern struct objc_object *objc_getClass(const char *);
extern void objc_exception_throw(struct objc_object *);
extern void objc_exception_try_enter(void *);
extern void objc_exception_try_exit(void *);
extern struct objc_object *objc_exception_extract(void *);
extern int objc_exception_match(struct objc_class *, struct  
objc_object *, ...);
#include <Objc/objc.h>
// RUN: clang -rewrite-test %s | clang

#include <objc/objc.h>

#ifndef _REWRITER_typedef_MyDerived
#define _REWRITER_typedef_MyDerived
typedef struct MyDerived MyDerived;
#endif

struct MyDerived
{
// @public
	int IVAR;
};
// @end

MyDerived *pd;
int main() {
	return pd->IVAR;
}

The crashing on the pipe is weird (causing the test case to fail).   
The "#include <Objc/objc.h>" is causing clang to report problems  
because I am on a case-sensitive filesystem.

I haven't diagnosed the source of the crash yet (for the first case).   
I just noticed it.  I'm running Leopard on x86.

On Dec 3, 2007, at 2:25 PM, Fariborz Jahanian wrote:

> Author: fjahanian
> Date: Mon Dec  3 16:25:42 2007
> New Revision: 44553
>
> URL: http://llvm.org/viewvc/llvm-project?rev=44553&view=rev
> Log:
> Fixed a bug exposed by referencing an ivar field using component  
> reference syntax.
>
> Added:
>    cfe/trunk/test/Sema/undef-field-reference-1.m
> Modified:
>    cfe/trunk/Driver/RewriteTest.cpp
>
> Modified: cfe/trunk/Driver/RewriteTest.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteTest.cpp?rev=44553&r1=44552&r2=44553&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/Driver/RewriteTest.cpp (original)
> +++ cfe/trunk/Driver/RewriteTest.cpp Mon Dec  3 16:25:42 2007
> @@ -593,7 +593,9 @@
>     ResultStr += "#define _REWRITER_typedef_";
>     ResultStr += ClassDecl->getName();
>     ResultStr += "\n";
> -    ResultStr += "typedef struct objc_object ";
> +    ResultStr += "typedef struct ";
> +    ResultStr += ClassDecl->getName();
> +    ResultStr += " ";
>     ResultStr += ClassDecl->getName();
>     ResultStr += ";\n#endif\n";
>
>
> Added: cfe/trunk/test/Sema/undef-field-reference-1.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/undef-field-reference-1.m?rev=44553&view=auto
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/test/Sema/undef-field-reference-1.m (added)
> +++ cfe/trunk/test/Sema/undef-field-reference-1.m Mon Dec  3  
> 16:25:42 2007
> @@ -0,0 +1,17 @@
> +// RUN: clang -rewrite-test %s | clang
> +
> +#include <objc/objc.h>
> +
> + at interface MyDerived
> +{
> + at public
> +	int IVAR;
> +}
> + at end
> +
> +MyDerived *pd;
> +int main() {
> +	return pd->IVAR;
> +}
> +
> +
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list