summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
...
* Simplify MacroInfo lifetime management. We don't need three different functionsRichard Smith2014-07-242-8/+13
| | | | | | to destroy one of these. llvm-svn: 213837
* Remove unused Prev pointer from MacroInfo chain.Richard Smith2014-07-242-31/+4
| | | | | | | | Remove pointless MICache: it only ever contained up to 1 object, and was only non-empty when recovering from an error. There's no performance or memory win from maintaining this cache. llvm-svn: 213825
* Add stopgap option -fmodule-implementation-of <name>Ben Langmuir2014-07-231-1/+3
| | | | | | | | | | | | | | | | | | This flag specifies that we are building an implementation file of the module <name>, preventing importing <name> as a module. This does not consider this to be the 'current module' for the purposes of doing modular checks like decluse or non-modular-include warnings, unlike -fmodule-name. This is needed as a stopgap until: 1) we can resolve relative includes to a VFS-mapped module (or can safely import a header textually and as part of a module) and ideally 2) we can safely do incremental rebuilding when implementation files import submodules. llvm-svn: 213767
* Provide extra information in the "integer constant is too large" diagnostic. ↵Aaron Ballman2014-07-221-2/+5
| | | | | | This will be used to improve other diagnostics. llvm-svn: 213657
* Reinstate r213348, reverted in r213395, with an additional bug fix and moreRichard Smith2014-07-181-0/+1
| | | | | | | | | | | | | | | | | | | | thorough tests. Original commit message: [modules] Fix macro hiding bug exposed if: * A submodule of module A is imported into module B * Another submodule of module A that is not imported into B exports a macro * Some submodule of module B also exports a definition of the macro, and happens to be the first submodule of B that imports module A. In this case, we would incorrectly determine that A's macro redefines B's macro, and so we don't need to re-export B's macro at all. This happens with the 'assert' macro in an LLVM self-host. =( llvm-svn: 213416
* Add dump() for MacroDirective and MacroInfo.Richard Smith2014-07-181-0/+72
| | | | llvm-svn: 213349
* Fix case-sensitivity of inferred framework modulesBen Langmuir2014-07-141-0/+6
| | | | | | | Just because we can open a directory named "COcoa.framework" doesn't mean we should provide a "COcoa" module on a case-insensitive filesystem. llvm-svn: 212975
* Improve memory ownership of vfs::Files in the FileSystemStatCache by using ↵David Blaikie2014-07-081-3/+2
| | | | | | | | | std::unique_ptr Spotted after a memory leak (due to the complexities of manual memory management) was fixed in 212466. llvm-svn: 212541
* PTH: use a variable instead of a macroAlp Toker2014-07-071-8/+10
| | | | | | Cleanup only. llvm-svn: 212457
* Update for llvm api change.Rafael Espindola2014-07-061-2/+4
| | | | llvm-svn: 212408
* Removed unused typedef for recursive_directory_iteratorBen Langmuir2014-06-301-2/+0
| | | | llvm-svn: 212047
* Convert StringLiteralParser constructor to use ArrayRef instead of a pointer ↵Craig Topper2014-06-264-17/+17
| | | | | | and count. llvm-svn: 211763
* Make -Wincomplete-umbrella go through the VFSBen Langmuir2014-06-251-3/+5
| | | | | | | By using vfs::recursive_directory_iterator, this warning will now fire when some or all of a module's headers are from VFS mappings. llvm-svn: 211746
* DiagnosticIDs: use diagnostic severities to simplify extension handlingAlp Toker2014-06-221-2/+2
| | | | llvm-svn: 211479
* Lex: Use the correct types for MS integer suffixesDavid Majnemer2014-06-211-11/+10
| | | | | | | | | | | | | | | | Something went wrong with r211426, it is an older version of this code and should not have been committed. It was reverted with r211434. Original commit message: We didn't properly implement support for the sized integer suffixes. Suffixes like i16 were essentially ignored instead of mapping them to the appropriately sized integer type. This fixes PR20008. Differential Revision: http://reviews.llvm.org/D4132 llvm-svn: 211441
* Revert "Lex: Use the correct types for MS integer suffixes"Rafael Espindola2014-06-211-10/+11
| | | | | | | | | This reverts commit r211426. This broke the arm bots. The crash can be reproduced on X86 by running. ./bin/clang -cc1 -fsyntax-only -verify -fms-extensions ~/llvm/clang/test/Lexer/ms-extensions.c -triple arm-linux llvm-svn: 211434
* Lex: Use the correct types for MS integer suffixesDavid Majnemer2014-06-211-11/+10
| | | | | | | | | | | | We didn't properly implement support for the sized integer suffixes. Suffixes like i16 were essentially ignored instead of mapping them to the appropriately sized integer type. This fixes PR20008. Differential Revision: http://reviews.llvm.org/D4132 llvm-svn: 211426
* Fixed formatting.Yaron Keren2014-06-191-3/+2
| | | | llvm-svn: 211295
* Hide the concept of diagnostic levels from lex, parse and semaAlp Toker2014-06-154-17/+9
| | | | | | | | | | | | | | | | The compilation pipeline doesn't actually need to know about the high-level concept of diagnostic mappings, and hiding the final computed level presents several simplifications and other potential benefits. The only exceptions are opportunistic checks to see whether expensive code paths can be avoided for diagnostics that are guaranteed to be ignored at a certain SourceLocation. This commit formalizes that invariant by introducing and using DiagnosticsEngine::isIgnored() in place of individual level checks throughout lex, parse and sema. llvm-svn: 211005
* Include system_error directly.Rafael Espindola2014-06-121-1/+1
| | | | llvm-svn: 210802
* Replace llvm::error_code with std::error_code.Rafael Espindola2014-06-123-5/+5
| | | | llvm-svn: 210780
* DiagnosticsEngine: update severity setters to new terminologyAlp Toker2014-06-121-2/+2
| | | | llvm-svn: 210764
* Complete the switch from mappings to declarative diagnostic severitiesAlp Toker2014-06-121-14/+14
| | | | | | | | | This begins to address cognitive dissonance caused by treating the Note diagnostic level as a severity in the diagnostic engine. No change in functionality. llvm-svn: 210758
* Improve diagnostic mapping terminologyAlp Toker2014-06-101-1/+1
| | | | | | | | | | | | Diagnostic mappings are used to calculate the final severity of diagnostic instances. Detangle the implementation to reflect the terminology used in documentation and bindings. No change in functionality. llvm-svn: 210518
* Implement -Wdate-time preprocessor warningAlp Toker2014-06-101-1/+4
| | | | | | | This GCC warning is useful for validating reproducible builds and might help when tracking down issues with modules too. llvm-svn: 210511
* [C++11] Use 'nullptr'.Craig Topper2014-06-091-2/+2
| | | | llvm-svn: 210448
* Preprocessor: make C++ operator names as macro identifiers a compatible ↵Alp Toker2014-05-311-5/+6
| | | | | | | | | | | extension With recent changes, this is now a compatible language extension and can be safely enabled with -ms-extensions instead of requiring the full -ms-compatibility MSVC drop-in mode. As such we can now also emit an extension warning under -Wmicrosoft to help users port their code. llvm-svn: 209978
* 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
OpenPOWER on IntegriCloud