summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
* Sema: Dependent array designators cannot be checkedDavid Majnemer2015-01-091-2/+2
| | | | | | | | | | | We forgot to mark designated initializer expression that contain type dependent array designators as type dependent. This would lead to crashes when we try to determine which array element we were trying to initialize. This fixes PR22056. llvm-svn: 225494
* Use APSInt::isSameValue instead of operator== in a place where two APSInt'sRichard Trieu2015-01-091-1/+5
| | | | | | may have different sizes. Fixes PR22017 llvm-svn: 225488
* Document that GetTypeForDeclarator() cannot return a null type.Nico Weber2015-01-041-1/+1
| | | | | | | | | | | | | Also add a few asserts for this. The existing code assumes this in a bunch of places already (see e.g. the assert at the top of ParseTypedefDecl(), and there are many unchecked calls on the result of GetTypeForDeclarator()), and from looking through the code this should always be true from what I can tell. This allows removing ASTContext::getNullTypeSourceInfo() too as that's now unused. No behavior change intended. llvm-svn: 225125
* AST: Remove overzealous assertion from IsModifiableDavid Majnemer2015-01-041-6/+1
| | | | | | It's reasonable to ask if an l-value with class type is modifiable. llvm-svn: 225121
* Volatile reads are side-effecting operations, but in the general case of ↵Aaron Ballman2015-01-031-0/+7
| | | | | | | | | | | access through a volatile-qualified type, we're not certain of the underlying object's side-effects on access. Treat volatile accesses as "maybe" instead of "definite" side effects for the purposes of warning on evaluations in an unevaluated context. No longer diagnose on idiomatic code like: int * volatile v; (void)sizeof(*v); llvm-svn: 225116
* Sema: Don't crash when an inject class name has a nested redefinitionDavid Majnemer2014-12-281-4/+7
| | | | | | | | | We expected the type of a TagDecl to be a TagType, not an InjectedClassNameType. Introduced a helper method, Type::getAsTagDecl, to abstract away the difference; redefine Type::getAsCXXRecordDecl to be in terms of it. llvm-svn: 224898
* This reverts commit r224668 and r224667.Rafael Espindola2014-12-231-14/+21
| | | | | | | | | | r224667 broke bootstrap on Fedora 20 X86_64 (at least). See pr22006 for the details. r224668 depends on r224667. llvm-svn: 224770
* MS ABI: Make the string mangling code more conciseDavid Majnemer2014-12-221-36/+10
| | | | | | No functional change intended. llvm-svn: 224696
* Wrap to 80 columns. NfC.Nico Weber2014-12-221-10/+11
| | | | llvm-svn: 224695
* Fix a bunch of integer template argument problems in template type diffing.Richard Trieu2014-12-201-20/+10
| | | | | | | | | | | | | Reverts most of the changes from r168005. Since template arguments have proper conversions now, no extending of integers is needed. Further, since the integers are the correct size now, use APSInt::operator== instead of APSInt::hasSameValue since operator== will check the size and signness match. Prior to one comparison of APSInt's, check that both are valid. Previous, one could be uninitialized. Also changed APInt to APSInt in GetInt. This occassionally produced a sign flip, which will now be caught by operator==. llvm-svn: 224668
* Fix for PR21758Richard Trieu2014-12-201-1/+4
| | | | | | | | | When a non-type template argument expression needs a conversion to change it into the argument type, preserve that information by remaking the TemplateArgument with an expression that has those conversions. Also a small fix to template type diffing to handle the extra conversions in some cases. llvm-svn: 224667
* Adding a -Wunused-value warning for expressions with side effects used in an ↵Aaron Ballman2014-12-171-20/+37
| | | | | | unevaluated expression context, such as sizeof(), or decltype(). Also adds a similar warning when the expression passed to typeid() *is* evaluated, since it is equally likely that the user would expect the expression operand to be unevaluated in that case. llvm-svn: 224465
* Support constant evaluation for member calls on std::initializer_listRichard Smith2014-12-171-0/+3
| | | | | | temporaries. llvm-svn: 224449
* Renamed RefersToEnclosingLocal bitfield to RefersToCapturedVariable.Alexey Bataev2014-12-162-7/+7
| | | | | | | Bitfield RefersToEnclosingLocal of Stmt::DeclRefExprBitfields renamed to RefersToCapturedVariable to reflect latest changes introduced in commit 224323. Also renamed method Expr::refersToEnclosingLocal() to Expr::refersToCapturedVariable() and comments for constant arguments. No functional changes. llvm-svn: 224329
* Improve handling of value dependent expressions in ↵Nick Lewycky2014-12-161-1/+2
| | | | | | __attribute__((enable_if)), both in the condition expression and at the call site. Fixes PR20988! llvm-svn: 224320
* AST: Fix the linkage of static vars in fn template specializationsDavid Majnemer2014-12-161-1/+1
| | | | | | | | | | | | We that static variables in function template specializations were externally visible. The manglers assumed that externally visible static variables were numbered in Sema. We would end up mangling static variables in the same specialization with the same mangling number which would give all of them the same name. This fixes PR21904. llvm-svn: 224316
* First patch with codegen of the 'omp for' directive. It implementsAlexander Musman2014-12-151-91/+115
| | | | | | | | | | | | | | | the simplest case, which is used when no chunk_size is specified in the schedule(static) or no 'schedule' clause is specified - the iteration space is divided by the library into chunks that are approximately equal in size, and at most one chunk is distributed to each thread. In this case, we do not need an outer loop in each thread - each thread requests once which iterations range it should handle (using __kmpc_for_static_init runtime call) and then runs the inner loop on this range. Differential Revision: http://reviews.llvm.org/D5865 llvm-svn: 224233
* AST: Limit zero-sized constexpr behavior to array typesDavid Majnemer2014-12-141-1/+3
| | | | | | | Restricting this "extension" to array types maximizes our standards conformance while not miscompiling real-world programs. llvm-svn: 224215
* If a non-template constructor instantiated to X(X),John McCall2014-12-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | ignore it during overload resolution when initializing X from a value of type cv X. Previously, our rule here only ignored specializations of constructor templates. That's probably because the standard says that constructors are outright ill-formed if their first parameter is literally X and they're callable with one argument. However, Clang only enforces that prohibition against non-implicit instantiations; I'm not sure why, but it seems to be deliberate. Given that, the most sensible thing to do is to just ignore the "illegal" constructor regardless of where it came from. Also, stop ignoring such constructors silently: print a note explaining why they're being ignored. Fixes <rdar://19199836>. llvm-svn: 224205
* NFC: Minor formatting fixWill Wilson2014-12-131-1/+1
| | | | llvm-svn: 224185
* Pretty print support for template arg enum constantsWill Wilson2014-12-131-2/+13
| | | | llvm-svn: 224184
* Fix the issue of mangling of local anonymous unions (Itanium C++ ABI):Evgeny Astigeevich2014-12-123-27/+54
| | | | | | | | | | | | | | | | | | | | | | A discriminator is used for the first occurrence of a name. inline int f1 () { static union { int a; long int b; }; static union { int c; double d; }; return a+c; } The name of the second union is mangled as _ZZ2f1vE1c_0 instead of _ZZ2f1vE1c. Differential Revision: http://reviews.llvm.org/D6295 llvm-svn: 224131
* AST: Incomplete types might be zero sizedDavid Majnemer2014-12-111-3/+7
| | | | | | | | Comparing the address of an object with an incomplete type might return true with a 'distinct' object if the former has a size of zero. However, such an object should compare unequal with null. llvm-svn: 224040
* MS ABI: Fix mangling of unsigned int template paramsWill Wilson2014-12-111-1/+3
| | | | llvm-svn: 223999
* AST: Properly calculate the linkage of a IndirectFieldDeclDavid Majnemer2014-12-101-2/+5
| | | | | | | | | | | getLVForNamespaceScopeDecl believed that it wasn't possible for it to ever see an IndirectFieldDecl. However, this can occur when determining whether or not something is a redeclaration of a member of an anonymous static union. This fixes PR21858. llvm-svn: 223975
* Fixed an 80-column violation.Sean Callanan2014-12-101-6/+7
| | | | | | Thanks to Nico Weber for spotting this. llvm-svn: 223966
* Fixed the AST importer ot use redeclaration contexts properly.Sean Callanan2014-12-101-16/+16
| | | | | | | | | | | | | | To ensure that we don't import duplicates, the ASTImporter often checks the DeclContext for a Decl before importing it to see if a Decl with the same name is already present. This is problematic if the Decl is inside a transparent context like an extern "C" block. Lookup isn't allowed on such contexts, and in fact they assert() if you do that. So instead we look at the redeclaration context -- the containing context that can be used safely for these kinds of checks -- instead. llvm-svn: 223912
* Made the ASTImporter resilient if it can't importSean Callanan2014-12-101-1/+6
| | | | | | | | | | | | | | SourceLocations. LLDB rarely has the same files mapped into the target AST context as the source AST context, so the ASTImporter shouldn't expect to see those files there. This started to become a problem when importing entities from modules -- these have proper source locations, in contrast to all the ASTs LLDB creates which have empty ones. llvm-svn: 223900
* Updated the AST importer to support importingSean Callanan2014-12-101-0/+30
| | | | | | | | | LinkageSpecDecls. This is relevant when LLDB wants to import Decls from non-C++ modules, since many declarations are in extern "C" blocks. llvm-svn: 223860
* AST: Don't assume two zero sized objects live at different addressesDavid Majnemer2014-12-091-0/+10
| | | | | | | | Zero sized objects may overlap with each other or any other object. This fixes PR21786. llvm-svn: 223852
* ASTDumper: print whether a function is constexprHans Wennborg2014-12-051-0/+4
| | | | llvm-svn: 223538
* This patch fixes a crash involving use of predefinedFariborz Jahanian2014-12-021-1/+5
| | | | | | | | expressions. It fixes crash when mangling name for block's helper function used inside a constructor/destructor. rdar://19065361. llvm-svn: 223136
* Fix typo.Nico Weber2014-11-291-1/+1
| | | | llvm-svn: 222964
* AST: Consider pseudo-struct builtin types as substitutableDavid Majnemer2014-11-281-1/+14
| | | | | | | | We didn't consider types like ObjCSel as a substitution candidate. This fixes PR21688. llvm-svn: 222941
* [OpenCL] Implemented restrictions for pointer conversions specified in ↵Anastasia Stulova2014-11-261-0/+1
| | | | | | | | | | | | OpenCL v2.0. OpenCL v2.0 s6.5.5 restricts conversion of pointers to different address spaces: - the named address spaces (__global, __local, and __private) => __generic - implicitly converted; - __generic => named - with an explicit cast; - named <=> named - disallowed; - __constant <=> any other - disallowed. llvm-svn: 222834
* [OpenCL] Generic address space has been added in OpenCL v2.0.Anastasia Stulova2014-11-262-3/+7
| | | | | | | | | | To support it in the frontend, the following has been added: - generic address space type attribute; - documentation for the OpenCL address space attributes; - parsing of __generic(generic) keyword; - test code for the parser and diagnostics. llvm-svn: 222831
* Simplify MicrosoftMangleContextImpl::shouldMangleStringLiteralDavid Majnemer2014-11-221-2/+1
| | | | | | No functionality changed. llvm-svn: 222610
* MS ABI: Mangle u8 string literalsDavid Majnemer2014-11-211-1/+2
| | | | | | UTF8 string literals are mangled just like ASCII string literals. llvm-svn: 222591
* MS ABI: Mangle char16_t and char32_t string literalsDavid Majnemer2014-11-211-10/+7
| | | | | | | | | | | | | | | | We previously had support for char and wchar_t string literals. VS 2015 added support for char16_t and char32_t. String literals must be mangled in the MS ABI in order for them to be deduplicated across translation units: their linker has no notion of mergeable section. Instead, they use the mangled name to make a COMDAT for the string literal; the COMDAT will merge with other COMDATs in other object files. This allows strings in object files generated by clang to get merged with strings in object files generated by MSVC. llvm-svn: 222564
* MS ABI: Mangle char16_t and char32_t typesDavid Majnemer2014-11-211-2/+2
| | | | | | | These mangling make clang more compatible with MSVC 2015. Correctly mangling char16_t and char32_t will take a little more work. llvm-svn: 222515
* Preserve numeric literal suffixes during type canonicalization.Richard Smith2014-11-201-0/+2
| | | | | | Patch by Pierre Gousseau! Test cases altered significantly by me. llvm-svn: 222404
* When mangling member-expressions, skip implicit accesses of anonymous unionRichard Smith2014-11-201-0/+12
| | | | | | objects. This is consistent with GCC's behavior. Patch by Tomasz Miąsko! llvm-svn: 222402
* Constify a few IdentifierInfo * parameters.Jordan Rose2014-11-191-3/+3
| | | | | | No functionality change. llvm-svn: 222392
* Fix bug where a trivial constexpr copy/move operation couldn't copy from anRichard Smith2014-11-191-4/+31
| | | | | | | empty non-constexpr object. Such a copy doesn't break any of the constexpr rules. llvm-svn: 222387
* Update for LLVM API change to make Small(Ptr)Set::insert return ↵David Blaikie2014-11-194-13/+14
| | | | | | pair<iterator, bool> as per the C++ standard's associative container concept. llvm-svn: 222335
* [OPENMP] Additional processing of 'omp atomic read' directive.Alexey Bataev2014-11-181-8/+10
| | | | | | According to OpenMP standard, Section 2.12.6, atomic Construct, '#pragma omp atomic read' is allowed to be used only for expression statements of form 'v = x;', where x and v (as applicable) are both l-value expressions with scalar type. Patch adds checks for it. llvm-svn: 222231
* Handle use of default member initializers before end of outermost classReid Kleckner2014-11-172-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically, when we have this situation: struct A { template <typename T> struct B { int m1 = sizeof(A); }; B<int> m2; }; We can't parse m1's initializer eagerly because we need A to be complete. Therefore we wait until the end of A's class scope to parse it. However, we can trigger instantiation of B before the end of A, which will attempt to instantiate the field decls eagerly, and it would build a bad field decl instantiation that said it had an initializer but actually lacked one. Fixed by deferring instantiation of default member initializers until they are needed during constructor analysis. This addresses a long standing FIXME in the code. Fixes PR19195. Reviewed By: rsmith Differential Revision: http://reviews.llvm.org/D5690 llvm-svn: 222192
* Minor readability tweaks to VFTableBuilder.cppTimur Iskhodzhanov2014-11-171-12/+14
| | | | llvm-svn: 222140
* Add a couple more examples illustrating why we need vtordisps and how they workTimur Iskhodzhanov2014-11-171-1/+98
| | | | llvm-svn: 222133
* This patch fixes couple of bugs for predefined expressionFariborz Jahanian2014-11-141-11/+13
| | | | | | | | | used inside blocks. It fixes a crash in naming code for __func__ etc. when used in a block declared globally. It also brings back old naming convention for predefined expression which was broken. rdar://18961148 llvm-svn: 222065
OpenPOWER on IntegriCloud