summaryrefslogtreecommitdiffstats
path: root/clang/test/Index
Commit message (Collapse)AuthorAgeFilesLines
...
* [libclang] Store unsaved file hashes when recording parsing invocationsAlex Lorenz2017-12-052-0/+9
| | | | | | | | | | | | Storing the contents of unsaved files is too expensive. Instead a hash is stored with a record invocation. When a reproducer is generated, Clang will compare the stored hashes to the new hashes to determine if the contents of a file has changed. This way we'll know when a reproducer was generated for a different source to the one that triggered the original crash. rdar://35322543 llvm-svn: 319729
* Fix record-parsing-invocation.c test on WindowsAlex Lorenz2017-12-041-1/+1
| | | | | | We should not check for the forward slash '/' llvm-svn: 319715
* [libclang] Record parsing invocation to a temporary file when requestedAlex Lorenz2017-12-041-0/+21
| | | | | | | | | | | | | | | | | | by client This patch extends libclang by allowing it to record parsing operations to a temporary JSON file. The file is deleted after parsing succeeds. When a crash happens during parsing, the file is preserved and the client will be able to use it to generate a reproducer for the crash. These files are not emitted by default, and the client has to specify the invocation emission path first. rdar://35322543 Differential Revision: https://reviews.llvm.org/D40527 llvm-svn: 319702
* Revert r318669/318694Erich Keane2017-11-207-46/+46
| | | | | | 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-207-46/+46
| | | | | | | | | | | | | | | | | | | | | | 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
* [DeclPrinter] Honor TerseOutput for constructorsAlex Lorenz2017-11-161-1/+1
| | | | | | | | Patch by Nikolai Kosjar! Differential Revision: https://reviews.llvm.org/D39957 llvm-svn: 318365
* [libclang] Fix cursors for in-class initializer of field declarationsBenjamin Kramer2017-11-151-0/+8
| | | | | | | | | | Fixes PR33745. Patch by Nikolai Kosjar! Differential Revision: https://reviews.llvm.org/D40027 llvm-svn: 318292
* [completion] complete ObjC interface names in an expressionAlex Lorenz2017-11-141-0/+16
| | | | | | | | Objective-C interfaces can be used in a class property expression. rdar://26982192 llvm-svn: 318129
* [index] tag declarations should use the decl role instead of refAlex Lorenz2017-11-091-3/+3
| | | | | | | | | The 'decl' role is more canonical than the 'ref'. This helps us establish the 'specialization-of' relation just by looking at decls or defs. rdar://31884960 llvm-svn: 317832
* Avoid printing some redundant name qualifiers in completionIlya Biryukov2017-11-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Adjusted PrintingPolicy inside code completion to avoid printing some redundant name qualifiers. Before this change, typedefs that were written unqualified in source code were printed with qualifiers in completion. For example, in the following code struct foo { typedef int type; type method(); }; completion item for `method` had return type of `foo::type`, even though the original code used `type` without qualifiers. After this change, the completion item has return type `type`, as originally written in the source code. Note that this change does not suppress qualifiers written by the user. For example, in the following code typedef int type; struct foo { typedef int type; ::type method(foo::type); }; completion item for `method` has return type of `::type` and parameter type of `foo::type`, as originally written in the source code. Reviewers: arphaman, bkramer, klimek Reviewed By: arphaman Subscribers: mgorny, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D38538 llvm-svn: 317677
* [index] __builtin_offset's field reference is located at the end locationAlex Lorenz2017-11-071-1/+1
| | | | | | The starting location is the location of the '.' llvm-svn: 317596
* [index] index field references in __builtin_offsetAlex Lorenz2017-11-071-0/+33
| | | | | | rdar://35109556 llvm-svn: 317593
* [preamble] Also record the "skipping" state of the preprocessorErik Verbruggen2017-11-032-1/+19
| | | | | | | | | | When a preamble ends in a conditional preprocessor block that is being skipped, the preprocessor needs to continue skipping that block when the preamble is used. This fixes PR34570. llvm-svn: 317308
* Fix overloaded static functions in SemaCodeCompleteBenjamin Kramer2017-10-261-0/+61
| | | | | | | | | | | | | | | | | | | | | https://bugs.llvm.org/show_bug.cgi?id=33904 Happens when static function is accessed via the class variable. That leads to incorrect overloads number because the variable is considered as the first argument. struct Bar { static void foo(); static void foo(int); }; int main() { Bar b; b.foo(/*complete here*/); // did not work before Bar::foo(/*complete here*/); // worked fine } Patch by Ivan Donchevskii! Differential Revision: https://reviews.llvm.org/D36390 llvm-svn: 316646
* [code completion] Complete ObjC methods in @implementation without leadingAlex Lorenz2017-10-241-0/+22
| | | | | | | | '-'/'+' prefix rdar://12040840 llvm-svn: 316458
* Do not add a colon chunk to the code completion of class inheritance access ↵Erik Verbruggen2017-10-241-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | modifiers With enabled CINDEXTEST_CODE_COMPLETE_PATTERNS env option (which enables IncludeCodePatterns in completion options) code completion after colon currently suggests access modifiers with 2 completion chunks which is incorrect. Example: class A : <Cursor>B { } Currently we get 'NotImplemented:{TypedText public}{Colon :} (40)' but the correct line is just 'NotImplemented:{TypedText public} (40)' The fix introduces more specific scope that occurs between ':' and '{' It allows us to determine when we don't need to add ':' as a second chunk to the public/protected/private access modifiers. Patch by Ivan Donchevskii! Differential Revision: https://reviews.llvm.org/D38618 llvm-svn: 316436
* [libclang] Visit attributes for function and class templatesJonathan Coe2017-10-161-0/+12
| | | | | | | | | | | | | | | | | | Summary: Previously, `VisitAttributes` was not called for function and class templates and thus their attributes were not accessible using libclang. Reviewers: bkramer, arphaman, rsmith, jbcoe Reviewed By: jbcoe Subscribers: cfe-commits Tags: #clang Patch by jklaehn (Johann Klähn) Differential Revision: https://reviews.llvm.org/D36955 llvm-svn: 315958
* Fix indexer crash for default template template parameter valueJan Korous2017-10-101-0/+7
| | | | | | | | rdar://33058798 Differential Revision: https://reviews.llvm.org/D38755 llvm-svn: 315367
* R13575: Fix USR mangling for function pointer typesJan Korous2017-10-101-0/+18
| | | | | | Differential Revision: https://reviews.llvm.org/D38707 llvm-svn: 315255
* PR13575: Fix testJan Korous2017-10-091-3/+3
| | | | | | Ignore OS-specific mangled name. llvm-svn: 315241
* PR13575: Fix USR mangling for fixed-size arraysJan Korous2017-10-091-0/+11
| | | | | | Differential Revision: https://reviews.llvm.org/D38643 llvm-svn: 315236
* Driver: hoist the `wchar_t` handling to the driverSaleem Abdulrasool2017-10-061-1/+1
| | | | | | | | | | | | | | | | Move the logic for determining the `wchar_t` type information into the driver. Rather than passing the single bit of information of `-fshort-wchar` indicate to the frontend the desired type of `wchar_t` through a new `-cc1` option of `-fwchar-type` and indicate the signedness through `-f{,no-}signed-wchar`. This replicates the current logic which was spread throughout Basic into the `RenderCharacterOptions`. Most of the changes to the tests are to ensure that the frontend uses the correct type. Add a new test set under `test/Driver/wchar_t.c` to ensure that we calculate the proper types for the various cases. llvm-svn: 315126
* [lit] Improve tool substitution in lit.Zachary Turner2017-10-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This addresses two sources of inconsistency in test configuration files. 1. Substitution boundaries. Previously you would specify a substitution, such as 'lli', and then additionally a set of characters that should fail to match before and after the tool. This was used, for example, so that matches that are parts of full paths would not be replaced. But not all tools did this, and those that did would often re-invent the set of characters themselves, leading to inconsistency. Now, every tool substitution defaults to using a sane set of reasonable defaults and you have to explicitly opt out of it. This actually fixed a few latent bugs that were never being surfaced, but only on accident. 2. There was no standard way for the system to decide how to locate a tool. Sometimes you have an explicit path, sometimes we would search for it and build up a path ourselves, and sometimes we would build up a full command line. Furthermore, there was no standardized way to handle missing tools. Do we warn, fail, ignore, etc? All of this is now encapsulated in the ToolSubst class. You either specify an exact command to run, or an instance of FindTool('<tool-name>') and everything else just works. Furthermore, you can specify an action to take if the tool cannot be resolved. Differential Revision: https://reviews.llvm.org/D38565 llvm-svn: 315085
* Set completion priority of destructors and operators to CCP_Unlikely.Ilya Biryukov2017-09-224-17/+17
| | | | | | | | | | | | | | | | | | | Summary: It will move destructors and operators to the end of completion list. Destructors and operators are currently very high on the completion list, as they have the same priority as member functions. However, they are clearly not something users usually choose in completion lists. Reviewers: arphaman, erikjv, bkramer, krasimir Reviewed By: arphaman Subscribers: eraman, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D38081 llvm-svn: 314019
* [index] Generate class & metaclass manglings for objcDave Lee2017-09-221-0/+18
| | | | | | | | | | | | | | | | | | | | | | | Summary: ObjC classes have two associated symbols, one for the class and one for the metaclass. This change overloads `CodegenNameGenerator::getAllManglings` to produce both class and metaclass symbols. While this function is called by `clang_Cursor_getCXXManglings`, it's only called for CXXRecordDecl and CXXMethodDecl, and so libclang's behavior is unchanged. Reviewers: arphaman, abdulras, alexshap, compnerd Reviewed By: compnerd Subscribers: compnerd Differential Revision: https://reviews.llvm.org/D37671 llvm-svn: 313997
* Fix recording preamble's conditional stack in skipped PP branches.Ilya Biryukov2017-09-122-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This fixes PR34547. `Lexer::LexEndOfFile` handles recording of ConditionalStack for preamble and reporting errors about unmatched conditionalal PP directives. However, SkipExcludedConditionalBlock contianed duplicated logic for reporting errors and clearing ConditionalStack, but not for preamble recording. This fix removes error reporting logic from `SkipExcludedConditionalBlock`, unmatched PP conditionals are now reported inside `Lexer::LexEndOfFile`. Reviewers: erikjv, klimek, bkramer Reviewed By: erikjv Subscribers: nik, cfe-commits Differential Revision: https://reviews.llvm.org/D37700 llvm-svn: 313014
* [Lexer] Report more precise skipped regions (PR34166)Vedant Kumar2017-09-111-3/+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
* Don't show deleted function (constructor) candidates for code completionErik Verbruggen2017-09-081-0/+17
| | | | | | | | | | | In case of copy constructor is implicitly deleted it's still shown. PR34402 describes a way to reproduce that. Patch by Ivan Donchevskii! Differential Revision: https://reviews.llvm.org/D37435 llvm-svn: 312785
* Fix templated type alias completion when using global completion cacheErik Verbruggen2017-09-081-0/+12
| | | | | | | | | | | | | | | | | | | | | | | When we have enabled cache for global completions we did not have diagnostics for Bar and could not complete Ba as in provided code example. template <typename T> struct Foo { T member; }; template<typename T> using Bar = Foo<T>; int main() { Ba } (This is the fixed version of r 311442, which was reverted in r311445.) Patch by Ivan Donchevskii! Differential Revision: https://reviews.llvm.org/D35355 llvm-svn: 312780
* Revert r311442 (Fix templated type alias completion when using global ↵Erik Verbruggen2017-08-221-12/+0
| | | | | | | | | | completion cache) Failing Tests (2): Clang :: CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp Clang :: SemaCXX/alias-template.cpp llvm-svn: 311445
* Fix templated type alias completion when using global completion cacheErik Verbruggen2017-08-221-0/+12
| | | | | | | | | | | | | | | | | | | | | When we have enabled cache for global completions we did not have diagnostics for Bar and could not complete Ba as in provided code example. template <typename T> struct Foo { T member; }; template<typename T> using Bar = Foo<T>; int main() { Ba } Patch by Ivan Donchevskii! Differential Revision: https://reviews.llvm.org/D35355 llvm-svn: 311442
* Fixed a crash on replaying Preamble's PP conditional stack.Ilya Biryukov2017-08-212-0/+20
| | | | | | | | | | | | | | | | | | | Summary: The crash occurs when the first token after a preamble is a macro expansion. Fixed by moving replayPreambleConditionalStack from Parser into Preprocessor. It is now called right after the predefines file is processed. Reviewers: erikjv, bkramer, klimek, yvvan Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D36872 llvm-svn: 311330
* Print enum constant values using the original source formattingAlex Lorenz2017-08-171-0/+26
| | | | | | | | if possible when creating "Declaration" nodes in XML comments rdar://14765746 llvm-svn: 311085
* [index] Add indexing for unresolved-using declarationsBen Langmuir2017-08-162-1/+67
| | | | | | | | | | | In dependent contexts we end up referencing these, so make sure they have USRs, and have their declarations indexed. For the most part they behave like typedefs, but we also need to worry about having multiple using declarations with the same "name". rdar://problem/33883650 llvm-svn: 311053
* [index] Update indexing to handle CXXDeductionGuideDecls properlyArgyrios Kyrtzidis2017-08-151-0/+13
| | | | | | | | | | | CXXDeductionGuideDecls can't be referenced so there's no need to output a symbol occurrence for them. Also handle DeducedTemplateSpecializationTypeLocs in the TypeIndexer so we don't miss the symbol occurrences of the corresponding template decls. Patch by Nathan Hawes! Differential Revision: https://reviews.llvm.org/D36641 llvm-svn: 310933
* [index] Set SymbolSubKind::Accessor[GS]etter on class methodsBen Langmuir2017-07-211-2/+11
| | | | | | | | | We have the same relation between class properties and getter/setters that we have for instance properties, so set the same symbol sub-kind. rdar://problem/32376404 llvm-svn: 308800
* Add default values for function parameter chunksErik Verbruggen2017-07-192-12/+28
| | | | | | | | | | | Append optional chunks with their default values. For example: before - "int i", after - "int i = 10" Patch by Ivan Donchevskii! Differential Revision: https://reviews.llvm.org/D33644 llvm-svn: 308433
* [Index] Prevent canonical decl becoming nullptrKrasimir Georgiev2017-07-181-0/+4
| | | | | | | | | | | | | | | | | | Summary: This patch prevents getCanonicalDecl returning nullptr in case it finds a canonical TemplateDeclaration with no attached TemplatedDecl. Found by running the indexer over a version of the standard library deep inside a template metaprogramming mess. Reviewers: klimek, vsk Reviewed By: vsk Subscribers: vsk, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D35212 llvm-svn: 308269
* [clang] Remove redundant check-prefix=CHECK from tests. NFC.Mandeep Singh Grang2017-07-171-2/+2
| | | | | | | | | | | | Reviewers: t.p.northover, mstorsjo, rsmith, mcrosier Reviewed By: mstorsjo, mcrosier Subscribers: mcrosier, javed.absar, cfe-commits Differential Revision: https://reviews.llvm.org/D35465 llvm-svn: 308192
* [index] Objective-C method declarations and message sends withAlex Lorenz2017-07-131-0/+25
| | | | | | | | an empty first selector piece should store the location of the first ':' rdar://33188656 llvm-svn: 307901
* [index] Don't add relation to a NamedDecl with no nameBen Langmuir2017-07-121-0/+13
| | | | | | | | | | | | Unless it's one of the special cases (tag, category) that we can handle. This syncs up the check between handling a decl and handling a relation. This would cause invalid nameless decls to end up in relations despite having no name or USR. rdar://problem/32474406 llvm-svn: 307855
* [libclang] Support for querying whether an enum is scopedAlex Lorenz2017-07-121-0/+7
| | | | | | | | | | | This commit allows checking whether an enum declaration is scoped through libclang and clang.cindex (Python). Patch by Johann Klähn! Differential Revision: https://reviews.llvm.org/D35187 llvm-svn: 307771
* Revert r307769 (Forgot to mention the name of the contributor).Alex Lorenz2017-07-121-7/+0
| | | | llvm-svn: 307770
* [libclang] Support for querying whether an enum is scopedAlex Lorenz2017-07-121-0/+7
| | | | | | | | | This commit allows checking whether an enum declaration is scoped through libclang and clang.cindex (Python). Differential Revision: https://reviews.llvm.org/D35187 llvm-svn: 307769
* [Frontend] Verify that the bitstream is not empty before readingAlex Lorenz2017-07-072-0/+2
| | | | | | | | | | | | | | the serialised diagnostics Clang should avoid calling report_fatal_error when the file with the serialised diagnostics is empty. This commit changes Clang's serialised diagnostic reader, now it reports an appropriate error instead of crashing. rdar://31939877 Differential Revision: https://reviews.llvm.org/D35069 llvm-svn: 307384
* [AMDGPU] Fix size and alignment of size_t and pointer typesYaxun Liu2017-07-051-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D34995 llvm-svn: 307121
* [index] Index nested name qualifiers in a forward declaration of aAlex Lorenz2017-07-041-0/+16
| | | | | | | | class template specialization rdar://33122110 llvm-svn: 307074
* [index] Remove 'implicit' role for message sends in implicit ObjCAlex Lorenz2017-07-031-0/+25
| | | | | | | | property references rdar://32375673 llvm-svn: 307016
* [modules] Teach clang how to merge typedef over anonymous structs in C mode.Vassil Vassilev2017-07-011-1/+1
| | | | | | | | | | In C mode clang fails to merge the textually included definition with the one imported from a module. The C lookup rules fail to find the imported definition because its linkage is internal in non C++ mode. This patch reinstates some of the ODR merging rules for typedefs of anonymous tags for languages other than C++. Patch by Raphael Isemann and me (D34510). llvm-svn: 306964
* Change enumerator default linkage type for CBruno Cardoso Lopes2017-07-011-1/+1
| | | | | | | | | | | | | | | Redeclaration lookup should never find hidden enumerators in C, because they do not have linkage (C11 6.2.2/6) The linkage of an enumerator should be VisibleNoLinkage, and isHiddenDeclarationVisible should be checking hasExternalFormalLinkage. This is was reviewed as part of D31778, but splitted into a different commit for clarity. rdar://problem/31909368 llvm-svn: 306917
OpenPOWER on IntegriCloud