summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CXCursor.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Move the logic that searches for overridden methods from libclang toArgyrios Kyrtzidis2012-10-091-180/+6
| | | | | | ASTContext so that it can be widely available. llvm-svn: 165473
* PR13811: Add a FunctionParmPackExpr node to handle references to functionRichard Smith2012-09-121-0/+1
| | | | | | | parameter packs where the reference is not being expanded but the pack has been. Previously, Clang would segfault in such cases. llvm-svn: 163672
* Revert r163099 per chandlerc's request.Joao Matos2012-09-041-4/+0
| | | | llvm-svn: 163147
* Added a new cursor for SEHLeaveStmt to libclang.Joao Matos2012-09-031-0/+4
| | | | llvm-svn: 163099
* [ms-inline asm] As part of a larger refactoring, rename AsmStmt to GCCAsmStmt.Chad Rosier2012-08-251-2/+2
| | | | | | No functional change intended. llvm-svn: 162632
* [libclang] Introduce clang_Cursor_isDynamicCall which,Argyrios Kyrtzidis2012-07-021-1/+26
| | | | | | | | | | | | | given a cursor pointing to a C++ method call or an ObjC message, returns non-zero if the method/message is "dynamic", meaning: For a C++ method: the call is virtual. For an ObjC message: the receiver is an object instance, not 'super' or a specific class. rdar://11779185 llvm-svn: 159627
* Add a new libclang completion API to get brief documentation comment that isDmitri Gribenko2012-07-021-2/+4
| | | | | | | | | | | | | | | | attached to a declaration in the completion string. Since extracting comments isn't free, a new code completion option is introduced. A new code completion option that enables including brief comments into CodeCompletionString should be a, err, code completion option. But because ASTUnit caches global declarations during parsing before even completion consumer is created, the option is duplicated as a translation unit option (in both libclang and ASTUnit, like the option to cache code completion results). llvm-svn: 159539
* Etch out the code path for MS-style inline assembly.Chad Rosier2012-06-111-0/+4
| | | | llvm-svn: 158325
* [AST/libclang] Speed up clang_getOverriddenCursors() considerably by ↵Argyrios Kyrtzidis2012-05-091-21/+81
| | | | | | | | | | | | | reserving a bit in ObjCMethodDecl to indicate whether the method does not override any other method, which is the majority of cases. That way we can avoid unnecessary work doing lookups, especially when PCH is involved. rdar://11360082 llvm-svn: 156476
* Fix C versus C++ linkage issue.Ted Kremenek2012-04-301-1/+3
| | | | llvm-svn: 155842
* Reduce malloc() traffic of clang_getOverridenCursors() by using a pool of ↵Ted Kremenek2012-04-301-2/+101
| | | | | | | | | | SmallVector<CXCursor> objects under the covers. Fixes <rdar://problem/11289160>. llvm-svn: 155841
* Implements boxed expressions for Objective-C. <rdar://problem/10194391>Patrick Beard2012-04-191-1/+1
| | | | llvm-svn: 155082
* Add an AttributedStmt type to represent a statement with C++11 attributesRichard Smith2012-04-141-5/+9
| | | | | | | | | attached. Since we do not support any attributes which appertain to a statement (yet), testing of this is necessarily quite minimal. Patch by Alexander Kornienko! llvm-svn: 154723
* [libclang] Introduce a couple of functions to make it convenientArgyrios Kyrtzidis2012-04-111-0/+29
| | | | | | | | | | | to get at the parameters (and their types) of a function or objc method cursor. int clang_Cursor_getNumArguments(CXCursor C); CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i); rdar://11201527 llvm-svn: 154523
* [libclang] For clang_getOverriddenCursors make sure to report overridden ↵Argyrios Kyrtzidis2012-04-101-16/+36
| | | | | | | | objc methods for methods in categories of super classes. rdar://11220358 llvm-svn: 154436
* [code-complete] Introduce CodeCompletionTUInfo which will be used for cachingArgyrios Kyrtzidis2012-04-101-6/+4
| | | | | | | | | | | | | | | | | | | code-completion related strings specific to a translation unit (ASTContext and related data) CodeCompletionAllocator does such limited caching, by caching the name assigned to a DeclContext*, but that is not the appropriate place since that object has a lifetime that can extend beyond that of an ASTContext. Introduce CodeCompletionTUInfo which will be always tied to a translation unit to do this kind of caching and move the caching of CodeCompletionAllocator into this object, and propagate it to all the places where it will be needed. The plan is to extend the caching where appropriate, using CodeCompletionTUInfo, to avoid re-calculating code-completion strings. Part of rdar://10796159. llvm-svn: 154408
* Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall2012-03-101-1/+0
| | | | | | | | track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
* [libclang] Enhance clang_getOverriddenCursors.Argyrios Kyrtzidis2012-03-081-19/+44
| | | | | | | | | | | | | | | | | | | | | | | | Basically the current design is: -for an implementation method, show as overridden the interface method. This is not useful, and is inconsistent with the C++ side -for an interface method, show as overridden the protocols methods (this is desirable) and the methods from the categories; methods from categories are not useful since they are considered the same method (same USR). -If there is a protocol method or category method reported, it does not check the super class for overridden methods. This is really problematic since overridden methods from super class is what we want to give back. Change clang_getOverriddenCursors to show as overridden any method in the class's base class, its protocols, or its categories' protocols, that has the same selector and is of the same kind (class or instance). If no such method exists, the search continues to the class's superclass, its protocols, and its categories, and so on. A method from an Objective-C implementation is considered to override the same methods as its corresponding method in the interface. rdar://10967206 llvm-svn: 152270
* AST representation for user-defined literals, plus just enough of semanticRichard Smith2012-03-071-0/+1
| | | | | | | | | | | | | | | | | | | | | analysis to make the AST representation testable. They are represented by a new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic properties, including full CodeGen support, are achieved for free by this representation. UserDefinedLiterals can never be dependent, so no custom instantiation behavior is required. They are mangled as if they were direct calls to the underlying literal operator. This matches g++'s apparent behavior (but not its actual mangling, which is broken for literal-operator-ids). User-defined *string* literals are now fully-operational, but the semantic analysis is quite hacky and needs more work. No other forms of user-defined literal are created yet, but the AST support for them is present. This patch committed after midnight because we had already hit the quota for new kinds of literal yesterday. llvm-svn: 152211
* And libclang cursor/indexing support for new Objective-C ↵Ted Kremenek2012-03-061-1/+9
| | | | | | NSArray/NSDictionary/NSNumber literals. llvm-svn: 152138
* Implement a new type trait __is_trivially_constructible(T, Args...)Douglas Gregor2012-02-241-0/+1
| | | | | | | | | | | | | | | | that provides the behavior of the C++11 library trait std::is_trivially_constructible<T, Args...>, which can't be implemented purely as a library. Since __is_trivially_constructible can have zero or more arguments, I needed to add Yet Another Type Trait Expression Class, this one handling arbitrary arguments. The next step will be to migrate UnaryTypeTrait and BinaryTypeTrait over to this new, more general TypeTrait class. Fixes the Clang side of <rdar://problem/10895483> / PR12038. llvm-svn: 151352
* Implement indexing support for lambdas in libclang (both kinds), asDouglas Gregor2012-02-151-1/+21
| | | | | | | well as improving the RecursiveASTVisitor's walk of lambda expressions. llvm-svn: 150549
* Introduce basic ASTs for lambda expressions. This covers:Douglas Gregor2012-02-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | - Capturing variables by-reference and by-copy within a lambda - The representation of lambda captures - The creation of the non-static data members in the lambda class that store the captured variables - The initialization of the non-static data members from the captured variables - Pretty-printing lambda expressions There are a number of FIXMEs, both explicit and implied, including: - Creating a field for a capture of 'this' - Improved diagnostics for initialization failures when capturing variables by copy - Dealing with temporaries created during said initialization - Template instantiation - AST (de-)serialization - Binding and returning the lambda expression; turning it into a proper temporary - Lots and lots of semantic constraints - Parameter pack captures llvm-svn: 149977
* [libclang] Make clang_getCursorCompletionString not depend on the ASTUnit havingArgyrios Kyrtzidis2012-01-171-18/+16
| | | | | | | | a Sema. This allows it to work when Sema is not available, like when loading AST files. llvm-svn: 148279
* [libclang] Add defensive checks to make sure we don't try to dereferenceArgyrios Kyrtzidis2011-12-101-2/+1
| | | | | | a null pointer after getCursorDecl() is called. rdar://10298421. llvm-svn: 146312
* [libclang] Make sure we don't try to handle a CXCursor_NoDeclFoundArgyrios Kyrtzidis2011-12-091-2/+4
| | | | | | passed to clang_findReferencesInFile. llvm-svn: 146211
* [libclang] API enhancements by Joe Groff!Argyrios Kyrtzidis2011-12-061-0/+1
| | | | | | | | | | | | | - Exposes a CXType_Vector type kind for vector types. - Adds generalized versions of the clang_getArrayElementType and clang_getArraySize functions, named clang_getElementType and clang_getNumElements, which work on array, vector, or complex types. - Adds additional functions for querying function types. clang_isFunctionTypeVariadic returns true if a function type is variadic. clang_getFunctionCallingConv returns an enumeration value indicating the calling convention of the function type. clang_getNumArgTypes returns the number of static argument types, and clang_getArgType gets the type of an argument. - Adds a clang_getTypedefDeclUnderlyingType function to get the underlying type from a TypedefDecl cursor. - Adds a clang_getEnumDeclIntegerType function to get the integer type from an EnumDecl cursor. - Adds clang_getEnumConstantDeclValue and clang_getEnumConstantDeclUnsignedValue functions to get the value of an EnumConstantDecl as a signed or unsigned long long, respectively. - Exposes a CXCursor_AsmLabelAttr cursor kind for __asm__("label") attributes. - Alters clang_getCursorSpelling to return the label value for AsmLabelAttr-kind cursors. llvm-svn: 145972
* [libclang] Indexing API: Support C++ symbols.Argyrios Kyrtzidis2011-11-221-2/+2
| | | | llvm-svn: 145058
* [libclang] Indexing API:Argyrios Kyrtzidis2011-11-181-6/+7
| | | | | | | | | -For indexDeclaration, also pass the declaration attributes as an array of cursors. -Rename CXIndexOpt_OneRefPerFile -> CXIndexOpt_SuppressRedundantRefs, and only pass a reference if a declaration/definition does not exist in the file. -Other fixes. llvm-svn: 144942
* Change the AST representation of operations on Objective-CJohn McCall2011-11-061-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | property references to use a new PseudoObjectExpr expression which pairs a syntactic form of the expression with a set of semantic expressions implementing it. This should significantly reduce the complexity required elsewhere in the compiler to deal with these kinds of expressions (e.g. IR generation's special l-value kind, the static analyzer's Message abstraction), at the lower cost of specifically dealing with the odd AST structure of these expressions. It should also greatly simplify efforts to implement similar language features in the future, most notably Managed C++'s properties and indexed properties. Most of the effort here is in dealing with the various clients of the AST. I've gone ahead and simplified the ObjC rewriter's use of properties; other clients, like IR-gen and the static analyzer, have all the old complexity *and* all the new complexity, at least temporarily. Many thanks to Ted for writing and advising on the necessary changes to the static analyzer. I've xfailed a small diagnostics regression in the static analyzer at Ted's request. llvm-svn: 143867
* Implement support for dependent Microsoft __if_exists/__if_not_existsDouglas Gregor2011-10-251-1/+6
| | | | | | | | | | statements. As noted in the documentation for the AST node, the semantics of __if_exists/__if_not_exists are somewhat different from the way Visual C++ implements them, because our parsed-template representation can't accommodate VC++ semantics without serious contortions. Hopefully this implementation is "good enough". llvm-svn: 142901
* [libclang] Introduce a new high level API for indexing clients that assumesArgyrios Kyrtzidis2011-10-171-7/+7
| | | | | | | | | more of the work involved in indexing a translation unit and simplifies client implementations. Only C/ObjC for now, C++ (and comments) to come. llvm-svn: 142233
* Allow for annotate attributes after access specifiers. When suchErik Verbruggen2011-10-131-0/+1
| | | | | | attributes are found, propagate them to subsequent declarations. llvm-svn: 141861
* Initial implementation of __atomic_* (everything except __atomic_is_lock_free).Eli Friedman2011-10-111-0/+1
| | | | llvm-svn: 141632
* [libclang] Introduce clang_findReferencesInFile which accepts a cursor, a file,Argyrios Kyrtzidis2011-10-061-25/+140
| | | | | | | | and a callback and finds all identifier references of the cursor in the file. rdar://7948304 llvm-svn: 141277
* [libclang] Move the bulk of clang_getOverriddenCursors intoArgyrios Kyrtzidis2011-10-061-0/+86
| | | | | | | a cxcursor::getOverriddenCursors C++ function, because SmallVectors are groovier that malloc'ing buffers. llvm-svn: 141276
* Expose more statement, expression, and declaration kinds in libclang,Douglas Gregor2011-10-051-95/+291
| | | | | | from Manuel Holtgrewe! llvm-svn: 141200
* MSVC is stuck in the 80s.Argyrios Kyrtzidis2011-09-271-0/+8
| | | | llvm-svn: 140597
* [libclang] Introduce clang_Cursor_isNull and clang_Cursor_getTranslationUnit ↵Argyrios Kyrtzidis2011-09-271-0/+8
| | | | | | functions. llvm-svn: 140587
* Don't map a file:line:col triplet that is inside the preamble range toArgyrios Kyrtzidis2011-09-261-1/+3
| | | | | | | | | | | | | | 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
* [libclang]Argyrios Kyrtzidis2011-09-131-0/+2
| | | | | | | | -Allow cursor visitation of an attribute using its source range -Add C++ 'final' and 'override' attributes as cursor kinds -Simplify the logic that marks 'final' and 'override' attributes as tokens. llvm-svn: 139609
* Switch a C-style cast over to a const_cast. No functionality changeDouglas Gregor2011-08-101-1/+1
| | | | llvm-svn: 137218
* Add a new libclang API to return a CXCompletionString for an arbitraryDouglas Gregor2011-08-041-0/+36
| | | | | | cursor, from Connor Wakamo! Addresses <rdar://problem/9087798>. llvm-svn: 136911
* Create a new expression node, SubstNonTypeTemplateParmExpr,John McCall2011-07-151-0/+1
| | | | | | | | to represent a fully-substituted non-type template parameter. This should improve source fidelity, as well as being generically useful for diagnostics and such. llvm-svn: 135243
* Update all of the libclang code corresponding to the preprocessorChandler Carruth2011-07-141-2/+2
| | | | | | | | | | | | | | 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
* Move the rest of the preprocessor terminology from 'instantiate' andChandler Carruth2011-07-141-4/+4
| | | | | | | | | | | | | variants to 'expand'. This changed a couple of public APIs, including one public type "MacroInstantiation" which is now "MacroExpansion". The rest of the codebase was updated to reflect this, especially the libclang code. Two of the C++ (and thus easily changed) libclang APIs were updated as well because they pertained directly to the old MacroInstantiation class. No functionality changed. llvm-svn: 135139
* [libclang] Introduce cxcursor::getCursorParentDecl(CXCursor Cursor) and use ↵Argyrios Kyrtzidis2011-06-291-0/+4
| | | | | | | | it at the appropriate place in CIndex.cpp No functionality change. llvm-svn: 134104
* Introduce a new AST node describing reference binding to temporaries.Douglas Gregor2011-06-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | MaterializeTemporaryExpr captures a reference binding to a temporary value, making explicit that the temporary value (a prvalue) needs to be materialized into memory so that its address can be used. The intended AST invariant here is that a reference will always bind to a glvalue, and MaterializeTemporaryExpr will be used to convert prvalues into glvalues for that binding to happen. For example, given const int& r = 1.0; The initializer of "r" will be a MaterializeTemporaryExpr whose subexpression is an implicit conversion from the double literal "1.0" to an integer value. IR generation benefits most from this new node, since it was previously guessing (badly) when to materialize temporaries for the purposes of reference binding. There are likely more refactoring and cleanups we could perform there, but the introduction of MaterializeTemporaryExpr fixes PR9565, a case where IR generation would effectively bind a const reference directly to a bitfield in a struct. Addresses <rdar://problem/9552231>. llvm-svn: 133521
* Automatic Reference Counting.John McCall2011-06-151-1/+4
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Add support for builtin astype:Tanya Lattner2011-06-041-0/+1
| | | | | | | __builtin_astype(): Used to reinterpreted as another data type of the same size using for both scalar and vector data types. Added test case. llvm-svn: 132612
OpenPOWER on IntegriCloud