summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
...
* Preprocessor: recover gracefully when C++ operator names are used as macro ↵Alp Toker2014-05-311-3/+4
| | | | | | | | | | identifiers This failure mode shows up occasionally when users try to include C headers in C++ projects or when porting from Windows. We might as well recover in the way the user expected, thus avoiding confusing diagnostic messages at point of use. llvm-svn: 209963
* Preprocessor: don't exit early in CheckMacroName()Alp Toker2014-05-311-10/+7
| | | | | | | | | | The checks below can hypothetically apply to converted operator name identifiers. In practice there are no builtin macros etc. with those names so there's no behavioural change to test. llvm-svn: 209962
* Permit the "if" literal suffix with Microsoft extensions enabled.Peter Collingbourne2014-05-291-2/+7
| | | | | | Differential Revision: http://reviews.llvm.org/D3963 llvm-svn: 209859
* Remove limits on the number of fix-it hints and ranges in the DiagnosticsEngine.Alexander Kornienko2014-05-222-18/+6
| | | | | | | | | | | | | | | | | | | Summary: The limits on the number of fix-it hints and ranges attached to a diagnostic are arbitrary and don't apply universally to all users of the DiagnosticsEngine. The way the limits are enforced may lead to diagnostics generating invalid sets of fixes. I suggest removing the limits, which will also simplify the implementation. Reviewers: rsmith Reviewed By: rsmith Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D3879 llvm-svn: 209468
* Provide an aka for the C++ operator name macro diagnosticAlp Toker2014-05-211-1/+1
| | | | llvm-svn: 209322
* Preprocessor: support defined() with operator names for MS compatibilityAlp Toker2014-05-212-45/+51
| | | | | | | | | Also flesh out missing tests, improve diagnostic QOI and fix a couple of corner cases found in the process. Fixes PR10606. llvm-svn: 209276
* Remove historical Unicode TODOsAlp Toker2014-05-181-16/+3
| | | | | | There's no immediate demand or plan to work on these. llvm-svn: 209090
* [C++11] Use 'nullptr'. Lex edition.Craig Topper2014-05-1717-227/+239
| | | | llvm-svn: 209083
* Provide and use a safe Token::getRawIdentifier() accessorAlp Toker2014-05-174-14/+14
| | | | llvm-svn: 209061
* Rename SourceManager::createFileIDForMemBuffer()Alp Toker2014-05-162-2/+2
| | | | | | | | It makes more sense to just overload createFileID(). Gardening only. llvm-svn: 209002
* Use the virtual name of headers when searching for a moduleBen Langmuir2014-05-151-6/+6
| | | | | | | | | | When using the VFS, we want the virtual header location when searching for a framework module, since that will be the one in the correct directory structure for the module. I'll add a regression test once I finish reducing the larger one I have. llvm-svn: 208901
* PR19698, PR19674: enable __has_feature checks for cxx_generic_lambdas andRichard Smith2014-05-091-3/+8
| | | | | | | cxx_decltype_auto, and fix documentation of cxx_generic_lambdas and cxx_init_captures to specify the right feature-check name. llvm-svn: 208445
* Don't leak MacroArgs when using code completion, PR19688.Nico Weber2014-05-091-1/+4
| | | | | | | | | | | | | | | | | | | | | | | MacroArgs are owned by TokenLexer, and when a TokenLexer is destroyed, it'll call its MacroArgs's destroy() method. destroy() only appends the MacroArg to Preprocessor's MacroArgCache list, and Preprocessor's destructor then calls deallocate() on all MacroArgs in that list. This method then ends up freeing the MacroArgs's memory. In a code completion context, Parser::cutOffParsing() gets called when a code completion token is hit, which changes the type of the current token to tok::eof. eof tokens aren't always ConsumeToken()ed, so Preprocessor::HandleEndOfFile() isn't always called, and that function is responsible for popping the macro stack. Due to this, Preprocessor::CurTokenLexer can be non-NULL when ~Preprocessor runs. It's a unique_ptr, so it ended up being destructed after ~Preprocessor completed, and its MacroArgs thus got added to the freelist after the code freeing things on the freelist had already completed. The fix is to explicitly call reset() before the freelist processing happens. (See the bug for more notes.) llvm-svn: 208438
* Wrap to 80 columns, no code change.Nico Weber2014-05-091-4/+3
| | | | llvm-svn: 208386
* Fix filename in file header comment more.Nico Weber2014-05-091-1/+1
| | | | llvm-svn: 208381
* Fix filename in file header comment.Nico Weber2014-05-091-1/+1
| | | | llvm-svn: 208380
* Remove -Wnon-modular-includeBen Langmuir2014-05-081-2/+0
| | | | | | | | | | But keep -Wnon-modular-include-in-[framework-]module This warning is too noisy and doesn't really indicate a problem for most people. Even though it would only really affect people using -Weverything, that seems bad so remove it. llvm-svn: 208345
* Add -Wnon-modular-include* optionsBen Langmuir2014-05-052-38/+64
| | | | | | | | | | | | Warn on non-modular includes in various contexts. -Wnon-modular-include -Wnon-modular-include-in-module -Wnon-modular-include-in-framework-module Where each group is a subgroup of those above it. llvm-svn: 208004
* [leaks] Fix a leak recently introduced to the pragma handling. ThisChandler Carruth2014-05-021-0/+1
| | | | | | | | | whole code would be better with std::unique_ptr managing the lifetimes of the handlers, but I wanted to make a targeted fix to the leaks first. With this change, all of the Clang preprocessor tests are leak free with LSan. llvm-svn: 207872
* Reformat code following Preprocessor constructor updatesAlp Toker2014-05-021-6/+5
| | | | | | Landing this separately to make the previous commits easy to follow at home. llvm-svn: 207826
* Factor TargetInfo pointer/DelayInitialization bool pair out of Preprocessor ctorAlp Toker2014-05-021-8/+3
| | | | | | | | The Preprocessor::Initialize() function already offers a clear interface to achieve this, further reducing the confusing number of states a newly constructed preprocessor can have. llvm-svn: 207825
* Remove unused IncrProcessing parameter from Preprocessor ctorAlp Toker2014-05-021-3/+2
| | | | | | | Preprocessor::enableIncrementalProcessing() provides a consistent interface to enable the feature. llvm-svn: 207824
* do not warn about unknown pragmas in modes that do not handle them (pr9537)Lubos Lunak2014-05-011-0/+22
| | | | | | | And refactor to have just one place in code that sets up the empty pragma handlers. llvm-svn: 207758
* Do not print inferred submodules explicitly in __inferred_module.mapBen Langmuir2014-04-231-0/+2
| | | | | | | | | | | | | | Otherwise including a header in your source file that is not included by framework's umbrella header will silently add an empty submodule with that name. is automatically translated to @import Foo.NotInModule; which then would have succeeded because the inferred module map contained an empty submodule called NotInModule. llvm-svn: 207024
* Add some missing checks for C++1y digit separators that don't in fact separateRichard Smith2014-04-221-0/+6
| | | | | | | | digits. Turns out we have completely separate lexing codepaths for floating point numbers depending on whether or not they start with a zero. Who knew... =) llvm-svn: 206932
* Allow submodule inferrences with a missing umbrella when the module is ↵Ben Langmuir2014-04-211-1/+2
| | | | | | | | | unavailable If the module is unavailable because of a missing header, don't diagnose a "module * {}" declaration for having a missing umbrella. llvm-svn: 206776
* Don't build modules with (submodules with) missing headersBen Langmuir2014-04-181-2/+10
| | | | | | | | Unless they are in submodules that aren't available anyway, due to requirements not being met. Also, mark children as unavailable when the parent is. llvm-svn: 206664
* Teach users of OnDiskHashTable to define hash_value and offset typesJustin Bogner2014-04-181-8/+8
| | | | | | | | This paves the way to making OnDiskHashTable work with hashes that are not 32 bits wide and to making OnDiskHashTable work very large hash tables. The LLVM change to use these types is upcoming. llvm-svn: 206640
* Remove OnDiskHashTable.h, since it's been moved to llvmJustin Bogner2014-04-181-5/+4
| | | | llvm-svn: 206637
* Add more constness to module-related APIsDmitri Gribenko2014-04-181-2/+3
| | | | llvm-svn: 206595
* Lex: Fix __has_feature(cxx_exceptions) for objective C++Justin Bogner2014-04-161-1/+1
| | | | | | | | | | | | | | | At one point, -fexceptions was a synonym for -fcxx-exceptions. While the driver options still enables cxx-exceptions by default, the cc1 flag is purely about exception tables and this doesn't account for objective C exceptions. Because of this, checking for the cxx_exceptions feature in objective C++ often gives the wrong answer. The cxx_exceptions feature should be based on the -fcxx-exceptions cc1 flag, not -fexceptions. Furthermore, at some point the tests were changed to use cc1 even though they were testing the driver behaviour. We're better off testing both the driver and cc1 here. llvm-svn: 206352
* Fixed problem with exclude header. The exclude header argument needs to be ↵John Thompson2014-04-161-22/+0
| | | | | | relative to the module.map file. llvm-svn: 206342
* Allow multiple modules with the same name to coexist in the module cacheBen Langmuir2014-04-142-27/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To differentiate between two modules with the same name, we will consider the path the module map file that they are defined by* part of the ‘key’ for looking up the precompiled module (pcm file). Specifically, this patch renames the precompiled module (pcm) files from cache-path/<module hash>/Foo.pcm to cache-path/<module hash>/Foo-<hash of module map path>.pcm In addition, I’ve taught the ASTReader to re-resolve the names of imported modules during module loading so that if the header search context changes between when a module was originally built and when it is loaded we can rebuild it if necessary. For example, if module A imports module B first time: clang -I /path/to/A -I /path/to/B ... second time: clang -I /path/to/A -I /different/path/to/B ... will now rebuild A as expected. * in the case of inferred modules, we use the module map file that allowed the inference, not the __inferred_module.map file, since the inferred file path is the same for every inferred module. llvm-svn: 206201
* Add a test to distinguish between reserved tokens and normal identifiers.Yunzhong Gao2014-04-111-0/+4
| | | | | | | | | | | | The -fms-extensions option affects a number of subtle front-end C/C++ behaviors, and it would be useful to be able to distinguish MS keywords from regular identifiers in the ms-extensions mode even if the triple does not define a Windows target. It should make life easier if anyone needs to port their Windows codes to elsewhere. Differential Revision: http://reviews.llvm.org/D3034 llvm-svn: 206069
* Add -fmodules-strict-decluse to check that all headers are in modulesDaniel Jasper2014-04-111-1/+5
| | | | | Review: http://reviews.llvm.org/D3335 llvm-svn: 206027
* Move search for header in umbrella directories into its own functionBen Langmuir2014-04-101-75/+83
| | | | | | No functional change intended. llvm-svn: 205942
* [Preprocessor/CodeComplete] Don't add include guard macros to ↵Argyrios Kyrtzidis2014-04-092-1/+6
| | | | | | code-completion results. llvm-svn: 205917
* If a header is explicitly included in module A, and excluded from an umbrellaRichard Smith2014-04-081-6/+17
| | | | | | directory in module B, don't include it in module B! llvm-svn: 205762
* Revert r205436:Roman Divacky2014-04-031-28/+5
| | | | | | | | | | | | | | | | Extend the SSE2 comment lexing to AVX2. Only 16byte align when not on AVX2. This provides some 3% speedup when preprocessing gcc.c as a single file. The patch is wrong, it always uses SSE2, and when I fix that there's no speedup at all. I am not sure where the 3% came from previously. --Thi lie, and those below, will be ignored-- M Lex/Lexer.cpp llvm-svn: 205548
* Extend the SSE2 comment lexing to AVX2. Only 16byte align when not on AVX2.Roman Divacky2014-04-021-5/+28
| | | | | | This provides some 3% speedup when preprocessing gcc.c as a single file. llvm-svn: 205436
* Post-commit review coding style change: renaming HasAttribute to ↵Aaron Ballman2014-03-311-1/+1
| | | | | | hasAttribute. No functional changes. llvm-svn: 205201
* Reapplying r204952 a second time.Aaron Ballman2014-03-311-15/+3
| | | | | | | | | | Clean up the __has_attribute implementation without modifying its behavior. Replaces the tablegen-driven AttrSpellings.inc, which lived in the lexing layer with AttrHasAttributeImpl.inc, which lives in the basic layer. Updates the preprocessor to call through to this new functionality which can take additional information into account (such as scopes and syntaxes). Expose the ability for parts of the compiler to ask whether an attribute is supported for a given spelling (including scope), syntax, triple and language options. llvm-svn: 205181
* [HeaderSearch] Make sure we clear the mapped name from the ↵Argyrios Kyrtzidis2014-03-291-1/+1
| | | | | | | | LookupFileCacheInfo when we reset the start point. rdar://16462455 llvm-svn: 205071
* Reapply "OnDiskHashTable: Use Endian.h to read little endian ostreams"Justin Bogner2014-03-281-29/+57
| | | | | | | | | | | | | Committed this by accident before it was done last time. Original message: Rather than rolling our own functions to read little endian data from a buffer, we can use the support in llvm's Endian.h. No functional change. llvm-svn: 205062
* Reapply "OnDiskHashTable: Use EndianStream.h to write little endian ostreams"Justin Bogner2014-03-281-0/+1
| | | | | | | | | | | | | Committed this by accident before it was done last time. Original message: Rather than rolling our own functions to write little endian data to an ostream, we can use the support in llvm's EndianStream.h. No functional change. llvm-svn: 205061
* Revert "OnDiskHashTable: Use Endian.h to read little endian ostreams"Justin Bogner2014-03-281-57/+29
| | | | | | This reverts commit r205045. llvm-svn: 205048
* Revert "OnDiskHashTable: Use EndianStream.h to write little endian ostreams"Justin Bogner2014-03-281-1/+0
| | | | | | This reverts commit r205044. llvm-svn: 205047
* OnDiskHashTable: Use Endian.h to read little endian ostreamsJustin Bogner2014-03-281-29/+57
| | | | | | | | | Rather than rolling our own functions to read little endian data from a buffer, we can use the support in llvm's Endian.h. No functional change. llvm-svn: 205045
* OnDiskHashTable: Use EndianStream.h to write little endian ostreamsJustin Bogner2014-03-281-0/+1
| | | | | | | | | Rather than rolling our own functions to write little endian data to an ostream, we can use the support in llvm's EndianStream.h. No functional change. llvm-svn: 205044
* Reverting r204968 and r204969; while more build bots are happy with the ↵Aaron Ballman2014-03-271-3/+15
| | | | | | results, some still have link errors. llvm-svn: 204974
OpenPOWER on IntegriCloud