summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CIndex.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix array_pod_sort predicates after LLVM change.Benjamin Kramer2013-09-221-12/+3
| | | | llvm-svn: 191176
* Remove unnecessary inclusion of Sema.hDavid Blaikie2013-09-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let me tell you a tale... Within some twisted maze of debug info I've ended up implementing an insane man's Include What You Use device. When the debugger emits debug info it really shouldn't, I find out why & then realize the code could be improved too. In this instance CIndexDiagnostics.cpp had a lot more debug info with Clang than GCC. Upon inspection a major culprit was all the debug info describing clang::Sema. This was emitted because clang::Sema is befriended by DiagnosticEngine which was rightly required, but GCC doesn't emit debug info for friends so it never emitted anything for Clang. Clang does emit debug info for friends (will be fixed/changed to reduce debug info size). But why didn't Clang just emit a declaration of Sema if this entire TU didn't require a definition? 1) Diagnostic.h did the right thing, only using a declaration of Sema and not including Sema.h at all. 2) Some other dependency of CIndexDiagnostics.cpp didn't do the right thing. ASTUnit.h, only needing a declaration, still included Sema.h (hence this commit which removes that include and adds the necessary includes to the cpp files that were relying on this) 3) -flimit-debug-info didn't save us because of EnterExpressionEvaluationContext, defined inline in Sema.h which fires the "requiresCompleteType" check/flag (since it uses nested types from Sema and calls Sema member functions) and thus, if debug info is ever emitted for the type, the whole type is emitted and not just a declaration. Improving -flimit-debug-info to account for this would be... hard. Modifying the code so that's not 'required to be complete' might be possible, but probably only by moving EnterExpressionEvaluationContext either into Sema, or out of Sema.h. That might be a bit too much of a contortion to be bothered with. Also, this is only one of the cases where emitting debug info for friends caused us to emit a lot more debug info (this change reduces Clang's DWO size by 0.93%, dropping friends entirely reduces debug info by 3.2%) - I haven't hunted down the other cases, but I assume they might be similar (Sema or something like it). IWYU or a similar tool might help us reduce build times a bit, but analyzing debug info to find these differences isn't worthwhile. I'll take the 3.2% win, provide this small improvement to the code itself, and move on. llvm-svn: 190715
* OpenMP: Data-sharing attributes analysis and clause 'shared' (fixed test ↵Alexey Bataev2013-09-061-0/+3
| | | | | | threadprivate_messages.cpp) llvm-svn: 190183
* Remove unused typedef.Eric Christopher2013-09-031-1/+0
| | | | llvm-svn: 189844
* Revert "OpenMP: Data-sharing attributes analysis and clause 'shared'"Rafael Espindola2013-09-031-3/+0
| | | | | | | | This reverts commit r189795. threadprivate_messages.cpp is faling on windows. llvm-svn: 189811
* OpenMP: Data-sharing attributes analysis and clause 'shared'Alexey Bataev2013-09-031-0/+3
| | | | llvm-svn: 189795
* Use pop_back_val() instead of both back() and pop_back().Robert Wilhelm2013-08-231-2/+1
| | | | | | No functionality change intended. llvm-svn: 189112
* Added source locs for angled parentheses in class/var template partial specs.Enea Zaffanella2013-08-101-2/+3
| | | | llvm-svn: 188134
* Started implementing variable templates. Top level declarations should be ↵Larisse Voufo2013-08-061-1/+10
| | | | | | fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention... llvm-svn: 187762
* Use llvm::sys::fs::UniqueID for windows and unix.Rafael Espindola2013-08-011-6/+3
| | | | | | | | | | | | | | | | | | | This unifies the unix and windows versions of FileManager::UniqueDirContainer and FileManager::UniqueFileContainer by using UniqueID. We cannot just replace "struct stat" with llvm::sys::fs::file_status, since we want to be able to construct fake ones, and file_status has different members on unix and windows. What the patch does is: * Record only the information that clang is actually using. * Use llvm::sys::fs::status instead of stat and fstat. * Use llvm::sys::fs::UniqueID * Delete the old windows versions of UniqueDirContainer and UniqueFileContainer since the "unix" one now works on windows too. llvm-svn: 187619
* OpenMP: basic support for #pragma omp parallelAlexey Bataev2013-07-191-0/+52
| | | | llvm-svn: 186647
* [libclang] Introduce clang_Cursor_isObjCOptional, which returns whether the ↵Argyrios Kyrtzidis2013-07-051-0/+13
| | | | | | | | declaration was affected by "@optional" rdar://14348525. llvm-svn: 185722
* Use SmallVectorImpl instead of SmallVector for iterators and references to ↵Craig Topper2013-07-041-2/+2
| | | | | | avoid specifying the vector size unnecessarily. llvm-svn: 185610
* [AST] Introduce a new DecayedType sugar nodeReid Kleckner2013-06-241-0/+4
| | | | | | | | | | | | | | The goal of this sugar node is to be able to look at an arbitrary FunctionType and tell if any of the parameters were decayed from an array or function type. Ultimately this is necessary to implement Microsoft's C++ name mangling scheme, which mangles decayed arrays differently from normal pointers. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1014 llvm-svn: 184763
* [libclang] When annotating tokens, don't override a property annotation with ↵Argyrios Kyrtzidis2013-06-041-0/+5
| | | | | | | | a getter/setter method annotation. rdar://13764549 llvm-svn: 183242
* Fix linkage computation for derived types in inline functions.Rafael Espindola2013-05-251-1/+2
| | | | | | | | | | | | | | | | | John noticed that the fix for pr15930 (r181981) didn't handle indirect uses of local types. For example, a pointer to local struct, or a function that returns it. One way to implement this would be to recursively look for local types. This would look a lot like the linkage computation itself for types. To avoid code duplication and utilize the existing linkage cache, this patch just makes the computation of "type with no linkage but externally visible because it is from an inline function" part of the linkage computation itself. llvm-svn: 182711
* [libclang] Add logging for clang_createTranslationUnit.Argyrios Kyrtzidis2013-05-241-1/+5
| | | | llvm-svn: 182682
* libclang: add a function to check whether a member function is pure virtualDmitri Gribenko2013-05-171-0/+14
| | | | | | Patch by Seth Fowler. llvm-svn: 182139
* First pass of semantic analysis for init-captures: check the initializer, buildRichard Smith2013-05-161-2/+3
| | | | | | | | | | | | | a FieldDecl from it, and propagate both into the closure type and the LambdaExpr. You can't do much useful with them yet -- you can't use them within the body of the lambda, because we don't have a representation for "the this of the lambda, not the this of the enclosing context". We also don't have support or a representation for a nested capture of an init-capture yet, which was intended to work despite not being allowed by the current standard wording. llvm-svn: 181985
* Cleanup handling of UniqueExternalLinkage.Rafael Espindola2013-05-131-1/+1
| | | | | | | | | | | | | This patch renames getLinkage to getLinkageInternal. Only code that needs to handle UniqueExternalLinkage specially should call this. Linkage, as defined in the c++ standard, is provided by getFormalLinkage. It maps UniqueExternalLinkage to ExternalLinkage. Most places in the compiler actually want isExternallyVisible, which handles UniqueExternalLinkage as internal. llvm-svn: 181677
* [libclang] Add a null check in CursorVisitor::visitPreprocessedEntities.Argyrios Kyrtzidis2013-05-071-0/+3
| | | | | | rdar://13680583 llvm-svn: 181352
* [libclang] Introduce clang_Module_getASTFile function that returns the ↵Argyrios Kyrtzidis2013-04-261-0/+7
| | | | | | | | module file where a module object came from. rdar://13743084 llvm-svn: 180643
* [libclang] Introduce a CXCursor_ObjCSelfExpr cursor, which is the equivalent ↵Argyrios Kyrtzidis2013-04-231-0/+2
| | | | | | | | of CXCursor_CXXThisExpr for C++ code. rdar://13717006 llvm-svn: 180127
* [libclang] Introduce clang_Cursor_isVariadic, which returns non-zero if the ↵Argyrios Kyrtzidis2013-04-181-0/+13
| | | | | | | | given cursor is a variadic function or method. rdar://13667150 llvm-svn: 179819
* [libclang] Introduce clang_Cursor_getObjCDeclQualifiers, to query for 'ObjC ↵Argyrios Kyrtzidis2013-04-181-0/+24
| | | | | | | | | | Qualifiers' written next to the return and parameter types in an ObjC method declarations. rdar://13676977 llvm-svn: 179816
* [libclang] Introduce clang_Cursor_getObjCPropertyAttributes to query the ↵Argyrios Kyrtzidis2013-04-181-0/+29
| | | | | | | | written attributes in a property declaration. rdar://13684512 llvm-svn: 179803
* Sema for Captured StatementsTareq A. Siraj2013-04-161-0/+1
| | | | | | | | | | | | | Add CapturedDecl to be the DeclContext for CapturedStmt, and perform semantic analysis. Currently captures all variables by reference. TODO: templates Author: Ben Langmuir <ben.langmuir@intel.com> Differential Revision: http://llvm-reviews.chandlerc.com/D433 llvm-svn: 179618
* Basic support for Microsoft property declarations andJohn McCall2013-04-161-0/+1
| | | | | | | | references thereto. Patch by Tong Shen! llvm-svn: 179585
* [libclang] Fix cursor visitation to not ignore template arguments in ↵Argyrios Kyrtzidis2013-04-051-0/+14
| | | | | | | | out-of-line member functions. rdar://13535645 llvm-svn: 178911
* [libclang] Add some checks to make sure the given CXTranslationUnit is not ↵Argyrios Kyrtzidis2013-04-041-1/+7
| | | | | | null, before using it. llvm-svn: 178800
* Update the error handing static functions for r178161.Chad Rosier2013-03-271-1/+2
| | | | | | Part of rdar://13296693 llvm-svn: 178162
* [Preprocessor/Modules] Separate the macro directives kinds into their own ↵Argyrios Kyrtzidis2013-03-261-5/+7
| | | | | | | | | | | | | | | | MacroDirective's subclasses. For each macro directive (define, undefine, visibility) have a separate object that gets chained to the macro directive history. This has several benefits: -No need to mutate a MacroDirective when there is a undefine/visibility directive. Stuff like PPMutationListener become unnecessary. -No need to keep extra source locations for the undef/visibility locations for the define directive object (which is the majority of the directives) -Much easier to hide/unhide a section in the macro directive history. -Easier to track the effects of the directives across different submodules. llvm-svn: 178037
* OpenMP threadprivate directive parsing and semantic analysisAlexey Bataev2013-03-221-0/+1
| | | | llvm-svn: 177705
* [Modules] Resolve top-headers of modules lazily.Argyrios Kyrtzidis2013-03-131-7/+13
| | | | | | | | | | | This allows resolving top-header filenames of modules to FileEntries when we need them, not eagerly. Note that that this breaks ABI for libclang functions clang_Module_getTopLevelHeader / clang_Module_getNumTopLevelHeaders but this is fine because they are experimental and not widely used yet. llvm-svn: 176975
* [libclang] Modify clang_findReferencesInFile and clang_findIncludesInFile to ↵Argyrios Kyrtzidis2013-03-081-13/+18
| | | | | | | | | | | return a value. Possible values are: 1 : if a parameter was invalid -1 : if the callback returned CXVisit_Break, otherwise returns 0. llvm-svn: 176716
* [libclang] Add Logger::operator<< overloads for CXCursor and FileEntry.Argyrios Kyrtzidis2013-03-081-0/+12
| | | | llvm-svn: 176680
* [libclang] When logging a CXTranslationUnit that came from an AST file, ↵Argyrios Kyrtzidis2013-03-051-0/+2
| | | | | | print out the filename. llvm-svn: 176511
* Suppress -Wswitch to unbreak the build.David Blaikie2013-02-221-0/+1
| | | | | | | This may need to be fixed more intelligently - I don't have enough context to be sure what the appropriate fix is right now. llvm-svn: 175902
* Streamify getNameForDiagnostic and remove the string versions of ↵Benjamin Kramer2013-02-221-2/+2
| | | | | | PrintTemplateArgumentList. llvm-svn: 175894
* CIndex.cpp: Appease g++-4.4. "if (Optional<unsigned> Minor = In.getMinor())" ↵NAKAMURA Takumi2013-02-211-2/+4
| | | | | | did not work as expected. llvm-svn: 175711
* Use None rather than Optional<T>() where possible.David Blaikie2013-02-211-2/+2
| | | | llvm-svn: 175705
* Strip 'llvm' from 'llvm::Optional' uses.Ted Kremenek2013-02-211-7/+7
| | | | llvm-svn: 175701
* [preprocessor] Split the MacroInfo class into two separate concepts, ↵Argyrios Kyrtzidis2013-02-201-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | MacroInfo class for the data specific to a macro definition (e.g. what the tokens are), and MacroDirective class which encapsulates the changes to the "macro namespace" (e.g. the location where the macro name became active, the location where it was undefined, etc.) (A MacroDirective always points to a MacroInfo object.) Usually a macro definition (MacroInfo) is where a macro name becomes active (MacroDirective) but splitting the concepts allows us to better model the effect of modules to the macro namespace (also as a bonus it allows better modeling of push_macro/pop_macro #pragmas). Modules can have their own macro history, separate from the local (current translation unit) macro history; MacroDirectives will be used to model the macro history (changes to macro namespace). For example, if "@import A;" imports macro FOO, there will be a new local MacroDirective created to indicate that "FOO" became active at the import location. Module "A" itself will contain another MacroDirective in its macro history (at the point of the definition of FOO) and both MacroDirectives will point to the same MacroInfo object. Introducing the separation of macro concepts is the first part towards better modeling of module macros. llvm-svn: 175585
* Replace TypeLoc llvm::cast support to be well-defined.David Blaikie2013-02-181-9/+9
| | | | | | | | | | | | | | 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] Fix annotation of a range where the begin or end locationArgyrios Kyrtzidis2013-02-131-9/+23
| | | | | | | | | is inside a macro argument. Previously we would give up and not annotate anything in the range. rdar://11891550 llvm-svn: 175062
* [libclang] Attribute visitation happens out-of-source-order, make sureArgyrios Kyrtzidis2013-02-081-8/+23
| | | | | | | | | we annotate properly when there is an attribute and not skip type specs if the attribute is after the declaration. rdar://13129077 llvm-svn: 174689
* libclang: CursorVisitor::VisitBuiltinTypeLoc(): Add OCLSampler. [-Wswitch]NAKAMURA Takumi2013-02-071-0/+1
| | | | llvm-svn: 174606
* libclang: remove 'using namespace cxstring'Dmitri Gribenko2013-02-031-2/+1
| | | | llvm-svn: 174285
* libclang: remove unneeded const_castsDmitri Gribenko2013-02-031-3/+2
| | | | llvm-svn: 174280
* libclang: introduce cxstring::{createRef,createDup} for StringRefsDmitri Gribenko2013-02-021-33/+32
| | | | | | Also migrate all clients from the old API. llvm-svn: 174263
OpenPOWER on IntegriCloud