summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PreprocessingRecord.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Change std::{lower,upper}_bound to llvm::{lower,upper}_bound or ↵Fangrui Song2019-07-031-11/+7
| | | | | | llvm::partition_point. NFC llvm-svn: 365006
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Remove trailing spaceFangrui Song2018-07-301-23/+23
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338291
* Reland '[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective'Julie Hockett2018-05-101-1/+2
| | | | | | | | | | | | | | This commit relands r331904. Adding a SrcMgr::CharacteristicKind parameter to the InclusionDirective in PPCallbacks, and updating calls to that function. This will be useful in https://reviews.llvm.org/D43778 to determine which includes are system headers. Differential Revision: https://reviews.llvm.org/D46614 llvm-svn: 332021
* Revert "[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective"Julie Hockett2018-05-091-2/+1
| | | | | | This reverts commit r331904 because of a memory leak. llvm-svn: 331932
* [clang] Adding CharacteristicKind to PPCallbacks::InclusionDirectiveJulie Hockett2018-05-091-1/+2
| | | | | | | | | | | Adding a SrcMgr::CharacteristicKind parameter to the InclusionDirective in PPCallbacks, and updating calls to that function. This will be useful in https://reviews.llvm.org/D43778 to determine which includes are system headers. Differential Revision: https://reviews.llvm.org/D46614 llvm-svn: 331904
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-5/+5
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
* [PCH] Serialize skipped preprocessor rangesCameron Desrochers2018-01-151-1/+20
| | | | | | | | The skipped preprocessor ranges are now serialized in the AST PCH file. This fixes, for example, libclang's clang_getSkippedRanges() returning zero ranges after reparsing a translation unit. Differential Revision: https://reviews.llvm.org/D20124 llvm-svn: 322503
* [Lex] Fix some Clang-tidy modernize and Include What You Use warnings; other ↵Eugene Zelenko2017-12-081-14/+30
| | | | | | minor fixes (NFC). llvm-svn: 320207
* [Lexer] Report more precise skipped regions (PR34166)Vedant Kumar2017-09-111-2/+3
| | | | | | | | | | | | | | | | | | | | This patch teaches the preprocessor to report more precise source ranges for code that is skipped due to conditional directives. The new behavior includes the '#' from the opening directive and the full text of the line containing the closing directive in the skipped area. This matches up clang's behavior (we don't IRGen the code between the closing "endif" and the end of a line). This also affects the code coverage implementation. See llvm.org/PR34166 (this also happens to be rdar://problem/23224058). The old behavior (report the end of the skipped range as the end location of the 'endif' token) is preserved for indexing clients. Differential Revision: https://reviews.llvm.org/D36642 llvm-svn: 312947
* Revert "Revert "PPCallbacks::MacroUndefined, change signature and add test.""Vedant Kumar2017-04-261-1/+2
| | | | | | | This reverts commit r301469. It isn't needed with r301470, which fixes the API break introduced in the original commit. llvm-svn: 301472
* Revert "PPCallbacks::MacroUndefined, change signature and add test."Vedant Kumar2017-04-261-2/+1
| | | | | | | | This reverts commit r301449. It breaks the build with: MacroPPCallbacks.h:114:50: error: non-virtual member function marked 'override' hides virtual member function llvm-svn: 301469
* PPCallbacks::MacroUndefined, change signature and add test.Frederich Munch2017-04-261-1/+2
| | | | | | | | | | | | | | | | Summary: The PPCallbacks::MacroUndefined callback is currently insufficient for clients that need to track the MacroDirectives. This patch adds an additional argument to PPCallbacks::MacroUndefined that is the undef MacroDirective. Reviewers: bruno, manmanren Reviewed By: bruno Subscribers: nemanjai, cfe-commits Differential Revision: https://reviews.llvm.org/D29923 llvm-svn: 301449
* Retire llvm::alignOf in favor of C++11 alignof.Benjamin Kramer2016-10-201-10/+5
| | | | | | No functionality change intended. llvm-svn: 284730
* 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
* Replace double negation of !FileID.isInvalid() with FileID.isValid().Yaron Keren2015-10-031-1/+1
| | | | | | +couple more of double-negated !SourceLocation.isInvalid() unfixed in r249228. llvm-svn: 249235
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-1/+1
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* Switch PPCallbacks to take the new MacroDefinition instead of ↵Richard Smith2015-05-041-12/+11
| | | | | | MacroDirective*, in order to preserve full information on module macro expansion. llvm-svn: 236404
* Rename MacroDefinition -> MacroDefinitionRecord, ↵Richard Smith2015-05-041-14/+15
| | | | | | | | | | 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
* 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
* Simplify boolean expressions in clang with clang-tidyDavid Blaikie2015-03-091-5/+2
| | | | | | | | Patch by Richard (legalize at xmission dot com). Differential Revision: http://reviews.llvm.org/D8155 llvm-svn: 231619
* Update APIs that return a pair of iterators to return an iterator_range instead.Benjamin Kramer2015-02-061-6/+7
| | | | | | Convert uses of those APIs into ranged for loops. NFC. llvm-svn: 228404
* [C++11] Use 'nullptr'. Lex edition.Craig Topper2014-05-171-3/+3
| | | | llvm-svn: 209083
* [libclang] Record ranges skipped by the preprocessor and expose them with ↵Argyrios Kyrtzidis2013-12-051-0/+4
| | | | | | | | libclang. Patch by Erik Verbruggen! llvm-svn: 196487
* Add SourceRange to PPCallbacks::Defined callback.John Thompson2013-07-191-1/+2
| | | | llvm-svn: 186707
* [Preprocessor] For the MacroExpands preprocessor callback, also pass the ↵Argyrios Kyrtzidis2013-05-031-1/+2
| | | | | | | | MacroArgs object that provides information about the argument tokens for a function macro. llvm-svn: 181065
* [Preprocessor/Modules] Separate the macro directives kinds into their own ↵Argyrios Kyrtzidis2013-03-261-6/+9
| | | | | | | | | | | | | | | | MacroDirective's subclasses. For each macro directive (define, undefine, visibility) have a separate object that gets chained to the macro directive history. This has several benefits: -No need to mutate a MacroDirective when there is a undefine/visibility directive. Stuff like PPMutationListener become unnecessary. -No need to keep extra source locations for the undef/visibility locations for the define directive object (which is the majority of the directives) -Much easier to hide/unhide a section in the macro directive history. -Easier to track the effects of the directives across different submodules. llvm-svn: 178037
* [preprocessor] Use MacroDirective in the preprocessor callbacks to make ↵Argyrios Kyrtzidis2013-02-241-15/+16
| | | | | | | | available the full information about the macro (e.g if it was imported and where). llvm-svn: 175978
* [preprocessing record] Have the MacroDefinitions map point to the ↵Argyrios Kyrtzidis2013-02-221-9/+7
| | | | | | | | | | 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
* Include llvm::Optional in clang/Basic/LLVM.hDavid Blaikie2013-02-201-2/+2
| | | | | | Post-commit CR feedback from Jordan Rose regarding r175594. llvm-svn: 175679
* [preprocessing record] Add some sanity checks for the preprocessed entity indexArgyrios Kyrtzidis2013-02-121-4/+8
| | | | | | | | to make sure we don't crash on release if the index is not valid. rdar://13089714 llvm-svn: 175010
* [preprocessor] Call the MacroUndefined callback even when the macro was not ↵Argyrios Kyrtzidis2013-01-161-1/+3
| | | | | | | | defined. Patch by Enea Zaffanella! llvm-svn: 172623
* [PreprocessingRecord] A macro expansion can be reported out-of-order in ↵Argyrios Kyrtzidis2013-01-091-3/+11
| | | | | | | | | | | | 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
* [libclang] Resolve a cursor that points to a macro name inside a #ifdef/#ifndefArgyrios Kyrtzidis2012-12-081-2/+29
| | | | | | | | | | directive as a macro expansion. This is more of a "macro reference" than a macro expansion but it's close enough for libclang's purposes. If it causes issues we can revisit and introduce a new kind of cursor. llvm-svn: 169666
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-1/+1
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Refactor recording the preprocessor conditional directive regions out ofArgyrios Kyrtzidis2012-12-041-99/+2
| | | | | | | | | PreprocessingRecord and into its own class, PPConditionalDirectiveRecord. Decoupling allows a client to use the functionality of PPConditionalDirectiveRecord without needing a PreprocessingRecord. llvm-svn: 169229
* In the PreprocessingRecord, to identify the different conditional directive ↵Argyrios Kyrtzidis2012-12-041-16/+19
| | | | | | | | regions use the SourceLocation at the start of the respective region, instead of a unique integer. llvm-svn: 169228
* [preprocessing record] Have PPEntityID be independent of the size of theArgyrios Kyrtzidis2012-10-051-14/+18
| | | | | | | loaded entities vector, otherwise its meaning will change when a module is imported and the vector size changes. llvm-svn: 165278
* Add info in the preprocessing record whether an inclusion directiveArgyrios Kyrtzidis2012-10-021-3/+5
| | | | | | resulted in an automatic module import. llvm-svn: 165022
* For PPCallbacks::InclusionDirective() add a parameter for the module, wheneverArgyrios Kyrtzidis2012-09-291-1/+2
| | | | | | | an inclusion directive was automatically turned into a module import, and PPCallbacks::moduleImport() for an explicit module import. llvm-svn: 164874
* Per discussion in ↵Argyrios Kyrtzidis2012-09-271-2/+11
| | | | | | | | | | http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120917/064551.html have PPCallbacks::InclusionDirective pass the character range for the filename quotes or brackets. rdar://11113134 & http://llvm.org/PR13880 llvm-svn: 164743
* Documentation cleanup:James Dennett2012-06-221-2/+2
| | | | | | | * Use \p param for a parameter reference, not the (erroneous) form \arg param; * Escape # characters in Doxygen comments as needed. llvm-svn: 158971
* [preprocessor] Handle correctly inclusion directives that have macro ↵Argyrios Kyrtzidis2012-03-271-16/+39
| | | | | | | | | | | | | | | | | | expansions, e.g "#include MACRO(STUFF)". -As an inclusion position for the included file, use the file location of the file where it was included but *after* the macro expansions. We want the macro expansions to be considered as before-in-translation-unit for everything in the included file. -In the preprocessing record take into account that only inclusion directives can be encountered as "out-of-order" (by comparing the start of the range which for inclusions is the hash location) and use binary search if there is an extreme number of macro expansions in the include directive. Fixes rdar://11111779 llvm-svn: 153527
* Simplify some users of DenseMap::erase.Benjamin Kramer2012-03-241-4/+1
| | | | llvm-svn: 153389
* [preprocessor] Enhance PreprocessingRecord to keep track of locations of ↵Argyrios Kyrtzidis2012-03-051-2/+96
| | | | | | | | | conditional directives. Introduce PreprocessingRecord::rangeIntersectsConditionalDirective() which returns true if a given range intersects with a conditional directive block. llvm-svn: 152018
* Don't record nested macro expansions in the preprocessing record,Argyrios Kyrtzidis2012-02-251-5/+4
| | | | | | | | it can only bring pain when dealing with preprocessor abuse (see: boost). rdar://10898986 llvm-svn: 151427
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-171-1/+0
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* [PCH] When visiting preprocessed entities, make it possible to avoid ↵Argyrios Kyrtzidis2011-10-251-16/+89
| | | | | | | | | | | | | | | deserializing preprocessed entities that are #included in the range that we are interested. This is useful when we are interested in preprocessed entities of a specific file, e.g when we are annotating tokens. There is also an optimization where we cache the last result of PreprocessingRecord::getPreprocessedEntitiesInRange and we re-use it if there is a call with the same range as before. rdar://10313365 llvm-svn: 142887
OpenPOWER on IntegriCloud