summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor
Commit message (Collapse)AuthorAgeFilesLines
* [preprocessing record] Have the MacroDefinitions map point to the ↵Argyrios Kyrtzidis2013-02-221-0/+6
| | | | | | | | | | MacroDefinition object instead its index in the preprocessed entities vector. This is because the order of the entities in the vector can change in some (uncommon) cases. llvm-svn: 175907
* Preproceessor: fix #if skipping under -traditional-cpp.Jordan Rose2013-02-221-0/+16
| | | | | | | | | | | | When parsing directives within skipped #if blocks, we don't want to retain any whitespace. Previously we were just skipping comments, but it's not possible to skip comments and retain other whitespace. This change matches the usual behavior for parsing directives (i.e. the behavior outside of skipped #if blocks). <rdar://problem/13267695> llvm-svn: 175840
* Preprocessor: preserve whitespace in -traditional-cpp mode.Jordan Rose2013-02-211-2/+54
| | | | | | | | | Note that unlike GNU cpp we currently do not preserve whitespace in macros (even in -traditional-cpp mode). <rdar://problem/12897179> llvm-svn: 175778
* FileCheck'ize testsDmitri Gribenko2013-02-094-9/+16
| | | | llvm-svn: 174815
* FileCheck'ize a testDmitri Gribenko2013-02-091-1/+2
| | | | llvm-svn: 174814
* Properly validate UCNs for C99 and C++03 (both more restrictive than C(++)11).Jordan Rose2013-02-092-0/+146
| | | | | | | | Add warnings under -Wc++11-compat, -Wc++98-compat, and -Wc99-compat when a particular UCN is incompatible with a different standard, and -Wunicode when a UCN refers to a surrogate character in C++03. llvm-svn: 174788
* Simplify logic for avoiding concatenation after numeric constants.Jordan Rose2013-02-081-1/+9
| | | | | | | I threw in a couple of test cases for UD-suffixes -- already working, but it wasn't immediately obvious to me. llvm-svn: 174767
* Add some missing PPC cpusBill Schmidt2013-02-011-0/+145
| | | | llvm-svn: 174215
* Add PPC A2Q core and BG/Q preprocessor definitionsHal Finkel2013-02-011-0/+15
| | | | | | The a2q core is the variant of the a2 core used on the BG/Q supercomputers. llvm-svn: 174151
* Add support for AArch64 target.Tim Northover2013-01-311-0/+30
| | | | | | | | | | | | | In cooperation with the LLVM patch, this should implement all scalar front-end parts of the C and C++ ABIs for AArch64. This patch excludes the NEON support also reviewed due to an outbreak of batshit insanity in our legal department. That will be committed soon bringing the changes to precisely what has been approved. Further reviews would be gratefully received. llvm-svn: 174055
* Reinstate r173952, this time limiting it to exactly the formDouglas Gregor2013-01-301-1/+5
| | | | | | | | #define X X for which there is no point warning, ever. llvm-svn: 173991
* Revert "[preprocessor] Don't warn about "disabled expansion of recursive macro""Argyrios Kyrtzidis2013-01-301-1/+1
| | | | | | This reverts commit r173952 llvm-svn: 173970
* [preprocessor] Don't warn about "disabled expansion of recursive macro"Argyrios Kyrtzidis2013-01-301-1/+1
| | | | | | | | | for "#define X X". This is a pattern that, for example, stdbool.h uses. rdar://12435773 llvm-svn: 173952
* [Preprocessor] When checking if we can concatenate two tokens, checkArgyrios Kyrtzidis2013-01-291-0/+6
| | | | | | | | | | | | if they were already concatenated in source using the spelling locations even if they came from a macro expansion. This fixes an issue where a GUID passed as macro argument ends up malformed after preprocessing because we added spaces inside it. rdar://13016645 llvm-svn: 173826
* FileCheck'ize testsDmitri Gribenko2013-01-282-5/+5
| | | | llvm-svn: 173720
* FileCheck'ize a testDmitri Gribenko2013-01-281-2/+4
| | | | llvm-svn: 173717
* Migrate a test to -verifyDmitri Gribenko2013-01-281-8/+3
| | | | llvm-svn: 173716
* FileCheck'ize and merge testsDmitri Gribenko2013-01-282-7/+11
| | | | llvm-svn: 173697
* Fix the indentation of the first line of preprocessor outputHal Finkel2013-01-281-0/+7
| | | | | | | | | | The -E output from clang did not produce the correct indentation on the first line. This is because MoveToLine returned false, and when this happens, the regular process for producing initial indentation is skipped. Thanks to Eli for suggesting a way to simplify this to a one-line change. llvm-svn: 173657
* Migrate tests to -verifyDmitri Gribenko2013-01-261-1/+2
| | | | llvm-svn: 173582
* clang/test/Preprocessor/iwithprefix.c: Tweak default includes not to use ↵NAKAMURA Takumi2013-01-251-1/+1
| | | | | | | | | | /usr/include. You may see such a message on non-posix system; ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/include" llvm-svn: 173525
* FileCheck'ize testsDmitri Gribenko2013-01-252-6/+11
| | | | llvm-svn: 173484
* Migrate tests to -verify and merge themDmitri Gribenko2013-01-252-7/+8
| | | | llvm-svn: 173482
* [tests] Force a triple to ensure /usr/include is one of the entries.Daniel Dunbar2013-01-251-1/+2
| | | | llvm-svn: 173469
* [tests] Add a test for -iwithprefix.Daniel Dunbar2013-01-251-0/+16
| | | | | | | - This just scratches the surface, We have pretty horrible test coverage in this area it seems like, but this at least covers the change in r173410. llvm-svn: 173464
* Test fix-it ranges for Unicode characters.Jordan Rose2013-01-241-1/+1
| | | | | | Also, remove stray -fdiagnostics-parseable-fixits from ucn-pp-identifier. llvm-svn: 173373
* Add a fixit for \U1234 -> \u1234.Jordan Rose2013-01-241-0/+9
| | | | llvm-svn: 173371
* Handle universal character names and Unicode characters outside of literals.Jordan Rose2013-01-241-0/+97
| | | | | | | | | | | | | | | | | | | | | | | | This is a missing piece for C99 conformance. This patch handles UCNs by adding a '\\' case to LexTokenInternal and LexIdentifier -- if we see a backslash, we tentatively try to read in a UCN. If the UCN is not syntactically well-formed, we fall back to the old treatment: a backslash followed by an identifier beginning with 'u' (or 'U'). Because the spelling of an identifier with UCNs still has the UCN in it, we need to convert that to UTF-8 in Preprocessor::LookUpIdentifierInfo. Of course, valid code that does *not* use UCNs will see only a very minimal performance hit (checks after each identifier for non-ASCII characters, checks when converting raw_identifiers to identifiers that they do not contain UCNs, and checks when getting the spelling of an identifier that it does not contain a UCN). This patch also adds basic support for actual UTF-8 in the source. This is treated almost exactly the same as UCNs except that we consider stray Unicode characters to be mistakes and offer a fixit to remove them. llvm-svn: 173369
* Don't check lines beginning with '#', since they could contain a path with ↵Bill Wendling2013-01-231-1/+1
| | | | | | the unexpected word in them. llvm-svn: 173307
* Add some semantic checks for OpenCL. Variadic macros, VLAs and bitfields are ↵Joey Gouly2013-01-171-0/+3
| | | | | | not supported. llvm-svn: 172732
* Suppress all -Wunused-value warnings from macro body expansions.Matt Beaumont-Gay2013-01-171-2/+3
| | | | | | | | | | | | | | | | | | | This is inspired by a number of false positives in real code, including PR14968. I've added test cases reduced from these false positives to test/Sema/unused-expr.c, as well as corresponding test cases that pass the offending expressions as arguments to a no-op macro to ensure that we do warn there. This also removes my previous tweak from r166522/r166534, so that we warn on unused cast expressions in macro arguments. There were several test cases that were using -Wunused-value to test general diagnostic emission features; I changed those to use other warnings or warn on a macro argument expression. I stared at the test case for PR14399 for a while with Richard Smith and we believe the new test case exercises the same codepaths as before. llvm-svn: 172696
* No longer crashing with an assert when __has_include or __has_include_next ↵Aaron Ballman2013-01-161-1/+23
| | | | | | is used outside of a preprocessor directive. This fixes PR14837. llvm-svn: 172639
* [PreprocessingRecord] A macro expansion can be reported out-of-order in ↵Argyrios Kyrtzidis2013-01-091-0/+5
| | | | | | | | | | | | cases when there are macro expansions inside macro arguments where the arguments are not expanded in the same order as listed; don't assert that all macro expansions are in source order. rdar://12397063 llvm-svn: 172018
* Make sure clang puts tokens from different files on separate lines in "-E ↵Eli Friedman2013-01-092-0/+7
| | | | | | | | -P" mode. <rdar://problem/12774044> llvm-svn: 171944
* Make __has_include a bit more resilient in the presence of macros. ↵Eli Friedman2013-01-091-0/+27
| | | | | | <rdar://problem/12748859>. llvm-svn: 171939
* s/CXX0X/CXX11/g, except for __GNU_EXPERIMENTAL_CXX0X__, and update a few ↵Richard Smith2013-01-021-8/+8
| | | | | | nearby 'C++0x' comments. llvm-svn: 171372
* [preprocessor] When "merging" macro argument tokens into one SLocEntry chunk,Argyrios Kyrtzidis2012-12-192-0/+14
| | | | | | | | make sure they came from the same kind of FileIDs. Thanks to Abramo Bagnara for providing the test case. llvm-svn: 170616
* [preprocessor] For errors at a function macro invocation, also includeArgyrios Kyrtzidis2012-12-141-3/+3
| | | | | | a note about where the macro is defined. llvm-svn: 170228
* Don't warn about disabled macro expansion if we see the name of a ↵Richard Smith2012-12-121-0/+4
| | | | | | function-like macro which isn't immediately followed by '('. FreeBSD's stdio.h #defines foo(x) to (foo)(x), apparently. llvm-svn: 169960
* Disable clang/test/Preprocessor/macro-multiline.c for now, while ↵NAKAMURA Takumi2012-12-061-0/+0
| | | | | | investigating lit.ShUtil.parser. llvm-svn: 169458
* Prevent premature macro expansion in __has_builtin, __has_feature,Andy Gibbs2012-11-171-0/+20
| | | | | | | __has_attribute, __has_extension, making them behave more akin to conventional macros. llvm-svn: 168268
* Made the "expected string literal" diagnostic more expressiveAndy Gibbs2012-11-173-3/+3
| | | | llvm-svn: 168267
* Refactored duplicate string literal lexing code within Preprocessor, into aAndy Gibbs2012-11-175-5/+28
| | | | | | | | | | | | | common LexStringLiteral function. In doing so, some consistency problems have been ironed out (e.g. where the first token in the string literal was lexed with macro expansion, but subsequent ones were not) and also an erroneous diagnostic has been corrected. LexStringLiteral is complemented by a FinishLexStringLiteral function which can be used in the situation where the first token of the string literal has already been lexed. llvm-svn: 168266
* Fix handling of invalid uses of the __has_warning builtin macroAndy Gibbs2012-11-173-1/+13
| | | | llvm-svn: 168265
* Add missing features for misc x86 CPUs to CPU feature translation. Patch by ↵Eli Friedman2012-11-171-1/+160
| | | | | | Jung-uk Kim. llvm-svn: 168239
* CPP Output: Do not emit an enter file marker for the main file.Daniel Dunbar2012-11-161-0/+4
| | | | | | | | - This diverges from gcc, and confuses tools (like dtrace) which track # line markers as a way to determine which content is in the context of the main file. llvm-svn: 168128
* Suppress elided variadic macro argument extension diagnostic for macros usingEli Friedman2012-11-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | the related comma pasting extension. In certain cases, we used to get two diagnostics for what is essentially one extension. This change suppresses the first diagnostic in certain cases where we know we're going to print the second diagnostic. The diagnostic is redundant, and it can't be suppressed in the definition of the macro because it points at the use of the macro, so we want to avoid printing it if possible. The implementation works by detecting constructs which look like comma pasting at the time of the definition of the macro; this information is then used when the macro is used. (We can't actually detect whether we're using the comma pasting extension until the macro is actually used, but we can detecting constructs which will be comma pasting if the varargs argument is elided.) <rdar://problem/12292192> llvm-svn: 167907
* Add clang support of RTM from TSXMichael Liao2012-11-101-0/+2
| | | | | | | | | | | | - New options '-mrtm'/'-mno-rtm' are added to enable/disable RTM feature - Builtin macro '__RTM__' is defined if RTM feature is enabled - RTM intrinsic header is added and introduces 3 new intrinsics, namely '_xbegin', '_xend', and '_xabort'. - 3 new builtins are added to keep compatible with gcc, namely '__builtin_ia32_xbegin', '__builtin_ia32_xend', and '__builtin_ia32_xabort'. - Test cases for pre-defined macro and new intrinsic codegen are added. llvm-svn: 167665
* Make __LDBL_MAX__ etc. have the correct type on targets where long ↵Eli Friedman2012-11-101-44/+44
| | | | | | | | double/double/etc. have the same format. PR14285. Based on patch by Jeroen Dobbelaere. llvm-svn: 167649
* Improved support for removing the comma preceding __VA_ARGS__ where __VA_ARGS__Andy Gibbs2012-11-091-0/+64
| | | | | | | | | | is empty in a variadic macro expansion. This fixes a divergence in support for the ", ## __VA_ARGS__" GCC extension which differed in behaviour when in strict C99 mode (note: there is no change in behaviour has been made in the gnu99 mode that clang uses by default). In addition, there is improved support for the Microsoft alternative extension ", __VA_ARGS__". llvm-svn: 167613
OpenPOWER on IntegriCloud