]> granicus.if.org Git - clang/commitdiff
Temporary preprocessor hack to get around the Microsoft __identifier(x) extension.
authorFrancois Pichet <pichet2000@gmail.com>
Sat, 7 May 2011 17:47:38 +0000 (17:47 +0000)
committerFrancois Pichet <pichet2000@gmail.com>
Sat, 7 May 2011 17:47:38 +0000 (17:47 +0000)
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

lib/Frontend/InitPreprocessor.cpp
test/Parser/MicrosoftExtensions.cpp

index abe251d67df20ba5197a107a54f6731a6c2785eb..5d31b03a45235c5b887576b585c502ee8969de10 100644 (file)
@@ -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;");
     }
 
index 292d3e1239dfaf810df99a632c807abf7ad5b8f0..89b53e4912ab0b95782f2bb8f862535aea509f7a 100644 (file)
@@ -207,3 +207,6 @@ __if_not_exists(IF_EXISTS::Type) {
 __if_not_exists(IF_EXISTS::Type_not) {
   int var244;
 }
+
+int __identifier(generic) = 3;
+