OLD | NEW |
1 //===--- InitPreprocessor.cpp - PP initialization code. ---------*- C++ -*-===// | 1 //===--- InitPreprocessor.cpp - PP initialization code. ---------*- C++ -*-===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements the clang::InitializePreprocessor function. | 10 // This file implements the clang::InitializePreprocessor function. |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 Builder.defineMacro("__STDC_HOSTED__"); | 295 Builder.defineMacro("__STDC_HOSTED__"); |
296 | 296 |
297 if (!LangOpts.CPlusPlus) { | 297 if (!LangOpts.CPlusPlus) { |
298 if (LangOpts.C11) | 298 if (LangOpts.C11) |
299 Builder.defineMacro("__STDC_VERSION__", "201112L"); | 299 Builder.defineMacro("__STDC_VERSION__", "201112L"); |
300 else if (LangOpts.C99) | 300 else if (LangOpts.C99) |
301 Builder.defineMacro("__STDC_VERSION__", "199901L"); | 301 Builder.defineMacro("__STDC_VERSION__", "199901L"); |
302 else if (!LangOpts.GNUMode && LangOpts.Digraphs) | 302 else if (!LangOpts.GNUMode && LangOpts.Digraphs) |
303 Builder.defineMacro("__STDC_VERSION__", "199409L"); | 303 Builder.defineMacro("__STDC_VERSION__", "199409L"); |
304 } else { | 304 } else { |
305 // FIXME: Use the right value for __cplusplus for C++1y once one is chosen. | 305 // FIXME: LangOpts.CPlusPlus1y |
306 if (LangOpts.CPlusPlus1y) | 306 |
307 Builder.defineMacro("__cplusplus", "201305L"); | |
308 // C++11 [cpp.predefined]p1: | 307 // C++11 [cpp.predefined]p1: |
309 // The name __cplusplus is defined to the value 201103L when compiling a | 308 // The name __cplusplus is defined to the value 201103L when compiling a |
310 // C++ translation unit. | 309 // C++ translation unit. |
311 else if (LangOpts.CPlusPlus11) | 310 if (LangOpts.CPlusPlus11) |
312 Builder.defineMacro("__cplusplus", "201103L"); | 311 Builder.defineMacro("__cplusplus", "201103L"); |
313 // C++03 [cpp.predefined]p1: | 312 // C++03 [cpp.predefined]p1: |
314 // The name __cplusplus is defined to the value 199711L when compiling a | 313 // The name __cplusplus is defined to the value 199711L when compiling a |
315 // C++ translation unit. | 314 // C++ translation unit. |
316 else | 315 else |
317 Builder.defineMacro("__cplusplus", "199711L"); | 316 Builder.defineMacro("__cplusplus", "199711L"); |
318 } | 317 } |
319 | 318 |
320 if (LangOpts.ObjC1) | 319 if (LangOpts.ObjC1) |
321 Builder.defineMacro("__OBJC__"); | 320 Builder.defineMacro("__OBJC__"); |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 InitOpts.PrecompiledPreambleBytes.second); | 806 InitOpts.PrecompiledPreambleBytes.second); |
808 | 807 |
809 // Copy PredefinedBuffer into the Preprocessor. | 808 // Copy PredefinedBuffer into the Preprocessor. |
810 PP.setPredefines(Predefines.str()); | 809 PP.setPredefines(Predefines.str()); |
811 | 810 |
812 // Initialize the header search object. | 811 // Initialize the header search object. |
813 ApplyHeaderSearchOptions(PP.getHeaderSearchInfo(), HSOpts, | 812 ApplyHeaderSearchOptions(PP.getHeaderSearchInfo(), HSOpts, |
814 PP.getLangOpts(), | 813 PP.getLangOpts(), |
815 PP.getTargetInfo().getTriple()); | 814 PP.getTargetInfo().getTriple()); |
816 } | 815 } |
OLD | NEW |