summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CXCursor.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace TypeLoc llvm::cast support to be well-defined.David Blaikie2013-02-181-1/+1
| | | | | | | | | | | | | | The TypeLoc hierarchy used the llvm::cast machinery to perform undefined behavior by casting pointers/references to TypeLoc objects to derived types and then using the derived copy constructors (or even returning pointers to derived types that actually point to the original TypeLoc object). Some context is in this thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html Though it's spread over a few months which can be hard to read in the mail archive. llvm-svn: 175462
* libclang: remove reinterpret_casts by using SourceLocation::getPtrEncodingDmitri Gribenko2013-02-161-14/+14
| | | | llvm-svn: 175333
* libclang: remove reinterpret_casts by using SourceLocation::getFromPtrEncodingDmitri Gribenko2013-02-141-24/+12
| | | | | | directly instead of casting a pointer to an integer llvm-svn: 175206
* Allow the computation of the base priority for a declaration code completion ↵Douglas Gregor2013-01-311-1/+1
| | | | | | result to consider the completion context llvm-svn: 174037
* libclang: factor out the frequent pattern static_cast<ASTUnit *>(TU->TUData)Dmitri Gribenko2013-01-261-1/+1
| | | | | | into a getter cxtu::getASTUnit(TU) llvm-svn: 173585
* libclang: make getCursorParentDecl() return 'const Decl *'Dmitri Gribenko2013-01-261-2/+2
| | | | llvm-svn: 173584
* libclang: change getCursorAttr() to return 'const Attr *'Dmitri Gribenko2013-01-261-2/+2
| | | | llvm-svn: 173583
* libclang: make getCursorStmt() and getCursorExpr() return const pointersDmitri Gribenko2013-01-261-6/+7
| | | | | | Also change EnqueueVisitor to use ConstStmtVisitor as a consequence. llvm-svn: 173577
* libclang: change return type of getCursorDecl() to 'const Decl *'Dmitri Gribenko2013-01-231-10/+10
| | | | llvm-svn: 173278
* Explicitly cast away the const-ness instead of doing it implicitly.Bill Wendling2013-01-231-4/+4
| | | | llvm-svn: 173241
* libclang: remove a few const_castsDmitri Gribenko2013-01-141-3/+3
| | | | llvm-svn: 172373
* Constify argument of Preprocessor::getMacroInfoHistory and propagate toDmitri Gribenko2013-01-141-1/+1
| | | | | | callers, removing unneeded const_cast llvm-svn: 172372
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-1/+1
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* libclang: remove unneeded castsDmitri Gribenko2013-01-111-9/+9
| | | | llvm-svn: 172253
* libclang: change CXCursor to store 'const void *' pointers forDmitri Gribenko2013-01-111-33/+36
| | | | | | const-correctness, and update all users llvm-svn: 172252
* libclang: use getCursorTU and getCursorASTUnit instead of explicit castsDmitri Gribenko2013-01-111-1/+1
| | | | llvm-svn: 172241
* [libclang] When getting the cursor for an identifier inside a macro ↵Argyrios Kyrtzidis2013-01-071-3/+22
| | | | | | | | | | | | | | | definition, check if this was ever a macro name and return a specific CXCursor_MacroExpansion cursor in such a case, instead of the generic CXCursor_MacroDefinition. Checking for macro name makes sure the identifier is not part of the identifier list in a function macro. While, in general, resolving identifiers in macro definitions to other macros may not be completely accurate, it greatly improves functionality such as give-me-the-definition-of-this, which was not working at all inside macro definitions. llvm-svn: 171773
* Sort #include lines for tools/...Chandler Carruth2012-12-041-3/+3
| | | | | | Completely automated with sort_includes.py llvm-svn: 169240
* [libclang] Introduce clang_Cursor_getReceiverType which returns the CXType forArgyrios Kyrtzidis2012-11-011-0/+13
| | | | | | | | the receiver of an ObjC message expression. rdar://12578643 llvm-svn: 167201
* 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
OpenPOWER on IntegriCloud