summaryrefslogtreecommitdiffstats
path: root/clang/test/Index/annotate-tokens-pp.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert 320391: Certain targets are failing, pulling back to diagnose.Erich Keane2017-12-111-2/+2
| | | | llvm-svn: 320398
* For Linux/gnu compatibility, preinclude <stdc-predef.h> if the file is availableErich Keane2017-12-111-2/+2
| | | | | | | | | | | | | | | | | | | | As reported in llvm bugzilla 32377. Here’s a patch to add preinclude of stdc-predef.h. The gcc documentation says “On GNU/Linux, <stdc-predef.h> is pre-included.” See https://gcc.gnu.org/gcc-4.8/porting_to.html; The preinclude is inhibited with –ffreestanding. Basically I fixed the failing test cases by adding –ffreestanding which inhibits this behavior. I fixed all the failing tests, including some in extra/test, there's a separate patch for that which is linked here Note: this is a recommit after a test failure took down the original (r318669) Patch By: mibintc Differential Revision: https://reviews.llvm.org/D34158 llvm-svn: 320391
* Revert r318669/318694Erich Keane2017-11-201-2/+2
| | | | | | Broke some libclang tests, so reverting for now. llvm-svn: 318698
* For Linux/gnu compatibility, preinclude <stdc-predef.h> if the file is availableErich Keane2017-11-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | As reported in llvm bugzilla 32377. Here’s a patch to add preinclude of stdc-predef.h. The gcc documentation says “On GNU/Linux, <stdc-predef.h> is pre-included.” See https://gcc.gnu.org/gcc-4.8/porting_to.html; The preinclude is inhibited with –ffreestanding. Basically I fixed the failing test cases by adding –ffreestanding which inhibits this behavior. I fixed all the failing tests, including some in extra/test, there's a separate patch for that which is linked here Patch By: mibintc Differential Revision: https://reviews.llvm.org/D34158 llvm-svn: 318669
* [libclang] When annotating preprocessor tokens, if we are in a macro definition,Argyrios Kyrtzidis2013-01-071-1/+1
| | | | | | check if the token was ever a macro name and annotate it if that's the case. llvm-svn: 171776
* [libclang] Simplify annotation of preprocessing tokens and remove the ↵Argyrios Kyrtzidis2013-01-071-1/+1
| | | | | | | | | | | | AnnotateTokensData DenseMap and the lookups associated with it. Instead of lexing for preprocessor tokens, associating the annotation with the location in a map, and later lookup in the map in order to adjust the cursor annotation, just annotate the cursor while lexing for preprocessor tokens. llvm-svn: 171775
* [libclang] Make sure tokens from preprocessor directives are annotated as such,Argyrios Kyrtzidis2012-12-121-2/+31
| | | | | | | | even if the directive is inside a declaration. Fixes rdar://11548788 & http://llvm.org/PR12970 llvm-svn: 169949
* For SourceManager::isBeforeInTranslationUnit(), have it consider macro arg ↵Argyrios Kyrtzidis2011-12-211-3/+4
| | | | | | | | | | expanded token locations as coming before the closing ')' of a function macro expansion. Include a unit test for SourceManager. llvm-svn: 147056
* Expose more statement, expression, and declaration kinds in libclang,Douglas Gregor2011-10-051-24/+24
| | | | | | from Manuel Holtgrewe! llvm-svn: 141200
* Don't map a file:line:col triplet that is inside the preamble range toArgyrios Kyrtzidis2011-09-261-0/+1
| | | | | | | | | | | | | | a "loaded" location of the precompiled preamble. Instead, handle specially locations of preprocessed entities: -When looking up for preprocessed entities, map main file locations inside the preamble range to a preamble loaded location. -When getting the source range of a preprocessing cursor, map preamble loaded locations back to main file locations. Fixes rdar://10175093 & http://llvm.org/PR10999 llvm-svn: 140519
* For SourceManager::isBeforeInTranslationUnit, a location pointingArgyrios Kyrtzidis2011-09-191-2/+4
| | | | | | | inside a macro argument should be regarded as coming before the location of the expanded tokens. llvm-svn: 140053
* [libclang] Fix annotation and getting a "macro expansion" cursorArgyrios Kyrtzidis2011-09-081-1/+4
| | | | | | for a builtin macro expansion. llvm-svn: 139298
* [libclang] Annotate correctly macro argument tokens.Argyrios Kyrtzidis2011-08-181-6/+6
| | | | llvm-svn: 137961
* Update all of the libclang code corresponding to the preprocessorChandler Carruth2011-07-141-7/+7
| | | | | | | | | | | | | | MacroInstantiation -> MacroExpansion rename. Internally, everything is switched. Introduce a new cursor kind enum with the new name, but retain the old name as an alias so that we don't break backwards compatibility. Also update the debug printing routine to use 'macro expansions' as its explicitly not guaranteed to be stable, and mechanically switch the test cases over to that. llvm-svn: 135140
* Introduce a new libclang API, clang_isFileMultipleIncludeGuarded(),Douglas Gregor2011-05-041-2/+6
| | | | | | | | which determines whether a particular file is actually a header that is intended to be guarded from multiple inclusions within the same translation unit. llvm-svn: 130808
* ntroduce clang_getSpellingLocation() into libclang, to provide theDouglas Gregor2010-11-091-1/+1
| | | | | | | | | | | | | | location where we're spelling a token even within a macro. clang_getInstantiationLocation() tells where we instantiated the macro. I'm still not thrilled with the CXSourceLocation/CXSourceRange APIs, since they gloss over macro-instantiation information. Take 2: this time, adjusted tests appropriately and used a "simple" approach to the spelling location. llvm-svn: 118495
* Improve the implementation of libclang's token-annotation logic forDouglas Gregor2010-10-211-48/+48
| | | | | | | | | | | | | | | | | entities in the preprocessing record. Previously, we would only end up getting the first token of a preprocessing record annotated correctly. For example, given #include "foo.h" we would only get the '#' annotated as an inclusion directive; the 'include' and '"foo.h"' tokens would be given the general 'processing directive' annotation. Now, we get proper annotations for entities in the preprocessing record. llvm-svn: 117001
* Extend the preprocessing record and libclang with support forDouglas Gregor2010-10-201-1/+1
| | | | | | | | | inclusion directives, keeping track of every #include, #import, etc. in the translation unit. We keep track of the source location and kind of the inclusion, how the file name was spelled, and the underlying file to which the inclusion resolved. llvm-svn: 116952
* Always recurse into sub-cursors when annotating tokens, as this information ↵Ted Kremenek2010-08-141-1/+55
| | | | | | is used for annotating macro arguments. This finishes up <rdar://problem/8044584>. llvm-svn: 111066
* As a heuristic, annotate tokens (via clang_annotateTokens) that are the ↵Ted Kremenek2010-08-141-1/+76
| | | | | | arguments of a macro instantiation using the closest cursor with the same spelling location. Because macro arguments can get token pasted in any arbitrary order, we use the annotation map to paper over the token -> cursor annotations during our post-processing stage. This fixes most of <rdar://problem/8044584>, but still doesn't work for assert(). llvm-svn: 111062
* Try to appease MSVC's standard libraryDouglas Gregor2010-03-181-1/+1
| | | | llvm-svn: 98878
* Try to appease MSVCDouglas Gregor2010-03-181-1/+1
| | | | llvm-svn: 98875
* Explicitly link macro instantiations to macro definitions in theDouglas Gregor2010-03-181-4/+4
| | | | | | | | preprocessing record. Use that link with clang_getCursorReferenced() and clang_getCursorDefinition() to match instantiations of a macro to the definition of the macro. llvm-svn: 98842
* Expose macro definitions as CIndex cursors. These can still only beDouglas Gregor2010-03-181-3/+3
| | | | | | generated by clang_annotateTokens(). llvm-svn: 98837
* Introduce the notion of a "preprocessing record", which keeps track ofDouglas Gregor2010-03-181-26/+52
| | | | | | | | | | | | | | | | | | | | | | | | the macro definitions and macro instantiations that are found during preprocessing. Preprocessing records are *not* generated by default; rather, we provide a PPCallbacks subclass that hooks into the existing callback mechanism to record this activity. The only client of preprocessing records is CIndex, which keeps track of macro definitions and instantations so that they can be exposed via cursors. At present, only token annotation uses these facilities, and only for macro instantiations; both will change in the near future. However, with this change, token annotation properly annotates macro instantiations that do not produce any tokens and instantiations of macros that are later undef'd, improving our consistency. Preprocessing directives that are not macro definitions are still handled by clang_annotateTokens() via re-lexing, so that we don't have to track every preprocessing directive in the preprocessing record. Performance impact of preprocessing records is still TBD, although it is limited to CIndex and therefore out of the path of the main compiler. llvm-svn: 98836
* More token-annotation experimentation, preprocessing the annotatedDouglas Gregor2010-03-181-9/+10
| | | | | | | token sequence to detect macro instantiations (that produce at least token). WIP. llvm-svn: 98826
* Experimental stab at using relexing to identify preprocessorDouglas Gregor2010-03-181-0/+31
directives while annotating tokens in CIndex. This functionality should probably be factored out of this routine, but we're not there yet. llvm-svn: 98786
OpenPOWER on IntegriCloud