summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
...
* [modules] Refactor and simplify #include handling.Richard Smith2015-05-181-115/+102
| | | | | | | Fix a tiny bug where we'd try to load a module file for the module we're in the middle of building. llvm-svn: 237552
* [modules] If we see a #include that maps to a module, but use of precompiled ↵Richard Smith2015-05-182-24/+25
| | | | | | modules is disabled, track submodule visibility anyway if -fmodules-local-submodule-visibility is enabled. This, in effect, gives modules semantics but without precompilation. llvm-svn: 237550
* [modules] Retain the name as written for umbrella headers and directories, ↵Richard Smith2015-05-162-8/+14
| | | | | | 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-153-34/+47
| | | | | | | | | | | | 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
* Generalize future keyword compat diagnostics.Richard Smith2015-05-141-6/+24
| | | | | | | | | | | | This, in preparation for the introduction of more new keywords in the implementation of the C++ language, generalizes the support for future keyword compat diagnostics (e.g., diag::warn_cxx11_keyword) by extending the applicability of the relevant property in IdentifierTable with appropriate renaming. Patch by Hubert Tong! llvm-svn: 237332
* [modules] Rearrange preprocessor module visibility handling, no observable ↵Richard Smith2015-05-143-31/+51
| | | | | | change intended. llvm-svn: 237331
* Have '__have_extension(cxx_variadic_templates)' return true for any C++ ↵Eric Fiselier2015-05-121-0/+1
| | | | | | standard. llvm-svn: 237202
* Disable __has_cpp_attribute when not compiling in C++ mode. As this feature ↵Aaron Ballman2015-05-111-1/+5
| | | | | | | | test macro only supports C++ style attributes, it doesn't apply to code compiled as C code, and can lead to diagnostics when given a scoped attribute. This addresses PR23435. llvm-svn: 236996
* Revert "Fix path separator issue on Windows."Nikola Smiljanic2015-05-081-1/+3
| | | | | | This reverts commit 9242ff16b0460b488691fd70b42a2bf81a531e3a. llvm-svn: 236806
* Fix path separator issue on Windows.Nikola Smiljanic2015-05-081-3/+1
| | | | llvm-svn: 236804
* Fix buffer overflow in LexerKostya Serebryany2015-05-041-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Fix PR22407, where the Lexer overflows the buffer when parsing #include<\ (end of file after slash) Test Plan: Added a test that will trigger in asan build. This case is also covered by the clang-fuzzer bot. Reviewers: rnk Reviewed By: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9489 llvm-svn: 236466
* Switch PPCallbacks to take the new MacroDefinition instead of ↵Richard Smith2015-05-045-34/+24
| | | | | | MacroDirective*, in order to preserve full information on module macro expansion. llvm-svn: 236404
* Rename MacroDefinition -> MacroDefinitionRecord, ↵Richard Smith2015-05-042-16/+17
| | | | | | | | | | Preprocessor::MacroDefinition -> MacroDefinition. clang::MacroDefinition now models the currently-defined value of a macro. The previous MacroDefinition type, which represented a record of a macro definition directive for a detailed preprocessing record, is now called MacroDefinitionRecord. llvm-svn: 236400
* clang-format function definition header. NFC.Yaron Keren2015-05-021-2/+1
| | | | llvm-svn: 236390
* [modules] Remove dead code from Module for tracking macro import locations.Richard Smith2015-05-022-6/+5
| | | | llvm-svn: 236376
* [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-022-9/+5
| | | | | | | | 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-015-19/+36
| | | | | | | 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
* Make macro dumping robust against a nonexistent macro.Richard Smith2015-04-301-1/+1
| | | | llvm-svn: 236285
* [modules] Add a mechanism to dump information about a macro.Richard Smith2015-04-303-4/+74
| | | | | | Wire this up to "#pragma clang __debug macro <name>". llvm-svn: 236280
* Remove dead code: a MacroDirective can't be imported or ambiguous any more.Richard Smith2015-04-303-31/+1
| | | | llvm-svn: 236197
* Add an assert to get information on buildbot failure.Richard Smith2015-04-291-0/+1
| | | | llvm-svn: 236181
* Fix unused variable warning.Richard Smith2015-04-291-1/+1
| | | | llvm-svn: 236178
* [modules] Stop trying to fake up a linear MacroDirective history.Richard Smith2015-04-298-78/+90
| | | | | | | | | | | | | | 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-282-4/+4
| | | | llvm-svn: 236032
* Fix memory leak found by asan buildbot.Richard Smith2015-04-281-0/+3
| | | | llvm-svn: 235957
* [modules] Incrementally compute the list of overridden module macros based onRichard Smith2015-04-274-46/+89
| | | | | | | 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-232-12/+24
| | | | | | from local submodules. llvm-svn: 235669
* [modules] Properly attribute macros to modules if they're in a file ↵Richard Smith2015-04-233-6/+11
| | | | | | textually included into a file in the module. llvm-svn: 235661
* [modules] Store a ModuleMacro* on an imported macro directive rather than ↵Richard Smith2015-04-234-29/+35
| | | | | | duplicating the info within it. llvm-svn: 235644
* [modules] Determine the set of macros exported by a submodule at the end of ↵Richard Smith2015-04-235-20/+124
| | | | | | | | | | | 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
* [modules] Actually allocate the extra space we use for the tail-allocated arrayRichard Smith2015-04-231-3/+5
| | | | | | in this class. llvm-svn: 235570
* [modules] Cope with partial module macro information, fix memory leak found ↵Richard Smith2015-04-221-0/+9
| | | | | | by buildbot. llvm-svn: 235464
* [modules] Build a DAG of module macros for each identifier.Richard Smith2015-04-222-0/+47
| | | | | | | | This graph will be used to determine the current set of active macros. This is foundation work for getting macro visibility correct across submodules of the current module. No functionality change for now. llvm-svn: 235461
* [MSVC] Mimic MSVC whitespace collapse for incompatible token pastingWill Wilson2015-04-171-0/+7
| | | | | | | | | | In public MS headers for XAudio, clang would fail to generate a valid UUID due to the UUID components being combined with the '-' UUID separators. Clang would attempting to recover but would preserve the leading whitespace from the tokens after each failed paste leading to spaces creeping into the UUID and causing an error in the __declspace(uuid()) parsing. Reference: Microsoft DirectX SDK (June 2010)\Include\XAudio2.h(51) Resolves http://llvm.org/pr23071 llvm-svn: 235186
* MSan told me that we actually dump the entire scratch buffer into PCH files, ↵Benjamin Kramer2015-04-061-3/+4
| | | | | | | | | | | initialize it. Writing 4k of zeros is preferrable to 4k of random memory. Document that. While there remove the initialization of the first byte of the buffer and start at index zero. It was writing a literal '0' instead of a null byte at the beginning anyways, which didn't matter since we never read it. llvm-svn: 234202
* Prefer uninitialized memory for scratch space.Benjamin Kramer2015-04-061-1/+1
| | | | | | No functional change intended. llvm-svn: 234184
* [lex] Provide a valid token when __has_include is found outside of a pp ↵Benjamin Kramer2015-03-291-0/+3
| | | | | | | | | | | directive ExpandBuiltinMacro would strip the identifier and downstream users crash when they encounter an identifier token with nullptr identifier info. Found by afl-fuzz. llvm-svn: 233497
* [lex] Don't create a garbage token if parsing of __has_include fails.Benjamin Kramer2015-03-291-2/+4
| | | | | | It will crash downstream somewhere. Found by afl-fuzz. llvm-svn: 233493
* [lex] Don't read past the end of the bufferBenjamin Kramer2015-03-291-3/+4
| | | | | | | | | While dereferencing ThisTokEnd is fine and we know that it's not in [a-zA-Z0-9_.], ThisTokEnd[1] is really past the end. Found by asan and with a little help from clang-fuzz. llvm-svn: 233491
* [lex] Turn range checks into asserts.Benjamin Kramer2015-03-291-44/+36
| | | | | | | We know that the last accessible char is not in [a-zA-Z0-9_.] so we can happily scan on as long as it is. No functionality change. llvm-svn: 233490
* [modules] Restrict the module use-declaration to only appear in top-levelRichard Smith2015-03-261-17/+13
| | | | | | | modules, and allow sub-modules of a module with a use-declaration to make use of the nominated modules. llvm-svn: 233323
* Make Oveflow tracking more legible (CR feedback from Richard Smith on r232999)David Blaikie2015-03-231-1/+2
| | | | llvm-svn: 233006
* Refactor: Simplify boolean expresssions in lib/LexDavid Blaikie2015-03-231-1/+1
| | | | | | | | | | Simplify boolean expressions using `true` and `false` with `clang-tidy` Patch by Richard Thomson. Differential Revision: http://reviews.llvm.org/D8531 llvm-svn: 232999
* Remove many superfluous SmallString::str() calls.Yaron Keren2015-03-186-27/+26
| | | | | | | | | | | | | | | Now that SmallString is a first-class citizen, most SmallString::str() calls are not required. This patch removes a whole bunch of them, yet there are lots more. There are two use cases where str() is really needed: 1) To use one of StringRef member functions which is not available in SmallString. 2) To convert to std::string, as StringRef implicitly converts while SmallString do not. We may wish to change this, but it may introduce ambiguity. llvm-svn: 232622
* Lex: Don't call getIdentifierInfo on annotation tokensDavid Majnemer2015-03-181-1/+1
| | | | | | | | These calls are usually guarded by checks for isAnnotation() but it looks like we missed a spot. This would cause the included test to crash clang. llvm-svn: 232616
* Implement PreprocessingRecord's and LazyVector's iterators on top of ↵Benjamin Kramer2015-03-151-1/+1
| | | | | | | | | | | | | iterator_adaptor_base This basically creates a wrapper around an 'int' that poses as an iterator. While that looks a bit counter-intuitive it works just fine because iterator operations and basic integer arithmetic works in exactly the same way. Remove the manual integer wrapping code and reduce the reliance on iterator internals in the implementation. No functionality change intended. llvm-svn: 232322
OpenPOWER on IntegriCloud