summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* [modules] Cope with partial module macro information, fix memory leak found ↵Richard Smith2015-04-223-6/+14
| | | | | | by buildbot. llvm-svn: 235464
* [modules] Build a DAG of module macros for each identifier.Richard Smith2015-04-226-31/+167
| | | | | | | | This graph will be used to determine the current set of active macros. This is foundation work for getting macro visibility correct across submodules of the current module. No functionality change for now. llvm-svn: 235461
* Expose -fdiagnostics-parseable-fixits to clang-clHans Wennborg2015-04-212-1/+2
| | | | | | | | Patch by Daniel Cheng! Differential Revision: http://reviews.llvm.org/D9175 llvm-svn: 235456
* [cuda] Allow using integral non-type template parameters as launch_bounds ↵Artem Belevich2015-04-218-28/+204
| | | | | | | | | | | | | | | | attribute arguments. - Changed CUDALaunchBounds arguments from integers to Expr* so they can be saved in AST for instantiation. - Added support for template instantiation of launch_bounds attrubute. - Moved evaluation of launch_bounds arguments to NVPTXTargetCodeGenInfo:: SetTargetAttributes() where it can be done after template instantiation. - Added a warning on negative launch_bounds arguments. - Amended test cases. Differential Revision: http://reviews.llvm.org/D8985 llvm-svn: 235452
* [cuda] Added support for CUDA built-in variables.Artem Belevich2015-04-214-0/+196
| | | | | | | | | | | | | | | | | Added cuda_builtin_vars.h which implements built-in CUDA variables using __declattr(property). Fields of built-in variables (except for warpSize) are implemented using __declattr(property) which replaces read/write of a member field with a call to a getter/setter member function, in this case with appropriate NVPTX builtin. Added a test case to check diagnostics on attempt to construct or improperly access a built-in variable. Differential Revision: http://reviews.llvm.org/D9064 llvm-svn: 235448
* [modules] Move list of exported module macros from IdentifierInfo lookup ↵Richard Smith2015-04-214-441/+227
| | | | | | | | | table to separate storage, adjacent to the macro directive history. This is substantially simpler, provides better space usage accounting in bcanalyzer, and gives a more compact representation. No functionality change intended. llvm-svn: 235420
* DebugInfo: Prepare for removal of DIArray and DITypeArray typedefsDuncan P. N. Exon Smith2015-04-212-38/+44
| | | | | | | | An upcoming LLVM commit will remove the `DIArray` and `DITypeArray` typedefs that shadow `DebugNodeArray` and `MDTypeRefArray`, respectively. Use those types directly. llvm-svn: 235412
* DebugInfo: Prepare for deletion of DIDescriptor subclassesDuncan P. N. Exon Smith2015-04-212-59/+47
| | | | | | | An upcoming LLVM commit will delete all the remaining subclasses of (the already deleted) `DIDescriptor`. Stop using them. llvm-svn: 235403
* Recommend to use CMake on the Clang Getting Started page.Alexey Samsonov2015-04-211-8/+15
| | | | llvm-svn: 235402
* Revert r235398 "[cuda] Added support for CUDA built-in variables."Artem Belevich2015-04-214-196/+0
| | | | | | r235398 was causing buildbot break due to missing Makefile changes. llvm-svn: 235401
* [cuda] Added support for CUDA built-in variables.Artem Belevich2015-04-214-0/+196
| | | | | | | | | | | | | | | | | Added cuda_builtin_vars.h which implements built-in CUDA variables using __declattr(property). Fields of built-in variables (except for warpSize) are implemented using __declattr(property) which replaces read/write of a member field with a call to a getter/setter member function, in this case with appropriate NVPTX builtin. Added a test case to check diagnostics on attempt to construct or improperly access a built-in variable. Differential Revision: http://reviews.llvm.org/D9064 llvm-svn: 235398
* Implement target-specific __attribute__((aligned)) valueUlrich Weigand2015-04-217-7/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The GCC construct __attribute__((aligned)) is defined to set alignment to "the default alignment for the target architecture" according to the GCC documentation: The default alignment is sufficient for all scalar types, but may not be enough for all vector types on a target that supports vector operations. The default alignment is fixed for a particular target ABI. clang currently hard-coded an alignment of 16 bytes for that construct, which is correct on some platforms (including X86), but wrong on others (including SystemZ). Since this value is ABI-relevant, it is important to get correct for compatibility purposes. This patch adds a new TargetInfo member "DefaultAlignForAttributeAligned" that targets can set to the appropriate default __attribute__((aligned)) value. Note that I'm deliberately *not* using the existing "SuitableAlign" value, which is used to set the pre-defined macro __BIGGEST_ALIGNMENT__, since those two values may not be the same on all platforms. In fact, on X86, __attribute__((aligned)) always uses 16-byte alignment, while __BIGGEST_ALIGNMENT__ may be larger if AVX-2 or AVX-512 are supported. (This is actually not yet correctly implemented in clang either.) The patch provides a value for DefaultAlignForAttributeAligned only for SystemZ, and leaves the default for all other targets at 16, which means no visible change in behavior on all other targets. (The value is still wrong for some other targets, but I'd prefer to leave it to the target maintainers for those platforms to fix.) llvm-svn: 235397
* Provide alignment info on LLVM external symbolsUlrich Weigand2015-04-212-0/+15
| | | | | | | | | | | | | | | | | Code in CodeGenModule::GetOrCreateLLVMGlobal that sets up GlobalValue object for LLVM external symbols has this comment: // FIXME: This code is overly simple and should be merged with other global // handling. One part does seems to be "overly simple" currently is that this code never sets any alignment info on the GlobalValue, so that the emitted IR does not have any align attribute on external globals. This can lead to unnecessarily inefficient code generation. This patch adds a GV->setAlignment call to set alignment info. llvm-svn: 235396
* Fix __alignof__ of global variables on SystemZUlrich Weigand2015-04-213-1/+32
| | | | | | | | | | | | | | | | | SystemZ prefers to align all global variables to two bytes, which is implemented by setting the TargetInfo member MinGlobalAlign. However, for compatibility with existing compilers this should *not* change the ABI alignment value as retrieved via __alignof__, which it currently does. This patch fixes the issue by having ASTContext::getDeclAlign ignore the MinGlobalAlign setting in the ForAlignof case. Since SystemZ is the only platform setting MinGlobalAlign, this should cause no change for any other target. llvm-svn: 235395
* DebugInfo: Prepare for deletion of subclasses of DIScopeDuncan P. N. Exon Smith2015-04-202-128/+128
| | | | | | | | Prepare for the deletion in LLVM of the subclasses of (the already deleted) `DIScope` by using the raw pointers they were wrapping directly. llvm-svn: 235355
* DebugInfo: Prepare for deletion of subclasses of DITypeDuncan P. N. Exon Smith2015-04-202-21/+19
| | | | | | | | | | | Subclasses of (the already deleted) `DIType` will be deleted by an upcoming LLVM commit. Remove references. While `DICompositeType` wraps `MDCompositeTypeBase` and `DIDerivedType` wraps `MDDerivedTypeBase`, most uses of each really meant the more specific `MDCompositeType` and `MDDerivedType`. I updated accordingly. llvm-svn: 235350
* Add conversionDecl matcher for node CXXConversionDecl.Samuel Benzaquen2015-04-203-0/+16
| | | | llvm-svn: 235348
* Put statement expression decls in the enclosing code DeclContextReid Kleckner2015-04-202-1/+25
| | | | | | | | | | We already check that statement expressions are in a function or block, but we didn't do anything with that information. Now we use that DeclContext for the duration of the statement expression. Otherwise, we'd treat statement expression locals as static data members and go into the weeds. llvm-svn: 235335
* DebugInfo: Prepare for deletion of DITypeDuncan P. N. Exon Smith2015-04-202-242/+229
| | | | | | | `DIType` is going to be deleted by an upcoming LLVM commit, so replace uses with `MDType*`. llvm-svn: 235330
* DebugInfo: Prepare for deletion of DIScopeDuncan P. N. Exon Smith2015-04-202-14/+12
| | | | | | | An upcoming LLVM commit will delete `DIScope`, so update users to `MDScope*`. llvm-svn: 235326
* clang-format: Fix incorrect multi-var declstmt detection.Daniel Jasper2015-04-202-3/+4
| | | | | | | | | | | | This is now obvious as the pointer alignment behavior was changed. Before (even with pointer alignment "Left"): MACRO Constructor(const int &i) : a(a), b(b) {} After: MACRO Constructor(const int& i) : a(a), b(b) {} llvm-svn: 235301
* Fix bug in Replacement's toString on Windows (missing flush).Manuel Klimek2015-04-201-4/+4
| | | | | | Adapt function to LLVM coding style. llvm-svn: 235286
* [Sema] Check availability of ObjC super class and protocols of a containerArgyrios Kyrtzidis2015-04-195-10/+68
| | | | | | | | | | | in the context of the container itself. Otherwise we will emit 'unavailable' errors when referencing an unavailable super class even though the subclass is also marked 'unavailable'. rdar://20598702 llvm-svn: 235276
* [MS ABI] Correctly associate align attrs before the class-keyDavid Majnemer2015-04-195-0/+63
| | | | | | | | | | | | __declspec(align(...)) is unlike all other attributes in that it is not applied to a variable if it appears before the class-key. If the tag in question isn't part of a variable declaration, it is not ignored. Instead, the alignment attribute is applied to the tag. This fixes PR18024. llvm-svn: 235272
* Try to work around failure to convert this lambda to a function pointer in ↵Richard Smith2015-04-191-4/+5
| | | | | | some versions of GCC. llvm-svn: 235264
* [modules] Refactor macro emission. No functionality change.Richard Smith2015-04-191-76/+73
| | | | llvm-svn: 235263
* Make helper function static. NFC.Benjamin Kramer2015-04-181-3/+3
| | | | llvm-svn: 235253
* [Sema] Don't crash if array bound calculation overflowed constexpr arrayDavid Majnemer2015-04-182-0/+4
| | | | | | | | | We didn't correctly expect a QualifiedTypeLoc when faced with fixing a variable array type into a constant array type. Differential Revision: http://reviews.llvm.org/D8958 llvm-svn: 235251
* Remove dead code, NFCDuncan P. N. Exon Smith2015-04-181-3/+0
| | | | llvm-svn: 235246
* DebugInfo: Prepare for deletion of DIDescriptorDuncan P. N. Exon Smith2015-04-182-23/+14
| | | | | | Prepare for upcoming LLVM change to delete `DIDescriptor`. llvm-svn: 235245
* Change AArch64 i128 returns to use [2 x i64] when possible.Pete Cooper2015-04-172-1/+9
| | | | | | | | | | Something like { void*, void * } would be passed to a function as a [2 x i64], but returned as an i128. This patch unifies the 2 behaviours so that we also return it as a [2 x i64]. This is better for the quality of the IR, and the size of the final LLVM binary as we tend to want to insert/extract values from these types and do so with the insert/extract instructions is less IR than shifting, truncating, and or'ing values. Reviewed by Tim Northover. llvm-svn: 235231
* Add a missing forward def of CheckerManager. NFC.Pete Cooper2015-04-171-0/+2
| | | | | | This file doesn't include CheckerManager or forward declare it, so is sensitive to include order. llvm-svn: 235209
* Remove the assertion as it was useless and broken.Sylvestre Ledru2015-04-171-4/+0
| | | | | | | | | | | | | Enforcing the assert caused the following tests to fail: Clang :: Analysis__bstring.c Clang :: Analysis__comparison-implicit-casts.cpp Clang :: Analysis__malloc-interprocedural.c Clang :: Analysis__malloc.c Clang :: Analysis__redefined_system.c Clang :: Analysis__string.c Clang :: Analysis__weak-functions.c llvm-svn: 235190
* Fix a bad assert. Found by coverity. CID 1101110Sylvestre Ledru2015-04-171-1/+1
| | | | llvm-svn: 235188
* [MSVC] Mimic MSVC whitespace collapse for incompatible token pastingWill Wilson2015-04-172-0/+14
| | | | | | | | | | In public MS headers for XAudio, clang would fail to generate a valid UUID due to the UUID components being combined with the '-' UUID separators. Clang would attempting to recover but would preserve the leading whitespace from the tokens after each failed paste leading to spaces creeping into the UUID and causing an error in the __declspace(uuid()) parsing. Reference: Microsoft DirectX SDK (June 2010)\Include\XAudio2.h(51) Resolves http://llvm.org/pr23071 llvm-svn: 235186
* Follow-up to r235046: selectany only causes a definition if it's not inherited.Nico Weber2015-04-172-1/+6
| | | | | | | | (For example needed to parse system header inputscope.h, which first has an extern "C" selectany IID and then later an extern "C" declaration of that same IID.) llvm-svn: 235174
* Move fixit for const init from note to diag, weaken to warning in MS mode.Nico Weber2015-04-1714-43/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r235046 turned "extern __declspec(selectany) int a;" from a declaration into a definition to fix PR23242 (required for compatibility with mc.exe output). However, this broke parsing Windows headers: A d3d11 headers contain something like struct SomeStruct {}; extern const __declspec(selectany) SomeStruct some_struct; This is now a definition, and const objects either need an explicit default ctor or an initializer so this errors out with d3d11.h(1065,48) : error: default initialization of an object of const type 'const CD3D11_DEFAULT' without a user-provided default constructor (cl.exe just doesn't implement this rule, independent of selectany.) To work around this, weaken this error into a warning for selectany decls in microsoft mode, and recover with zero-initialization. Doing this is a bit hairy since it adds a fixit on an error emitted by InitializationSequence – this means it needs to build a correct AST, which in turn means InitializationSequence::Failed() cannot return true when this fixit is applied. As a workaround, the patch adds a fixit member to InitializationSequence, and InitializationSequence::Perform() prints the diagnostic if the fixit member is set right after its call to Diagnose. That function is usually called when InitializationSequences are used – InitListChecker::PerformEmptyInit() doesn't call it, but the InitListChecker case never performs default-initialization, so this is technically OK. This is the alternative, original fix for PR20208 that got reviewed in the thread "[patch] Improve diagnostic on default-initializing const variables (PR20208)". This change basically reverts r213725, adds the original fix for PR20208, and makes the error a warning in Microsoft mode. llvm-svn: 235166
* Revert file unintentionally changed in r235162.Daniel Jasper2015-04-171-1/+1
| | | | llvm-svn: 235163
* clang-format: Add default fallback style.Daniel Jasper2015-04-172-1/+2
| | | | | | Thanks to Michael Schlottke. llvm-svn: 235162
* [MS ABI] Use the right types for filter and finally blocksDavid Majnemer2015-04-175-52/+54
| | | | | | | The type for abnormal_termination can't be an i1, it an i8. Filter functions return 'LONG', not 'int'. llvm-svn: 235161
* Improve const-nessDavid Blaikie2015-04-172-6/+4
| | | | | | | | This allows callers to pass a char ** (such as the one coming from the standard decreed main declaration - even though everyone usually puts const on that themselves). llvm-svn: 235150
* [opaque pointer types] Explicit non-pointer type for call expressionsDavid Blaikie2015-04-1654-163/+163
| | | | | | (migration for recent LLVM change to textual IR for calls) llvm-svn: 235147
* [Objective-C Sema]. In my last patch change theFariborz Jahanian2015-04-165-40/+40
| | | | | | | attribute name to objc_independent_class. rdar://20255473 llvm-svn: 235135
* [Objective-C Sema] patch to introduce IndependentClassFariborz Jahanian2015-04-168-2/+78
| | | | | | | | | attribute to be placed on Objective-C pointer typedef to make them strong enough so on their "new" method family no attempt is made to override these types. rdar://20255473 llvm-svn: 235128
* DebugInfo: Update for LLVM API change in DIBuilder (r235111)Duncan P. N. Exon Smith2015-04-162-113/+96
| | | | | | | | | | | | | | | | | LLVM r235111 changed the `DIBuilder` API to stop using `DIDescriptor` and its subclasses. Rolled into this was some tightening up of types: - Scopes: `DIDescriptor` => `MDScope*`. - Generic debug nodes: `DIDescriptor` => `DebugNode*`. - Subroutine types: `DICompositeType` => `MDSubroutineType*`. - Composite types: `DICompositeType` => `MDCompositeType*`. Note that `DIDescriptor` wraps `MDNode`, and `DICompositeType` wraps `MDCompositeTypeBase`. It's this new type strictness that requires changes here. llvm-svn: 235112
* [AArch64] Add v8.1a architectureVladimir Sukharev2015-04-163-1/+41
| | | | | | | | | | | | Add support for AArch64 v8.1 architecture. Briefly it is described on http://community.arm.com/groups/processors/blog/2014/12/02/the-armv8-a-architecture-and-its-ongoing-development Reviewers: jmolloy Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D8493 llvm-svn: 235110
* [OPENMP] Fix for checking of data-sharing attributes for canonical var decls ↵Alexey Bataev2015-04-1650-45/+465
| | | | | | | | | | | only. Currently checks for active data-sharing attributes for variables are performed for found var decls. Instead these checks must be performed for canonical decls of these variables to avoid possible troubles with with the differently qualified re-declarations of the same variable, for example: namespace A { int x; } namespace B { using A::x; } Both A::x and B::x actually reference the same object A::x and this fact must be taken into account during data-sharing attributes analysis. llvm-svn: 235096
* clang-format: add an option for fallback style in vimrcDaniel Jasper2015-04-161-0/+4
| | | | | | | | | | | | With this patch, clang-format.py will search and use existing .clang-format file if there is one and fallback to the specific format style if not. It should cover the projects which don't have .clang-format files in their source. As the option fallback-style is available in clang 3.5 or later, it is safe to use. Patch by "Chilledheart" (http://reviews.llvm.org/D8489). llvm-svn: 235080
* clang-format: [JS] handle comments in template strings.Daniel Jasper2015-04-162-2/+44
| | | | | | Patch by Martin Probst. Thank you. llvm-svn: 235078
* clang-format: Undo r214508. It was essentially always removing theDaniel Jasper2015-04-162-3/+3
| | | | | | | space where we already had the flag ObjCSpaceBeforeProtocolList to control it. I don't know what I was thinking. llvm-svn: 235076
OpenPOWER on IntegriCloud