summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Mark lambda closure classes as being implicitly-generated.James Dennett2013-09-051-0/+1
| | | | | | | | | | | | | | Summary: Closure classes for C++ lambdas are always compiler-generated. This one-line change calls setImplicit(true) on them at creation time, such that a default RecursiveASTVisitor (or any for which shouldVisitImplicitCode returns false) will skip them. Reviewers: rsmith, dblaikie Reviewed By: dblaikie CC: klimek, revane, cfe-commits, jordan_rose Differential Revision: http://llvm-reviews.chandlerc.com/D1593 llvm-svn: 190073
* Add new methods for TargetInfo:Stepan Dyatkovskiy2013-09-051-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | getRealTypeByWidth and getIntTypeByWidth for ASTContext names are almost same(invokes new methods from TargetInfo): getIntTypeForBitwidth and getRealTypeForBitwidth. As first commit for PR16752 fix: 'mode' attribute for unusual targets doesn't work properly Description: Troubles could be happened due to some assumptions in handleModeAttr function (see SemaDeclAttr.cpp). For example, it assumes that 32 bit integer is 'int', while it could be 16 bit only. Instead of asking target: 'which type do you want to use for int32_t ?' it just hardcodes general opinion. That doesn't looks pretty correct. Please consider the next solution: 1. In Basic/TargetInfo add getIntTypeByWidth and getRealTypeByWidth virtual methods. By default current behaviour could be implemented here. 2. Fix handleModeAttr according to new methods in TargetInfo. This approach is implemented in the patch attached to this post. Fixes: 1st Commit (Current): Add new methods for TargetInfo: getRealTypeByWidth and getIntTypeByWidth for ASTContext names are almost same(invokes new methods from TargetInfo): getIntTypeForBitwidth and getRealTypeForBitwidth 2nd Commit (Next): Fix SemaDeclAttr, handleModeAttr function. llvm-svn: 190044
* Note when a decl is used in AST files.Eli Friedman2013-09-051-0/+10
| | | | | | | | | | | | | | | When an AST file is built based on another AST file, it can use a decl from the fist file, and therefore mark the "isUsed" bit. We need to note this in the AST file so that the bit is set correctly when the second AST file is loaded. This patch introduces the distinction between setIsUsed() and markUsed() so that we don't call into the ASTMutationListener callback when it wouldn't be appropriate. Fixes PR16635. llvm-svn: 190016
* PR17103: Scoped enumerations with signed integer types have signed integerRichard Smith2013-09-041-4/+4
| | | | | | representation. Don't emit comparisons on them as 'icmp ult'! llvm-svn: 190010
* ASTDumper: fix dump of CXXCatchStmtPavel Labath2013-09-041-0/+6
| | | | | | | | | | Summary: I added the display of the VarDecl contained in the statement. CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1596 llvm-svn: 189941
* Remove useless reinterpret_casts from Stmt.cppPavel Labath2013-09-031-9/+9
| | | | | | | | | | | | | | Summary: I have no idea why these were there in the first place, but now they are certainly not necessary. Reviewers: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1581 llvm-svn: 189813
* Revert "OpenMP: Data-sharing attributes analysis and clause 'shared'"Rafael Espindola2013-09-033-41/+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-033-0/+41
| | | | llvm-svn: 189795
* Mark that qualifiers can prefix the auto type. This seems to just haveChandler Carruth2013-09-021-1/+1
| | | | | | | | | | | | | | | | | | been an oversight, as it definitely works. Every test which changed had the const written on the LHS of the auto already. Notably, this also makes things like cpp11-migrate's formation of 'const auto &' variables much more familiar. Yes, many people feel that 'const' and other qualifiers belong on the RHS of the type. I'm not going to argue about that because Clang already *overwhelming* places the qualifiers on the LHS when it can and on the RHS when it must. We shouldn't diverge for auto. We should add a tool to clang-tidy that fixes this in either direction, and then wire up clang-tidy to tools like cpp11-migrate to fix their placement after transforms. llvm-svn: 189769
* Mention in AST dump whether a class declaration is a definition.Richard Smith2013-08-301-0/+2
| | | | llvm-svn: 189647
* Don't eagerly load all conversion operators when loading a class declarationRichard Smith2013-08-301-25/+41
| | | | | | from a PCH/module. llvm-svn: 189646
* Add ms_abi and sysv_abi attribute handling.Charles Davis2013-08-304-0/+16
| | | | | | Based on a patch by Benno Rice! llvm-svn: 189644
* Be lazier when loading KeyFunctions from PCH/modules. We don't need to loadRichard Smith2013-08-291-12/+11
| | | | | | | | | | | | | | these in eagerly if we're not actually processing a translation unit. The added laziness here also avoids us loading in parts of a CXXRecordDecl earlier than an upcoming class template specialization merging patch would like. Ideally, we should mark the vtable as used when we see a definition for the key function, rather than having a separate pass over dynamic classes at the end of the TU. The existing approach is pretty bad for PCH/modules, since it forcibly loads the declarations of all key functions in all imported modules, whether or not those key functions are defined. llvm-svn: 189627
* Adjust clang for change to APFloat::toString.Eli Friedman2013-08-291-1/+10
| | | | | | | | I changed the diagnostic printing code because it's probably better to cut off a digit from DBL_MAX than to print something like 1.300000001 when the user wrote 1.3. llvm-svn: 189625
* AST: Don't treat a TemplateExpansion as a TemplateDavid Majnemer2013-08-281-7/+5
| | | | | | | | | | | | | | | | | | | Summary: Instead of calling getAsTemplate(), call getAsTemplateOrTemplatePattern() because it handles the TemplateExpansion case too. This fixes PR16997. Reviewers: doug.gregor, rsmith Reviewed By: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1512 llvm-svn: 189422
* Delete CC_Default and use the target default CC everywhereReid Kleckner2013-08-276-46/+34
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Makes functions with implicit calling convention compatible with function types with a matching explicit calling convention. This fixes things like calls to qsort(), which has an explicit __cdecl attribute on the comparator in Windows headers. Clang will now infer the calling convention from the declarator. There are two cases when the CC must be adjusted during redeclaration: 1. When defining a non-inline static method. 2. When redeclaring a function with an implicit or mismatched convention. Fixes PR13457, and allows clang to compile CommandLine.cpp for the Microsoft C++ ABI. Excellent test cases provided by Alexander Zinenko! Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1231 llvm-svn: 189412
* [-cxx-abi microsoft] Remove ArgIndex, we handle all template argument kinds!David Majnemer2013-08-271-20/+6
| | | | | | | TemplateExpansion cannot happen here because MSVC doesn't mangle anything but the fully substituted template arguments. llvm-svn: 189325
* Show which decls are marked invalid in -ast-dump.Nick Lewycky2013-08-271-0/+3
| | | | llvm-svn: 189306
* Itanium mangler: remove "proposal" comments for manglings that are in theRichard Smith2013-08-271-13/+8
| | | | | | latest draft of the ABI. llvm-svn: 189303
* Handle predefined expression for a captured statementWei Pan2013-08-261-0/+10
| | | | | | | | | | | - __func__ or __FUNCTION__ returns captured statement's parent function name, not the one compiler generated. Differential Revision: http://llvm-reviews.chandlerc.com/D1491 Reviewed by bkramer llvm-svn: 189219
* Fix virtual destructor mangling when using "-cxx-abi microsoft" on x64Timur Iskhodzhanov2013-08-261-1/+1
| | | | llvm-svn: 189214
* [-cxx-abi microsoft] Unnamed types are mangled less wrongDavid Majnemer2013-08-261-2/+2
| | | | llvm-svn: 189208
OpenPOWER on IntegriCloud