summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-06-20 15:00:58 +0000
committerDouglas Gregor <dgregor@apple.com>2011-06-20 15:00:58 +0000
commit10c1d268eab94a2086c1368839a2f71a23bec9f3 (patch)
tree9992c04e34f2de8e297aeb30ec93f410da68e60d /clang/lib/Frontend/InitPreprocessor.cpp
parent29ed2e3bdcec316b40e0f5b76454ad8969548176 (diff)
downloadbcm5719-llvm-10c1d268eab94a2086c1368839a2f71a23bec9f3.tar.gz
bcm5719-llvm-10c1d268eab94a2086c1368839a2f71a23bec9f3.zip
Define __cplusplus to 201103L when in (non-GNU) C++0x mode.
llvm-svn: 133437
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index e1c394ea754..aefd1ea5b88 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -359,11 +359,18 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
} else {
if (LangOpts.GNUMode)
Builder.defineMacro("__cplusplus");
- else
- // C++ [cpp.predefined]p1:
+ else {
+ // C++0x [cpp.predefined]p1:
+ // The name_ _cplusplus is defined to the value 201103L when compiling a
+ // C++ translation unit.
+ if (LangOpts.CPlusPlus0x)
+ Builder.defineMacro("__cplusplus", "201103L");
+ // C++03 [cpp.predefined]p1:
// The name_ _cplusplus is defined to the value 199711L when compiling a
// C++ translation unit.
- Builder.defineMacro("__cplusplus", "199711L");
+ else
+ Builder.defineMacro("__cplusplus", "199711L");
+ }
}
if (LangOpts.ObjC1)
OpenPOWER on IntegriCloud