From: Francois Pichet Date: Sat, 7 May 2011 17:47:38 +0000 (+0000) Subject: Temporary preprocessor hack to get around the Microsoft __identifier(x) extension. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a23ae3f45789f40cdfd939117284f977d2dc17a6;p=clang Temporary preprocessor hack to get around the Microsoft __identifier(x) extension. http://msdn.microsoft.com/en-us/library/hzc8ytsz(v=VS.100).aspx Microsoft doc claims this is a C++/CLI feature but it is really always enabled. This removes 2 error when parsing MFC code with clang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131051 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index abe251d67d..5d31b03a45 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -343,6 +343,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI, // Since we define wchar_t in C++ mode. Builder.defineMacro("_WCHAR_T_DEFINED"); Builder.defineMacro("_NATIVE_WCHAR_T_DEFINED"); + Builder.append("#define __identifier(x) x"); Builder.append("class type_info;"); } diff --git a/test/Parser/MicrosoftExtensions.cpp b/test/Parser/MicrosoftExtensions.cpp index 292d3e1239..89b53e4912 100644 --- a/test/Parser/MicrosoftExtensions.cpp +++ b/test/Parser/MicrosoftExtensions.cpp @@ -207,3 +207,6 @@ __if_not_exists(IF_EXISTS::Type) { __if_not_exists(IF_EXISTS::Type_not) { int var244; } + +int __identifier(generic) = 3; +