summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPLexerChange.cpp
Commit message (Collapse)AuthorAgeFilesLines
* PR24667: fix quadratic runtime if textually-included modular headers define ↵Richard Smith2016-02-231-22/+45
| | | | | | large numbers of macros. llvm-svn: 261705
* [modules] Do less scanning of macro definition chains when computing the set ofRichard Smith2016-02-191-5/+20
| | | | | | | exported module macros outside local submodule visibility mode. Related to PR24667. llvm-svn: 261373
* Emit a -Wmicrosoft warning when pasting /##/ into a comment token in MS mode.Nico Weber2015-12-291-1/+0
| | | | llvm-svn: 256595
* Replace SM.getFileEntryForID(Lexer->getFileID()) with Lexer->getFileEntry().Yaron Keren2015-12-181-2/+1
| | | | llvm-svn: 255993
* Remove spaces in empty line, NFC.Yaron Keren2015-11-071-1/+1
| | | | llvm-svn: 252405
* Sink some PTHManager includes out of Preprocessor.hReid Kleckner2015-11-021-0/+1
| | | | | | | This reduces the number of .cpp files needed to be rebuilt after touching OnDiskHashTable from 120 to 21 for me. llvm-svn: 251810
* Roll-back r250822.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
* [modules] Make sure macros get made visible in the top-level file if we've gotRichard Smith2015-06-301-2/+15
| | | | | | | local submodule visibility enabled; that top-level file might not actually be the module includes buffer if use of prebuilt modules is disabled. llvm-svn: 241120
* Introduced pragmas for audited nullability regions.Douglas Gregor2015-06-191-0/+11
| | | | | | | | | | | | | | | | | Introduce the clang pragmas "assume_nonnull begin" and "assume_nonnull end" in which we make default assumptions about the nullability of many unannotated pointers: - Single-level pointers are inferred to __nonnull - NSError** in a (function or method) parameter list is inferred to NSError * __nullable * __nullable. - CFErrorRef * in a (function or method) parameter list is inferred to CFErrorRef __nullable * __nullable. - Other multi-level pointers are never inferred to anything. Implements rdar://problem/19191042. llvm-svn: 240156
* Avoid using a C++11 library feature not present in libstdc++4.7.Richard Smith2015-05-211-2/+1
| | | | llvm-svn: 237872
* [modules] If we re-enter a submodule from within itself (when submoduleRichard Smith2015-05-211-47/+51
| | | | | | | | | | visibility is enabled) or leave and re-enter it, restore the macro and module visibility state from last time we were in that submodule. This allows mutually-#including header files to stand a chance at being modularized with local visibility enabled. llvm-svn: 237871
* [modules] Retain the name as written for umbrella headers and directories, ↵Richard Smith2015-05-161-1/+1
| | | | | | rather than converting to an absolute path. No observable change expected, but this allows us to correctly compute the module for an umbrella header, which later changes will require. llvm-svn: 237508
* [modules] Add local submodule visibility support for declarations.Richard Smith2015-05-151-3/+16
| | | | | | | | | | | | With this change, enabling -fmodules-local-submodule-visibility results in name visibility rules being applied to submodules of the current module in addition to imported modules (that is, names no longer "leak" between submodules of the same top-level module). This also makes it much safer to textually include a non-modular library into a module: each submodule that textually includes that library will get its own "copy" of that library, and so the library becomes visible no matter which including submodule you import. llvm-svn: 237473
* [modules] Rearrange preprocessor module visibility handling, no observable ↵Richard Smith2015-05-141-7/+10
| | | | | | change intended. llvm-svn: 237331
* [modules] Don't bother creating a ModuleMacro representing a #undef that ↵Richard Smith2015-05-021-2/+5
| | | | | | overrides nothing. llvm-svn: 236374
* [modules] If a module #includes a modular header that #undef's its macro, itRichard Smith2015-05-021-5/+4
| | | | | | | | should not export the macro. ... at least, not unless we have local submodule visibility enabled. llvm-svn: 236369
* [modules] Add -fmodules-local-submodule-visibility flag.Richard Smith2015-05-011-17/+52
| | | | | | | | | | | | | | | This flag specifies that the normal visibility rules should be used even for local submodules (submodules of the currently-being-built module). Thus names will only be visible if a header / module that declares them has actually been included / imported, and not merely because a submodule that happened to be built earlier declared those names. This also removes the need to modularize bottom-up: textually-included headers will be included into every submodule that includes them, since their include guards will not leak between modules. So far, this only governs visibility of macros, not of declarations, so is not ready for real use yet. llvm-svn: 236350
* [modules] Start moving the module visibility information off the Module itself.Richard Smith2015-05-011-7/+1
| | | | | | | It has no place there; it's not a property of the Module, and it makes restoring the visibility set when we leave a submodule more difficult. llvm-svn: 236300
* [modules] Stop trying to fake up a linear MacroDirective history.Richard Smith2015-04-291-1/+1
| | | | | | | | | | | | | | Modules builds fundamentally have a non-linear macro history. In the interest of better source fidelity, represent the macro definition information faithfully: we have a linear macro directive history within each module, and at any point we have a unique "latest" local macro directive and a collection of visible imported directives. This also removes the attendent complexity of attempting to create a correct MacroDirective history (which we got wrong in the general case). No functionality change intended. llvm-svn: 236176
* Refactor to make MacroState ownership and lifetime clearer.Richard Smith2015-04-281-1/+4
| | | | llvm-svn: 236032
* [modules] Incrementally compute the list of overridden module macros based onRichard Smith2015-04-271-7/+17
| | | | | | | the active module macros at the point of definition, rather than reconstructing it from the macro history. No functionality change intended. llvm-svn: 235941
* Remove unused variable to silence GCC warningDavid Majnemer2015-04-241-3/+2
| | | | llvm-svn: 235693
* [modules] Partial revert of r235669: don't create ModuleMacros for imported ↵Richard Smith2015-04-241-6/+0
| | | | | | | | local macros. The surrounding infrastructure isn't quite ready for this yet. llvm-svn: 235677
* [modules] Refactor creation of ModuleMacros and create them when importing ↵Richard Smith2015-04-231-4/+11
| | | | | | from local submodules. llvm-svn: 235669
* [modules] Properly attribute macros to modules if they're in a file ↵Richard Smith2015-04-231-1/+1
| | | | | | textually included into a file in the module. llvm-svn: 235661
* [modules] Determine the set of macros exported by a submodule at the end of ↵Richard Smith2015-04-231-0/+63
| | | | | | | | | | | that submodule. Previously we'd defer this determination until writing the AST, which doesn't allow us to use this information when building other submodules of the same module. This change also allows us to use a uniform mechanism for writing module macro records, independent of whether they are local or imported. llvm-svn: 235614
* Remove superceded warning warn_forgotten_module_headerBen Langmuir2014-11-051-28/+0
| | | | | | | | | | | | This DefaultIgnore warning under -Wincomplete-module was firing on any module map files that happened to be parsed (it's only supposed to fire on headers), and it has been superceded by -Wnon-modular-include-in-module anyway. For compatibility, I rewired -Wincomplete-module to imply -Wnon-modular-include-in-module. llvm-svn: 221357
* [modules] Add support for 'textual header' directives.Richard Smith2014-10-221-1/+2
| | | | | | | | This allows a module to specify that it logically contains a file, but that said file is non-modular and intended for textual inclusion. This allows layering checks to work properly in the presence of such files. llvm-svn: 220448
* PR18793: If we try to EnterTokenStream when our current lexer is a cachingRichard Smith2014-09-231-0/+19
| | | | | | | | | lexer, add the token buffer underneath the caching lexer where possible and push the tokens directly into the caching lexer otherwise. We previously put the lexer into a corrupted state where we could not guarantee to provide the tokens in the right order and would sometimes assert. llvm-svn: 218333
* unique_ptrify Preprocessor's TokenLexerCacheDavid Blaikie2014-08-291-11/+11
| | | | llvm-svn: 216756
* Removed unused typedef for recursive_directory_iteratorBen Langmuir2014-06-301-2/+0
| | | | llvm-svn: 212047
* 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
* Hide the concept of diagnostic levels from lex, parse and semaAlp Toker2014-06-151-6/+4
| | | | | | | | | | | | | | | | 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
* Replace llvm::error_code with std::error_code.Rafael Espindola2014-06-121-1/+1
| | | | llvm-svn: 210780
* [C++11] Use 'nullptr'. Lex edition.Craig Topper2014-05-171-9/+9
| | | | llvm-svn: 209083
* [Preprocessor/CodeComplete] Don't add include guard macros to ↵Argyrios Kyrtzidis2014-04-091-0/+4
| | | | | | code-completion results. llvm-svn: 205917
* [Preprocessor] Only check for -Wunused-macros if the translation unit kind ↵Argyrios Kyrtzidis2014-03-081-1/+1
| | | | | | is TU_Complete. llvm-svn: 203360
* Change OwningPtr::take() to OwningPtr::release().Ahmed Charles2014-03-071-2/+2
| | | | | | This is a precursor to moving to std::unique_ptr. llvm-svn: 203275
* [Preprocessor] Pass TranslationUnitKind to the preprocessor and if it is ↵Argyrios Kyrtzidis2014-03-071-5/+9
| | | | | | | | | | TU_Prefix avoid warning for unused macros. rdar://15034698 llvm-svn: 203213
* Track the currently-being-built submodule inside the preprocessor (rather thanRichard Smith2014-01-311-18/+14
| | | | | | | just storing a flag indicating if there was one), and include it in the 'end of module' annotation. No functionality change. llvm-svn: 200573
* Generate a marker token when entering or leaving a submodule when building aRichard Smith2013-11-231-24/+50
| | | | | | | | | module. Use the marker to diagnose cases where we try to transition between submodules when not at the top level (most likely because a closing brace was missing at the end of a header file, but is also possible if submodule headers attempt to do something fundamentally non-modular, like our .def files). llvm-svn: 195543
* Relax header guard mismatch warning with edit distance heuristic.Ismail Pazarbasi2013-10-121-13/+26
| | | | | | If the edit distance between the two macros is more than 50%, DefinedMacro may not be header guard or can be header guard of another header file or it might be defining something completely different set by the build environment. llvm-svn: 192547
* Make Preprocessor::Lex non-recursive.Eli Friedman2013-09-191-0/+16
| | | | | | | | | | | | | | | Before this patch, Lex() would recurse whenever the current lexer changed (e.g. upon entry into a macro). This patch turns the recursion into a loop: the various lex routines now don't return a token when the current lexer changes, and at the top level Preprocessor::Lex() now loops until it finds a token. Normally, the recursion wouldn't end up being very deep, but the recursion depth can explode in edge cases like a bunch of consecutive macros which expand to nothing (like in the testcase test/Preprocessor/macro_expand_empty.c in this patch). <rdar://problem/14569770> llvm-svn: 190980
* Introducing -Wheader-guard, a warning that checks header guards actually workRichard Trieu2013-06-121-1/+22
| | | | | | | | properly. This warning checks that the #ifndef and #define directives at the beginning of a header refer to the same macro name. Includes a fix-it hint to correct the header guard. llvm-svn: 183867
* Include Path.h instead of PathV2.h.Rafael Espindola2013-06-111-1/+1
| | | | | | I am about to move PathV2.h to Path.h. llvm-svn: 183795
* Add -Wincomplete-module, which detects when a header is included from a ↵Douglas Gregor2013-05-201-1/+29
| | | | | | module but isn't itself part of a module. llvm-svn: 182263
* Use only explicit bool conversion operatorDavid Blaikie2013-05-151-1/+1
| | | | | | | | | | | | | | | | | | | The most common (non-buggy) case are where such objects are used as return expressions in bool-returning functions or as boolean function arguments. In those cases I've used (& added if necessary) a named function to provide the equivalent (or sometimes negative, depending on convenient wording) test. DiagnosticBuilder kept its implicit conversion operator owing to the prevalent use of it in return statements. One bug was found in ExprConstant.cpp involving a comparison of two PointerUnions (PointerUnion did not previously have an operator==, so instead both operands were converted to bool & then compared). A test is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix (adding operator== to PointerUnion in LLVM). llvm-svn: 181869
* Add the module name to the 'incomplete umbrella header' warning.Douglas Gregor2013-01-041-1/+1
| | | | llvm-svn: 171497
* [libclang] Fix crash when code-completing a macro invocation thatArgyrios Kyrtzidis2012-12-221-14/+29
| | | | | | reached EOF and did not expand the argument into the source context. llvm-svn: 170980
OpenPOWER on IntegriCloud