<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Sep 16, 2009, at 9:13 AM, Cédric Venet wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">(note that I am using clang on windows with the mingw 3.4.5 headers and that the define __declspec is needed. perhaps it should be added to  the predefined macro? as clang support the dllimport attribute)<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">We have some support for parsing __declspec already, but I'm sure that we're missing it when parsing some C++ constructs. What kinds of problems are you seeing with __declspec?<br></blockquote><br>It is mingw specific and not a problem on declspec. In _mingw.h, there is:<br><br>#ifndef __GNUC__<br># ifndef __MINGW_IMPORT<br>#  define __MINGW_IMPORT  __declspec(dllimport)<br># endif<br># ifndef _CRTIMP<br>#  define _CRTIMP  __declspec(dllimport)<br># endif<br># define __DECLSPEC_SUPPORTED<br># define __attribute__(x) /* nothing */<br>#else /* __GNUC__ */<br># ifdef __declspec<br>#  ifndef __MINGW_IMPORT<br>  /* Note the extern. This is needed to work around GCC's<br>     limitations in handling dllimport attribute.  */<br>#   define __MINGW_IMPORT  extern __attribute__ ((__dllimport__))<br>#  endif<br>#  ifndef _CRTIMP<br>#   ifdef __USE_CRTIMP<br>#    define _CRTIMP  __attribute__ ((dllimport))<br>#   else<br>#    define _CRTIMP<br>#   endif<br>#  endif<br>#  define __DECLSPEC_SUPPORTED<br># else /* __declspec */<br>#  undef __DECLSPEC_SUPPORTED<br>#  undef __MINGW_IMPORT<br>#  ifndef _CRTIMP<br>#   define _CRTIMP<br>#  endif<br># endif /* __declspec */<br><br>and if __MINGW_IMPORT is not defined, there is problems latter in the compilation (in time.h for exemple).<br>So when you have __GNUC__ defined, you have to have __declspec defined, else it does not work. Anyway putting a define __declspec allowed me to parse this, even if it is a big hack)<br>(in fact if __MSVCRT__ can be undefined, __MINGW_IMPORT should not be used...)<br></div></blockquote><div><br></div><div>Okay, so we need to be defining __declspec on mingw targets. That involves creating a new target for MinGW32/64 (in lib/Basic/Targets.cpp) that adds these defines into its getTargetDefines() function. The actual spelling of the predefined __declspec (and any other mingw-specific macros) will be shown in the output of</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>touch foo.cpp</div><div><span class="Apple-tab-span" style="white-space:pre">        g++ -dM -E foo.cpp</span></div><div><br></div></div><div><blockquote type="cite"><div><blockquote type="cite"><font class="Apple-style-span" color="#000000"><br></font></blockquote><blockquote type="cite"><blockquote type="cite">now, the instanciation of the vector assert:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Assertion failed: false && "Unable to find declaration for the current instantiation", file ..\..\..\..\..\tools\clang\lib\Sema\SemaTemplateInstantiateDecl.cpp, line 1411<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">FWIW, this is coming from an attempt to instantiate a default argument expression in a template (that refers to a typedef), e.g.,<br></blockquote><br>I see, thanks for the explanation. I must say I am eager to have good c++ semantic analyse working to be able to use clang for static analysis and inteligent refactoring, but I know the task is daunting so I am waiting. </div></blockquote><br></div><div>We're inching closer :)</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">   </span>- Doug</div></body></html>