summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
...
* Convert a few classes over to use the new TrailingObjects helper.James Y Knight2015-08-062-58/+62
| | | | | | | | | | This initial commit serves as an example -- the remainder of the classes using pointer arithmetic for trailing objects will be converted in subsequent changes. Differential Revision: http://reviews.llvm.org/D11298 llvm-svn: 244262
* Remove unused 'Owned' flag from TemplateArgumentList.James Y Knight2015-08-061-1/+1
| | | | llvm-svn: 244261
* [OPENMP 4.1] Allow references in init expression for loop-based constructs.Alexey Bataev2015-08-061-0/+12
| | | | | | OpenMP 4.1 allows to use variables with reference types in private clauses and, therefore, in init expressions of the cannonical loop forms. llvm-svn: 244209
* [ObjC] Circular containers: add support of subclassesAlex Denisov2015-08-061-1/+21
| | | | llvm-svn: 244193
* Rename the non-coding style conformant functions in namespace BuiltinsEric Christopher2015-08-061-1/+1
| | | | | | to match the rest of their brethren and reformat the bits that need it. llvm-svn: 244186
* function_ref-ize ExternalASTSource::FindExternalLexicalDecl and remove itsRichard Smith2015-08-053-31/+10
| | | | | | | | useless return value. Switch to using it directly when completing the redeclaration chain for an anonymous declaration, and reduce the set of declarations that we load in the process to just those of the right kind. llvm-svn: 244161
* [AST] ArrayRefize template param list info setters. No functionality change ↵Benjamin Kramer2015-08-051-22/+14
| | | | | | intended. llvm-svn: 244028
* [AST] ArrayRefize BlockDecl::setCaptures. No functionality change intended.Benjamin Kramer2015-08-051-17/+8
| | | | llvm-svn: 244027
* [AST] ArrayRefize template argument packs. No functionality change intended.Benjamin Kramer2015-08-057-20/+16
| | | | llvm-svn: 244026
* [AST] Really allocate a SmallVector to the right size.Benjamin Kramer2015-08-041-2/+1
| | | | | | | | | | set_size only resets the end pointer and asserts if it is used to grow the buffer. This would crash when mangling a float with more than 80 bits, add a test with a ppc double double (128 bits). Found by inspection. llvm-svn: 243979
* [AST] Simplify code by letting ArrayRef do the copying.Benjamin Kramer2015-08-041-10/+4
| | | | | | No functionality change intended. llvm-svn: 243974
* [ASTContext] Add a templated convenience wrapper for Allocate.Benjamin Kramer2015-08-041-1/+1
| | | | | | | | | This brings ASTContext closer to LLVM's Allocator concept. Ideally we would just derive ASTContext from llvm::AllocatorBase, but that does not work because ASTContext's allocator is mutable and we allocate using const ASTContext& everywhere. llvm-svn: 243972
* [AST] Use StringRef's convenient copy method. No functionality change.Benjamin Kramer2015-08-041-6/+1
| | | | llvm-svn: 243966
* [UB] When attaching empty strings to the AST, use an empty StringRefChandler Carruth2015-08-041-0/+2
| | | | | | | | rather than forcing the bump pointer allocator to produce a viable pointer. This also fixes UB when we would try to memcpy from the null incoming StringRef. llvm-svn: 243947
* [UB] Fix the two ways that we would try to memcpy from a null buffer inChandler Carruth2015-08-041-7/+9
| | | | | | | | | | | | | the nested name specifier code. First, skip the entire thing when the input is empty. Next, handle the case where we started off with a null buffer and a zero capacity to skip copying and freeing. This was found with UBSan. llvm-svn: 243946
* Additional fix for PR14269: Crash on vector elements / global register vars ↵Andrey Bokhanko2015-08-031-0/+12
| | | | | | | | | | in inline assembler. Compiler crashed when vector elements / global register vars were used in inline assembler with "m" restriction. This patch fixes this. Differential Revision: http://reviews.llvm.org/D10476 llvm-svn: 243870
* [MS ABI] Create a mangling for extended vector typesDavid Majnemer2015-08-011-7/+3
| | | | | | Extended vector types are mangled just like normal vector types. llvm-svn: 243828
* [OPENMP 4.1] Initial support for extended 'ordered' clause.Alexey Bataev2015-07-302-2/+10
| | | | | | | | OpenMP 4.1 introduces optional argument '(n)' for 'ordered' clause, where 'n' is a number of loops that immediately follow the directive. 'n' must be constant positive integer expressions and it must be less or equal than the number of the loops in the resulting loop nest. Patch adds parsing and semantic analysis for this optional argument. llvm-svn: 243635
* [CodeGen] Simplify creation of shuffle masks.Benjamin Kramer2015-07-281-1/+1
| | | | | | No functional change intended. llvm-svn: 243439
* [modules] Add an assert for redeclarations that we never added to their redeclRichard Smith2015-07-271-30/+19
| | | | | | | | | | | | | | | chain and fix the cases where it fires. * Handle the __va_list_tag as a predefined decl. Previously we failed to merge sometimes it because it's not visible to name lookup. (In passing, remove redundant __va_list_tag typedefs that we were creating for some ABIs. These didn't affect the mangling or representation of the type.) * For Decls derived from Redeclarable that are not in fact redeclarable (implicit params, function params, ObjC type parameters), remove them from the list of expected redeclarable decls. llvm-svn: 243259
* [AST] It should be impossible to get Int128 or UInt128 into VisitIntegerLiteralDavid Majnemer2015-07-261-2/+0
| | | | | | These cases should now be impossible as of r243243. llvm-svn: 243252
* [AST] Rename RecordLayoutBuilder to ItaniumRecordLayoutBuilderDavid Majnemer2015-07-251-141/+119
| | | | | | | RecordLayoutBuilder is an inaccruate name because it does not build all records. It only builds layouts for targets using the Itanium C++ ABI. llvm-svn: 243225
* [VTableBuilder] Use range-based for loops. No functional change intendedBenjamin Kramer2015-07-251-146/+96
| | | | llvm-svn: 243222
* [VTableBuilder] Turn functors into lambdasBenjamin Kramer2015-07-251-34/+24
| | | | | | No functional change intended. llvm-svn: 243221
* Capture 'this' so GCC 4.7 can find a static members.Benjamin Kramer2015-07-251-4/+6
| | | | llvm-svn: 243218
* [AST] Turn the callbacks of lookupInBases and forallBases into a function_refBenjamin Kramer2015-07-253-52/+41
| | | | | | | | | This lets us pass functors (and lambdas) without void * tricks. On the downside we can't pass CXXRecordDecl's Find* members (which are now type safe) to lookupInBases directly, but a lambda trampoline is a small price to pay. No functionality change intended. llvm-svn: 243217
* [AST] Perform additional canonicalization for DependentSizedArrayTypeDavid Majnemer2015-07-241-3/+4
| | | | | | | | | | We treated DependentSizedArrayTypes with the same element type but differing size expressions as equivalently canonical. This would lead to bizarre behavior during template instantiation. This fixes PR24212. llvm-svn: 243093
* Commit for http://reviews.llvm.org/D10765Michael Wong2015-07-213-0/+33
| | | | | | | for OpenMP 4 target data directive parsing and sema. This commit is on behalf of Kelvin Li. llvm-svn: 242785
* Remove two unused includes, part 2...Nico Weber2015-07-191-1/+0
| | | | llvm-svn: 242649
* [AST] Remove StmtRange in favor of an iterator_range.Benjamin Kramer2015-07-183-10/+7
| | | | | | | | | StmtRange was just a convenient wrapper for two StmtIterators before we had real range support. This removes some of the implicit conversions StmtRange had leading to slightly more verbose code but also should make more obvious what's going on. No functional change intended. llvm-svn: 242615
* [AST] Cleanup ExprIterator.Benjamin Kramer2015-07-182-14/+1
| | | | | | | | - Make it a proper random access iterator with a little help from iterator_adaptor_base - Clean up users of magic dereferencing. The iterator should behave like an Expr **. - Make it an implementation detail of Stmt. This allows inlining of the assertions. llvm-svn: 242608
* [MS ABI] Explicit specialization of static data members are weakDavid Majnemer2015-07-171-1/+5
| | | | | | | | | | | | | Normally, explicit specializations are treated like strong external definitions. However, MSVC treats explicit specializations of static data members as weak. MSVC 2013's <regex> implementation has such an explicit specialization which leads to clang emitting a strong definition in each translation unit which includes it. Tweak clang's linkage calculation to give such entities GVA_StrongODR linkage instead. This fixes PR24165. llvm-svn: 242592
* Fix alignment issues in Clang.James Y Knight2015-07-175-18/+45
| | | | | | | | | | | | | | | | | Some const-correctness changes snuck in here too, since they were in the area of code I was modifying. This seems to make Clang actually work without Bus Error on 32bit-sparc. Follow-up patches will factor out a trailing-object helper class, to make classes using the idiom of appending objects to other objects easier to understand, and to ensure (with static_assert) that required alignment guarantees continue to hold. Differential Revision: http://reviews.llvm.org/D10272 llvm-svn: 242554
* PR10405 - Desugar FunctionType and TemplateSpecializationType if any type ↵Nikola Smiljanic2015-07-161-4/+56
| | | | | | that appears inside needs to be desugared. llvm-svn: 242371
* Allow any comment to be a trailing comment when -fparse-all-comments is on.James Dennett2015-07-151-7/+79
| | | | | | | | | | | | | | | | | | | | | | | | This helps with freeform documentation styles, where otherwise code like enum class E { E1, // D1 E2 // D2 }; would result in D1 being associated with E2. To properly associate E1 with D1 and E2 with D2, this patch allows all raw comments C such that C.isParseAllComments() to participate in trailing comment checks inside getRawCommentForDeclNoCache. This takes care of linking the intended documentation with the intended decls. There remains an issue with code like: foo(); // DN int x; To prevent DN from being associated with x, this patch adds a new test on preceding-line comments C (where C.isParseAllComments() and also C's kind is RCK_OrdinaryBCPL or RCK_OrdinaryC) that checks whether C is the first non-whitespace thing on C's starting line. Patch from Luke Zarko <zarko@google.com>, D11069 reviewed by rsmith. llvm-svn: 242317
* [OpenMP] Add TLS-based implementation for threadprivate directive.Samuel Antao2015-07-131-4/+8
| | | | llvm-svn: 242080
* [MS ABI] Don't generates code for unreferenced inline definitions of library ↵David Majnemer2015-07-101-2/+2
| | | | | | | | | | | builtins We should only consider declarations which were written, implicit declarations shouldn't be considered. This fixes PR24084. llvm-svn: 241941
* DeclObjC: Move computing the type of self into a separate function (NFC).Adrian Prantl2015-07-081-5/+13
| | | | | | This function will be used for emitting debug info. llvm-svn: 241748
* AST: Avoid reading an unitialized valueJustin Bogner2015-07-081-2/+2
| | | | | | | | | | Desugar doesn't necessarily initialize ShouldAKA, but as of r241542 it may read it. Fix the misuse of the API and initialize this before passing it in. Found by ubsan. llvm-svn: 241705
* [modules] When determining the visible module set during templateRichard Smith2015-07-081-3/+3
| | | | | | | instantiation, use the set of modules visible from the template definition, not from whichever declaration the specialization was instantiated from. llvm-svn: 241662
* Use AlignOf instead of alignOf so that this can go back to being a ↵Aaron Ballman2015-07-071-3/+3
| | | | | | static_assert. Amends r241577. llvm-svn: 241604
* Changing a use of alignof() into llvm::alignOf() for MSVC compatibility. ↵Aaron Ballman2015-07-071-2/+3
| | | | | | This requires changing a static_assert into an assert, too. llvm-svn: 241577
* Don't rely on the use of non-POD types within unions.Douglas Gregor2015-07-071-1/+3
| | | | | | | They aren't universally supported and we're not getting any benefit from using them. llvm-svn: 241564
* [libclang] Implement proper code-completion in an ObjC type parameter position.Douglas Gregor2015-07-071-0/+11
| | | | | | rdar://19670303 llvm-svn: 241561
* [libclang] Replace ObjC generic parameters when code-completing method ↵Douglas Gregor2015-07-071-0/+6
| | | | | | | | implementations. rdar://20643768 llvm-svn: 241559
* The AST importer had a bug where it would enter into an infinite recursionDouglas Gregor2015-07-072-17/+32
| | | | | | | | | | | | | | | | when importing type parameter lists. The reason is that type parameters have their DeclContexts set to the interface that is parameterized with those types, and the importer would follow that loop and blow the stack out. I've changed the way this works so that the type parameters are only imported after the interface that contains them has been registered via the Imported() function. This is tested by LLDB. <rdar://problem/20315663> llvm-svn: 241556
* Factor the simpleTransform() visitor so that it is not a local class.Douglas Gregor2015-07-071-288/+294
| | | | | | | Older versions of Clang cannot handle such local classes properly rdar://problem/19386032. llvm-svn: 241550
* Implement variance for Objective-C type parameters.Douglas Gregor2015-07-075-10/+91
| | | | | | | | | | | | | | | Introduce co- and contra-variance for Objective-C type parameters, which allows us to express that (for example) an NSArray is covariant in its type parameter. This means that NSArray<NSMutableString *> * is a subtype of NSArray<NSString *> *, which is expected of the immutable Foundation collections. Type parameters can be annotated with __covariant or __contravariant to make them co- or contra-variant, respectively. This feature can be detected by __has_feature(objc_generics_variance). Implements rdar://problem/20217490. llvm-svn: 241549
* Implement the Objective-C __kindof type qualifier.Douglas Gregor2015-07-076-52/+265
| | | | | | | | | | The __kindof type qualifier can be applied to Objective-C object (pointer) types to indicate id-like behavior, which includes implicit "downcasting" of __kindof types to subclasses and id-like message-send behavior. __kindof types provide better type bounds for substitutions into unspecified generic types, which preserves more type information. llvm-svn: 241548
* C++ support for Objective-C lightweight generics.Douglas Gregor2015-07-072-1/+56
| | | | | | | | | | | | | | | | | | | Teach C++'s tentative parsing to handle specializations of Objective-C class types (e.g., NSArray<NSString *>) as well as Objective-C protocol qualifiers (id<NSCopying>) by extending type-annotation tokens to handle this case. As part of this, remove Objective-C protocol qualifiers from the declaration specifiers, which never really made sense: instead, provide Sema entry points to make them part of the type annotation token. Among other things, this properly diagnoses bogus types such as "<NSCopying> id" which should have been written as "id <NSCopying>". Implements template instantiation support for, e.g., NSArray<T>* in C++. Note that parameterized classes are not templates in the C++ sense, so that cannot (for example) be used as a template argument for a template template parameter. Part of rdar://problem/6294649. llvm-svn: 241545
OpenPOWER on IntegriCloud