summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
* Simplify MicrosoftCXXNameMangler::mangleFunctionTypeTimur Iskhodzhanov2013-10-041-19/+17
| | | | llvm-svn: 191950
* Extract ABI-specific parts of MangleContext into separate classesTimur Iskhodzhanov2013-10-033-138/+95
| | | | | | Reviewed at http://llvm-reviews.chandlerc.com/D1807 llvm-svn: 191878
* [OpenMP] Added parsing and semantic analysis for firstprivate clauseAlexey Bataev2013-10-013-0/+35
| | | | llvm-svn: 191730
* Fix computation of linkage within nested lambdas.Faisal Vali2013-10-011-3/+31
| | | | | | | | | | When nested C++11 lambdas are used in NSDMI's - this patch prevents infinite recursion by computing the linkage of any nested lambda by determining the linkage of the outermost enclosing lambda (which might inherit its linkage from its parent). See http://llvm-reviews.chandlerc.com/D1783 for Doug's approval. [On a related note, I need this patch so as to pass tests of transformations of nested lambdas returned from member functions] llvm-svn: 191727
* Tweak changes in r186464 to avoid a crash.Eli Friedman2013-10-011-3/+0
| | | | | | | | | | | | | Currently, IR generation can't handle file-scope compound literals with non-constant initializers in C++. Fixes PR17415 (the first crash in the bug). (We should probably change (T){1,2,3} to use the same codepath as T{1,2,3} in C++ eventually, given that the semantics of the latter are actually defined by the standard.) llvm-svn: 191719
* Revert the linkage fix.Faisal Vali2013-09-291-31/+5
| | | | | | I got a bunch of buildbot failures that i don't understand - sorry. llvm-svn: 191647
* Fix computation of linkage within nested lambdas.Faisal Vali2013-09-291-5/+31
| | | | | | | | | | When nested lambdas are used in NSDMI's - this prevents infinite recursion. See http://llvm-reviews.chandlerc.com/D1783 for Doug's approval regarding the code, and then request for some tests. [On a related note, I need this patch so as to pass tests of transformations of nested lambdas returned from member functions] llvm-svn: 191645
* Fix windows newlines :(Faisal Vali2013-09-291-19/+19
| | | | llvm-svn: 191641
* Implement conversion to function pointer for generic lambdas without captures.Faisal Vali2013-09-291-6/+15
| | | | | | | | | | | | | | | | The general strategy is to create template versions of the conversion function and static invoker and then during template argument deduction of the conversion function, create the corresponding call-operator and static invoker specializations, and when the conversion function is marked referenced generate the body of the conversion function using the corresponding static-invoker specialization. Similarly, Codegen does something similar - when asked to emit the IR for a specialized static invoker of a generic lambda, it forwards emission to the corresponding call operator. This patch has been reviewed in person both by Doug and Richard. Richard gave me the LGTM. A few minor changes: - per Richard's request i added a simple check to gracefully inform that captures (init, explicit or default) have not been added to generic lambdas just yet (instead of the assertion violation). - I removed a few lines of code that added the call operators instantiated parameters to the currentinstantiationscope. Not only did it not handle parameter packs, but it is more relevant in the patch for nested lambdas which will follow this one, and fix that problem more comprehensively. - Doug had commented that the original implementation strategy of using the TypeSourceInfo of the call operator to create the static-invoker was flawed and allowed const as a member qualifier to creep into the type of the static-invoker. I currently kludge around it - but after my initial discussion with Doug, with a follow up session with Richard, I have added a FIXME so that a more elegant solution that involves the use of TrivialTypeSourceInfo call followed by the correct wiring of the template parameters to the functionprototypeloc is forthcoming. Thanks! llvm-svn: 191634
* Implement C++1y sized deallocation (n3778). This is not enabled by -std=c++1y;Richard Smith2013-09-291-1/+4
| | | | | | | instead, it's enabled by the -cc1 flag -fsized-deallocation, until we sort out the backward-compatibility issues. llvm-svn: 191629
* Refactor comment merging.Benjamin Kramer2013-09-281-61/+45
| | | | | | | | | | | - We scan for whitespace between comments anyways, remember any newlines seen along the way. - Use this newline number to decide whether two comments are adjacent. - Since the newline check is now free remove the caching and unused code. - Remove unnecessary boolean state from the comment list. - No behavioral change. llvm-svn: 191614
* Per latest drafting, switch to implementing init-captures as if by declaringRichard Smith2013-09-284-24/+5
| | | | | | and capturing a variable declaration, and complete the implementation of them. llvm-svn: 191605
* Variable templates: handle instantiation of static data member templatesRichard Smith2013-09-272-20/+41
| | | | | | appropriately, especially when they appear within class templates. llvm-svn: 191548
* Abstract out the emission of vtables, add basic support for vtable emission ↵Timur Iskhodzhanov2013-09-273-56/+102
| | | | | | | | when using -cxx-abi microsoft Reviewed at http://llvm-reviews.chandlerc.com/D1532 llvm-svn: 191523
* AST: Handle multidimensional arrays inside of __uuidof()David Majnemer2013-09-271-1/+1
| | | | | | | | We previously handled one-dimensional arrays but didn't consider the general case. The fix is simple: keep going through subsequent dimensions until we get to the base element. llvm-svn: 191493
* AST: Handle qualified array types in typeid() expressionsDavid Majnemer2013-09-274-12/+14
| | | | | | | | | | | | The intent of getTypeOperand() was to yield an unqualified type. However QualType::getUnqualifiedType() does not strip away qualifiers on arrays. N.B. This worked fine when typeid() was applied to an expression because we would inject as implicit cast to the unqualified array type in the AST. llvm-svn: 191487
* Implement a rudimentary form of generic lambdas.Faisal Vali2013-09-264-10/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically, the following features are not included in this commit: - any sort of capturing within generic lambdas - generic lambdas within template functions and nested within other generic lambdas - conversion operator for captureless lambdas - ensuring all visitors are generic lambda aware (Although I have gotten some useful feedback on my patches of the above and will be incorporating that as I submit those patches for commit) As an example of what compiles through this commit: template <class F1, class F2> struct overload : F1, F2 { using F1::operator(); using F2::operator(); overload(F1 f1, F2 f2) : F1(f1), F2(f2) { } }; auto Recursive = [](auto Self, auto h, auto ... rest) { return 1 + Self(Self, rest...); }; auto Base = [](auto Self, auto h) { return 1; }; overload<decltype(Base), decltype(Recursive)> O(Base, Recursive); int num_params = O(O, 5, 3, "abc", 3.14, 'a'); Please see attached tests for more examples. This patch has been reviewed by Doug and Richard. Minor changes (non-functionality affecting) have been made since both of them formally looked at it, but the changes involve removal of supernumerary return type deduction changes (since they are now redundant, with richard having committed a recent patch to address return type deduction for C++11 lambdas using C++14 semantics). Some implementation notes: - Add a new Declarator context => LambdaExprParameterContext to clang::Declarator to allow the use of 'auto' in declaring generic lambda parameters - Add various helpers to CXXRecordDecl to facilitate identifying and querying a closure class - LambdaScopeInfo (which maintains the current lambda's Sema state) was augmented to house the current depth of the template being parsed (id est the Parser calls Sema::RecordParsingTemplateParameterDepth) so that SemaType.cpp::ConvertDeclSpecToType may use it to immediately generate a template-parameter-type when 'auto' is parsed in a generic lambda parameter context. (i.e we do NOT use AutoType deduced to a template parameter type - Richard seemed ok with this approach). We encode that this template type was generated from an auto by simply adding $auto to the name which can be used for better diagnostics if needed. - SemaLambda.h was added to hold some common lambda utility functions (this file is likely to grow ...) - Teach Sema::ActOnStartOfFunctionDef to check whether it is being called to instantiate a generic lambda's call operator, and if so, push an appropriately prepared LambdaScopeInfo object on the stack. - various tests were added - but much more will be needed. There is obviously more work to be done, and both Richard (weakly) and Doug (strongly) have requested that LambdaExpr be removed form the CXXRecordDecl LambdaDefinitionaData in a future patch which is forthcoming. A greatful thanks to all reviewers including Eli Friedman, James Dennett, and especially the two gracious wizards (Richard Smith and Doug Gregor) who spent hours providing feedback (in person in Chicago and on the mailing lists). And yet I am certain that I have allowed unidentified bugs to creep in; bugs, that I will do my best to slay, once identified! Thanks! llvm-svn: 191453
* [OPENMP] Improved variable lookup procedure for threadprivate variables.Alexey Bataev2013-09-261-2/+3
| | | | llvm-svn: 191416
* Remove unused param from MicrosoftMangle::mangleCallingConvention()Reid Kleckner2013-09-251-4/+3
| | | | llvm-svn: 191405
* [OPENMP] Bug fixes and improvements.Alexey Bataev2013-09-242-15/+24
| | | | | | | | 1. Fixed constructor of shared clause. 2. Some macros for clauses processing are replaced by private template methods. 3. Additional checks in sema analysis of OpenMP clauses. llvm-svn: 191265
* Fix comment to match name of variable.Nick Lewycky2013-09-221-1/+1
| | | | llvm-svn: 191171
* Add the intrinsic __builtin_convertvectorHal Finkel2013-09-186-0/+16
| | | | | | | | | | | | | | | | | | LLVM supports applying conversion instructions to vectors of the same number of elements (fptrunc, fptosi, etc.) but there had been no way for a Clang user to cause such instructions to be generated when using builtin vector types. C-style casting on vectors is already defined in terms of bitcasts, and so cannot be used for these conversions as well (without leading to a very confusing set of semantics). As a result, this adds a __builtin_convertvector intrinsic (patterned after the OpenCL __builtin_astype intrinsic). This is intended to aid the creation of vector intrinsic headers that create generic IR instead of target-dependent intrinsics (in other words, this is a generic _mm_cvtepi32_ps). As noted in the documentation, the action of __builtin_convertvector is defined in terms of the action of a C-style cast on each vector element. llvm-svn: 190915
* Fix ObjC @encode for C++ classes w/virtual bases.Eli Friedman2013-09-181-1/+2
| | | | | | PR17142. llvm-svn: 190912
* -ast-dump support for variable templates.Richard Smith2013-09-181-0/+48
| | | | llvm-svn: 190911
* Revert "Revert "[-cxx-abi microsoft] Mangle local TagDecls appropriately""David Majnemer2013-09-172-7/+13
| | | | | | This reverts commit r190895 which reverted r190892. llvm-svn: 190904
* Revert "[-cxx-abi microsoft] Mangle local TagDecls appropriately"David Majnemer2013-09-172-13/+7
| | | | | | This reverts commit r190892. llvm-svn: 190895
* [-cxx-abi microsoft] Mangle local TagDecls appropriatelyDavid Majnemer2013-09-172-7/+13
| | | | | | | | | | | | | | | | | | | | | | | Summary: When selecting a mangling for an anonymous tag type: - We should first try it's typedef'd name. - If that doesn't work, we should mangle in the name of the declarator that specified it as a declaration specifier. - If that doesn't work, fall back to a static mangling of <unnamed-type>. This should make our anonymous type mangling compatible. This partially fixes PR16994; we would need to have an implementation of scope numbering to get it right (a separate issue). Reviewers: rnk, rsmith, rjmccall, cdavis5x CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1540 llvm-svn: 190892
* Fix const-eval of vector init-lists of a vector.Eli Friedman2013-09-171-1/+1
| | | | | | | | | Like any other type, an init list for a vector can have the same type as the vector itself; handle that case. <rdar://problem/14990460> llvm-svn: 190844
* [-cxx-abi microsoft] Correctly identify Win32 entry pointsDavid Majnemer2013-09-162-25/+37
| | | | | | | | | | | | | | | | | | | Summary: This fixes several issues with the original implementation: - Win32 entry points cannot be in namespaces - A Win32 entry point cannot be a function template, diagnose if we it. - Win32 entry points cannot be overloaded. - Win32 entry points implicitly return, similar to main. Reviewers: rnk, rsmith, whunt, timurrrr Reviewed By: rnk CC: cfe-commits, nrieck Differential Revision: http://llvm-reviews.chandlerc.com/D1683 llvm-svn: 190818
* Prune "return" after llvm_unreachable(). It was redundant.NAKAMURA Takumi2013-09-161-1/+0
| | | | llvm-svn: 190774
* Part three of PR15721: if we have an invalid CXXDefaultInitExpr, don't crash ifRichard Smith2013-09-131-2/+6
| | | | | | we try to constant-evaluate it. Patch by Karthik Bhat, test by me. llvm-svn: 190722
* ASTContext.cpp: Fix a warning in r190684. [-Wcovered-switch-default]NAKAMURA Takumi2013-09-131-1/+2
| | | | llvm-svn: 190705
* A buildbot compiling with strict error on unused variables pointed out aDavid Tweed2013-09-131-1/+0
| | | | | | historical remnant in r190684; remove it. llvm-svn: 190687
* Certain multi-platform languages, such as OpenCL, have the concept ofDavid Tweed2013-09-132-7/+39
| | | | | | | | | | | | | | address spaces which is both (1) a "semantic" concept and (2) possibly a hardware level restriction. It is desirable to be able to discard/merge the LLVM-level address spaces on arguments for which there is no difference to the current backend while keeping track of the semantic address spaces in a funciton prototype. To do this enable addition of the address space into the name-mangling process. Add some tests to document this behaviour against inadvertent changes. Patch by Michele Scandale! llvm-svn: 190684
* [-cxx-abi microsoft] Mangle user defined entry points properlyDavid Majnemer2013-09-131-2/+25
| | | | | | | | | | | | | | | | Summary: Functions named "main", "wmain", "WinMain", "wWinMain", and "DllMain" are never mangled regardless of linkage, even when compiling for kernel mode. Depends on D1655 Reviewers: timurrrr, pcc, rnk, whunt CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1670 llvm-svn: 190675
* [-cxx-abi microsoft] Mangle declarations inside extern "C"David Majnemer2013-09-131-33/+76
| | | | | | | | | | | | | | | Summary: This is a first step to getting extern "C" working properly inside clang. There are a number of quirks but mangling declarations inside such a function are a good first step. Reviewers: timurrrr, pcc, cdavis5x CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1655 llvm-svn: 190671
* Fix the end-location of a CXXTemporaryObjectExpr when it is created with a ↵Argyrios Kyrtzidis2013-09-111-1/+4
| | | | | | | | initializer_list. rdar://14887351 llvm-svn: 190561
* Tablegen now generates a StringSwitch for attributes containing enumeration ↵Aaron Ballman2013-09-111-0/+1
| | | | | | arguments to map strings to the proper enumeration value. This makes error checking more consistent and reduces the amount of hand-written code required. llvm-svn: 190545
* [-cxx-abi microsoft] Canonicalize array parameters betterDavid Majnemer2013-09-111-27/+23
| | | | | | | | | | | | | | | Summary: More accurately characterize the nature of array parameters. Doing this removes false back-reference opportunities. Remove some hacks now that we characterize these better. Reviewers: rnk, timurrrr, whunt, cdavis5x CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1626 llvm-svn: 190488
* volatile types are not trivially copyable.Eli Friedman2013-09-111-3/+6
| | | | | | PR17123. llvm-svn: 190484
* Add unused markings to suppress warnings.Eli Friedman2013-09-102-4/+10
| | | | | | | | | | trunk clang is a bit more aggressive about emitting unused-declaration warnings, so adjust some AST code to match. Specifically, use LLVM_ATTRIBUTE_UNUSED for declarations which are never supposed to be referenced, and turn references to declarations which are supposed to be referenced into odr-uses. llvm-svn: 190443
* PR5683: Issue a warning when subtracting pointers to types of zero size, andRichard Smith2013-09-101-0/+9
| | | | | | | treat such subtractions as being non-constant. Patch by Serge Pavlov! With a few tweaks by me. llvm-svn: 190439
* [ms-cxxabi] Mangle dynamic initializer stubs the same way MSVC doesReid Kleckner2013-09-102-6/+31
| | | | | | | | | | | | Summary: Dynamic initializers are mangled as ??__E <name> YAXXZ. Reviewers: timurrrr CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1477 llvm-svn: 190434
* [ms-cxxabi] Implement guard variables for static initializationReid Kleckner2013-09-107-15/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | Static locals requiring initialization are not thread safe on Windows. Unfortunately, it's possible to create static locals that are actually externally visible with inline functions and templates. As a result, we have to implement an initialization guard scheme that is compatible with TUs built by MSVC, which makes thread safety prohibitively difficult. MSVC's scheme is that every function that requires a guard gets an i32 bitfield. Each static local is assigned a bit that indicates if it has been initialized, up to 32 bits, at which point a new bitfield is created. MSVC rejects inline functions with more than 32 static locals, and the externally visible mangling (?_B) only allows for one guard variable per function. On Eli's recommendation, I used MangleNumberingContext to track which bit each static corresponds to. Implements PR16888. Reviewers: rjmccall, eli.friedman Differential Revision: http://llvm-reviews.chandlerc.com/D1416 llvm-svn: 190427
* C++ modules: fix a bug where loading a declaration with some name would preventRichard Smith2013-09-091-14/+20
| | | | | | | | | | | | | | | | | name lookup from lazily deserializing the other declarations with the same name, by tracking a bit to indicate whether a name in a DeclContext might have additional external results. This also allows lazier reconciling of the lookup table if a module import adds decls to a pre-existing DC. However, this exposes a pre-existing bug, which causes a regression in test/Modules/decldef.mm: if we have a reference to a declaration, and a later-imported module adds a redeclaration, nothing causes us to load that redeclaration when we use or emit the reference (which can manifest as a reference to an undefined inline function, a use of an incomplete type, and so on). decldef.mm has been extended with an additional testcase which fails with or without this change. llvm-svn: 190293
* Correct typo.David Majnemer2013-09-071-2/+2
| | | | llvm-svn: 190257
* 'return' before 'else' is bad styleDavid Majnemer2013-09-071-6/+8
| | | | llvm-svn: 190241
* AST: __uuidof should leak through templated typesDavid Majnemer2013-09-071-6/+47
| | | | | | | | | | | | | | | Summary: __uuidof on templated types should exmaine if any of its template parameters have a uuid declspec. If exactly one does, then take it. Otherwise, issue an appropriate error. Reviewers: rsmith, thakis, rnk CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1419 llvm-svn: 190240
* Fix missing source location in CXXTemporaryObjectExpr nodes.Enea Zaffanella2013-09-071-9/+10
| | | | | | | | For clarity, renamed (get/set)ParenRange as (get/set)ParenOrBraceRange in CXXConstructExpr nodes. Added testcase. llvm-svn: 190239
* OpenMP: Data-sharing attributes analysis and clause 'shared' (fixed test ↵Alexey Bataev2013-09-063-0/+41
| | | | | | threadprivate_messages.cpp) llvm-svn: 190183
OpenPOWER on IntegriCloud