summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-01-14 06:19:35 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-01-14 06:19:35 +0000
commit1de36917d304f40af314fa0c6048eb0fd7c2740e (patch)
tree43d03600f8afad333f0c6f0fdc989d6c4c7284ad
parent899b4f3624e1a5b82d8a57b3fe654bab36eaae3a (diff)
downloadbcm5719-llvm-1de36917d304f40af314fa0c6048eb0fd7c2740e.tar.gz
bcm5719-llvm-1de36917d304f40af314fa0c6048eb0fd7c2740e.zip
Sema: Predefine size_t in MSVC Compatibility mode
MSVC defines size_t without any explicit declarations. This change allows us to be compatible with TUs that depend on this declaration appearing from nowhere. llvm-svn: 199190
-rw-r--r--clang/lib/Sema/Sema.cpp2
-rw-r--r--clang/test/SemaCXX/MicrosoftCompatibility.cpp1
2 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index c824921a4f1..a6d3e322d0f 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -182,6 +182,8 @@ void Sema::Initialize() {
if (IdResolver.begin(&Context.Idents.get("type_info")) == IdResolver.end())
PushOnScopeChains(Context.buildImplicitRecord("type_info", TTK_Class),
TUScope);
+
+ addImplicitTypedef("size_t", Context.getSizeType());
}
// Initialize predefined OpenCL types.
diff --git a/clang/test/SemaCXX/MicrosoftCompatibility.cpp b/clang/test/SemaCXX/MicrosoftCompatibility.cpp
index a914169bb68..1f27deb0ee1 100644
--- a/clang/test/SemaCXX/MicrosoftCompatibility.cpp
+++ b/clang/test/SemaCXX/MicrosoftCompatibility.cpp
@@ -24,6 +24,7 @@ void test()
namespace ms_predefined_types {
// ::type_info is a built-in forward class declaration.
void f(const type_info &a);
+ void f(size_t);
}
OpenPOWER on IntegriCloud