Index.h (200583) | Index.h (201361) |
---|---|
1/*===-- clang-c/Index.h - Indexing Public C Interface -------------*- C -*-===*\ 2|* *| 3|* The LLVM Compiler Infrastructure *| 4|* *| 5|* This file is distributed under the University of Illinois Open Source *| 6|* License. See LICENSE.TXT for details. *| 7|* *| 8|*===----------------------------------------------------------------------===*| 9|* *| 10|* This header provides a public inferface to a Clang library for extracting *| 11|* high-level symbol information from source files without exposing the full *| 12|* Clang C++ API. *| 13|* *| 14\*===----------------------------------------------------------------------===*/ 15 16#ifndef CLANG_C_INDEX_H 17#define CLANG_C_INDEX_H 18 19#include <sys/stat.h> | 1/*===-- clang-c/Index.h - Indexing Public C Interface -------------*- C -*-===*\ 2|* *| 3|* The LLVM Compiler Infrastructure *| 4|* *| 5|* This file is distributed under the University of Illinois Open Source *| 6|* License. See LICENSE.TXT for details. *| 7|* *| 8|*===----------------------------------------------------------------------===*| 9|* *| 10|* This header provides a public inferface to a Clang library for extracting *| 11|* high-level symbol information from source files without exposing the full *| 12|* Clang C++ API. *| 13|* *| 14\*===----------------------------------------------------------------------===*/ 15 16#ifndef CLANG_C_INDEX_H 17#define CLANG_C_INDEX_H 18 19#include <sys/stat.h> |
20#include <time.h> |
|
20 21#ifdef __cplusplus 22extern "C" { 23#endif 24 25/* MSVC DLL import/export. */ 26#ifdef _MSC_VER 27 #ifdef _CINDEX_LIB_ --- 522 unchanged lines hidden (view full) --- 550 CXCompletionChunk_LeftAngle, 551 /** 552 * \brief A right angle bracket ('>'). 553 */ 554 CXCompletionChunk_RightAngle, 555 /** 556 * \brief A comma separator (','). 557 */ | 21 22#ifdef __cplusplus 23extern "C" { 24#endif 25 26/* MSVC DLL import/export. */ 27#ifdef _MSC_VER 28 #ifdef _CINDEX_LIB_ --- 522 unchanged lines hidden (view full) --- 551 CXCompletionChunk_LeftAngle, 552 /** 553 * \brief A right angle bracket ('>'). 554 */ 555 CXCompletionChunk_RightAngle, 556 /** 557 * \brief A comma separator (','). 558 */ |
558 CXCompletionChunk_Comma | 559 CXCompletionChunk_Comma, 560 /** 561 * \brief Text that specifies the result type of a given result. 562 * 563 * This special kind of informative chunk is not meant to be inserted into 564 * the text buffer. Rather, it is meant to illustrate the type that an 565 * expression using the given completion string would have. 566 */ 567 CXCompletionChunk_ResultType |
559}; | 568}; |
560 561/** 562 * \brief Callback function that receives a single code-completion result. 563 * 564 * This callback will be invoked by \c clang_codeComplete() for each 565 * code-completion result. 566 * 567 * \param completion_result a pointer to the current code-completion result, 568 * providing one possible completion. The pointer itself is only valid 569 * during the execution of the completion callback. 570 * 571 * \param client_data the client data provided to \c clang_codeComplete(). 572 */ 573typedef void (*CXCompletionIterator)(CXCompletionResult *completion_result, 574 CXClientData client_data); | |
575 576/** 577 * \brief Determine the kind of a particular chunk within a completion string. 578 * 579 * \param completion_string the completion string to query. 580 * 581 * \param chunk_number the 0-based index of the chunk in the completion string. 582 * --- 35 unchanged lines hidden (view full) --- 618 619/** 620 * \brief Retrieve the number of chunks in the given code-completion string. 621 */ 622CINDEX_LINKAGE unsigned 623clang_getNumCompletionChunks(CXCompletionString completion_string); 624 625/** | 569 570/** 571 * \brief Determine the kind of a particular chunk within a completion string. 572 * 573 * \param completion_string the completion string to query. 574 * 575 * \param chunk_number the 0-based index of the chunk in the completion string. 576 * --- 35 unchanged lines hidden (view full) --- 612 613/** 614 * \brief Retrieve the number of chunks in the given code-completion string. 615 */ 616CINDEX_LINKAGE unsigned 617clang_getNumCompletionChunks(CXCompletionString completion_string); 618 619/** |
620 * \brief Contains the results of code-completion. 621 * 622 * This data structure contains the results of code completion, as 623 * produced by \c clang_codeComplete. Its contents must be freed by 624 * \c clang_disposeCodeCompleteResults. 625 */ 626typedef struct { 627 /** 628 * \brief The code-completion results. 629 */ 630 CXCompletionResult *Results; 631 632 /** 633 * \brief The number of code-completion results stored in the 634 * \c Results array. 635 */ 636 unsigned NumResults; 637} CXCodeCompleteResults; 638 639/** |
|
626 * \brief Perform code completion at a given location in a source file. 627 * 628 * This function performs code completion at a particular file, line, and 629 * column within source code, providing results that suggest potential 630 * code snippets based on the context of the completion. The basic model 631 * for code completion is that Clang will parse a complete source file, 632 * performing syntax checking up to the location where code-completion has 633 * been requested. At that point, a special code-completion token is passed 634 * to the parser, which recognizes this token and determines, based on the 635 * current location in the C/Objective-C/C++ grammar and the state of 636 * semantic analysis, what completions to provide. These completions are | 640 * \brief Perform code completion at a given location in a source file. 641 * 642 * This function performs code completion at a particular file, line, and 643 * column within source code, providing results that suggest potential 644 * code snippets based on the context of the completion. The basic model 645 * for code completion is that Clang will parse a complete source file, 646 * performing syntax checking up to the location where code-completion has 647 * been requested. At that point, a special code-completion token is passed 648 * to the parser, which recognizes this token and determines, based on the 649 * current location in the C/Objective-C/C++ grammar and the state of 650 * semantic analysis, what completions to provide. These completions are |
637 * enumerated through a callback interface to the client. | 651 * returned via a new \c CXCodeCompleteResults structure. |
638 * 639 * Code completion itself is meant to be triggered by the client when the 640 * user types punctuation characters or whitespace, at which point the 641 * code-completion location will coincide with the cursor. For example, if \c p 642 * is a pointer, code-completion might be triggered after the "-" and then 643 * after the ">" in \c p->. When the code-completion location is afer the ">", 644 * the completion results will provide, e.g., the members of the struct that 645 * "p" points to. The client is responsible for placing the cursor at the 646 * beginning of the token currently being typed, then filtering the results 647 * based on the contents of the token. For example, when code-completing for 648 * the expression \c p->get, the client should provide the location just after 649 * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the 650 * client can filter the results based on the current token text ("get"), only 651 * showing those results that start with "get". The intent of this interface | 652 * 653 * Code completion itself is meant to be triggered by the client when the 654 * user types punctuation characters or whitespace, at which point the 655 * code-completion location will coincide with the cursor. For example, if \c p 656 * is a pointer, code-completion might be triggered after the "-" and then 657 * after the ">" in \c p->. When the code-completion location is afer the ">", 658 * the completion results will provide, e.g., the members of the struct that 659 * "p" points to. The client is responsible for placing the cursor at the 660 * beginning of the token currently being typed, then filtering the results 661 * based on the contents of the token. For example, when code-completing for 662 * the expression \c p->get, the client should provide the location just after 663 * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the 664 * client can filter the results based on the current token text ("get"), only 665 * showing those results that start with "get". The intent of this interface |
652 * is to separate the relatively high-latency acquisition of code-competion | 666 * is to separate the relatively high-latency acquisition of code-completion |
653 * results from the filtering of results on a per-character basis, which must 654 * have a lower latency. 655 * 656 * \param CIdx the \c CXIndex instance that will be used to perform code 657 * completion. 658 * 659 * \param source_filename the name of the source file that should be parsed to 660 * perform code-completion. This source file must be the same as or include the --- 24 unchanged lines hidden (view full) --- 685 * code-completion results for a header. 686 * 687 * \param complete_line the line at which code-completion should occur. 688 * 689 * \param complete_column the column at which code-completion should occur. 690 * Note that the column should point just after the syntactic construct that 691 * initiated code completion, and not in the middle of a lexical token. 692 * | 667 * results from the filtering of results on a per-character basis, which must 668 * have a lower latency. 669 * 670 * \param CIdx the \c CXIndex instance that will be used to perform code 671 * completion. 672 * 673 * \param source_filename the name of the source file that should be parsed to 674 * perform code-completion. This source file must be the same as or include the --- 24 unchanged lines hidden (view full) --- 699 * code-completion results for a header. 700 * 701 * \param complete_line the line at which code-completion should occur. 702 * 703 * \param complete_column the column at which code-completion should occur. 704 * Note that the column should point just after the syntactic construct that 705 * initiated code completion, and not in the middle of a lexical token. 706 * |
693 * \param completion_iterator a callback function that will receive 694 * code-completion results. 695 * 696 * \param client_data client-specific data that will be passed back via the 697 * code-completion callback function. | 707 * \returns if successful, a new CXCodeCompleteResults structure 708 * containing code-completion results, which should eventually be 709 * freed with \c clang_disposeCodeCompleteResults(). If code 710 * completion fails, returns NULL. |
698 */ | 711 */ |
699CINDEX_LINKAGE void clang_codeComplete(CXIndex CIdx, 700 const char *source_filename, 701 int num_command_line_args, 702 const char **command_line_args, 703 unsigned num_unsaved_files, 704 struct CXUnsavedFile *unsaved_files, 705 const char *complete_filename, 706 unsigned complete_line, 707 unsigned complete_column, 708 CXCompletionIterator completion_iterator, 709 CXClientData client_data); 710 | 712CINDEX_LINKAGE 713CXCodeCompleteResults *clang_codeComplete(CXIndex CIdx, 714 const char *source_filename, 715 int num_command_line_args, 716 const char **command_line_args, 717 unsigned num_unsaved_files, 718 struct CXUnsavedFile *unsaved_files, 719 const char *complete_filename, 720 unsigned complete_line, 721 unsigned complete_column); |
711 | 722 |
723/** 724 * \brief Free the given set of code-completion results. 725 */ 726CINDEX_LINKAGE 727void clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results); 728 |
|
712#ifdef __cplusplus 713} 714#endif 715#endif 716 | 729#ifdef __cplusplus 730} 731#endif 732#endif 733 |