summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* [CMake] clang/lib: Satisfy dependencies to add *actually used* libraries on ↵NAKAMURA Takumi2013-12-0918-26/+114
| | | | | | | | target_link_libraries() and LLVM_LINK_COMPONENTS. I will prune redundant dependencies later. llvm-svn: 196800
* [CMake] clangDriver: Move LLVM stuff in target_link_library to ↵NAKAMURA Takumi2013-12-091-2/+6
| | | | | | LLVM_LINK_COMPONENTS. llvm-svn: 196798
* Save another call to GetAddrOfFunction.Rafael Espindola2013-12-092-8/+10
| | | | | | | Thread an optional GV down to EmitGlobalFunctionDefinition so that it can avoid the lookup when we already know the corresponding llvm global value. llvm-svn: 196789
* When we decide to output a deferred decl, remember the llvm GlobalValue.Rafael Espindola2013-12-093-24/+37
| | | | | | | | | We can reuse it to avoid a DenseMap+StringMap lookup to find if it was already emitted or not. This fixes a 2010 TODO. llvm-svn: 196785
* Output destructors and constructors in a more natural order.Rafael Espindola2013-12-091-12/+12
| | | | | | | | | | | | | | | | With this patch we output the in the order C2 C1 D2 D1 D0 Which means that a destructor or constructor that call another is output after the callee. This is a bit easier to read IHMO and a tiny bit more efficient as we don't put a decl in DeferredDeclsToEmit. llvm-svn: 196784
* clang-format: Be more conservative about braced list column layout.Daniel Jasper2013-12-093-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically disable it for nested braced lists as it commonly can look really weird. Eventually, we'll want to become smarter and format some of the nested lists better. Before: SomeStruct my_struct_array = { { aaaaaa, aaaaaaaa, aaaaaaaaaa, aaaaaaaaa, aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaa, aaaaaaa, aaa }, { aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaa }, { aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaa, a, aaaaaaaaaa, aaaaaaaaa, aaa }, }; After: SomeStruct my_struct_array = { { aaaaaa, aaaaaaaa, aaaaaaaaaa, aaaaaaaaa, aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaaa, aaaaaaa, aaa }, { aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaaa, aaa }, { aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaa, a, aaaaaaaaaa, aaaaaaaaa, aaa }, }; llvm-svn: 196783
* [-cxx-abi microsoft] Mangle large integral constants correctlyDavid Majnemer2013-12-092-46/+43
| | | | | | | | | | | | | | | | | | | Testing has revealed that large integral constants (i.e. > INT64_MAX) are always mangled as-if they are negative, even in places where it would not make sense for them to be negative (like non-type template parameters of type unsigned long long). To address this, we change the way we model number mangling: always mangle as-if our number is an int64_t. This should result in correct results when we have large unsigned numbers. N.B. Bizarrely, things that are 32-bit displacements like vbptr offsets are mangled as-if they are unsigned 32-bit numbers. This is a pretty egregious waste of space, it would be a 4x savings if we could mangle it like a signed 32-bit number. Instead, we explicitly cast these displacements to uint32_t and let the mangler proceed. llvm-svn: 196771
* Avoid extra error messages if method definition is inside function.Serge Pavlov2013-12-091-1/+2
| | | | llvm-svn: 196757
* Avoid adding some decls to DeferredDeclsToEmit.Rafael Espindola2013-12-094-77/+92
| | | | | | | | Before this patch GetOrCreateLLVMFunction would add a decl to DeferredDeclsToEmit even when it was being called by the function trying to emit that decl. llvm-svn: 196753
* [-cxx-abi microsoft] Properly mangle enumsDavid Majnemer2013-12-091-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While testing our ability to mangle large constants (PR18175), I incidentally discovered that we did not properly mangle enums correctly. Previously, we would append the width of the enum in bytes after the type-tag differentiator. This would mean "enum : short" would be mangled as 'W2' while "enum : char" would be mangled as 'W1'. Upon testing this with several versions of MSVC, I found that this did not match their behavior: they always use 'W4'. N.B. Quick testing uncovered that undname allows different numbers to follow the 'W' in the following way: 'W0' -> "enum char" 'W1' -> "enum unsigned char" 'W2' -> "enum short" 'W3' -> "enum unsigned short" 'W4' -> "enum" 'W5' -> "enum unsigned int" 'W6' -> "enum long" 'W7' -> "enum unsigned long" However this scheme appears abandoned, I cannot get MSVC to trigger it. Furthermore, it's incomplete: it doesn't handle "bool" or "long long". llvm-svn: 196752
* [AArch64]Add missing pair intrinsics such as:Hao Liu2013-12-091-0/+8
| | | | | | | int32_t vminv_s32(int32x2_t a) which should be compiled into SMINP Vd.2S,Vn.2S,Vm.2S llvm-svn: 196750
* Rename a variable that I missed in the previous refactoring.Faisal Vali2013-12-091-4/+4
| | | | llvm-svn: 196740
* GlobalAlias::isDeclaration is always false. Remove dead code.Rafael Espindola2013-12-081-5/+0
| | | | llvm-svn: 196727
* ARM: teach Sema that "r" can match 64-bit valuesTim Northover2013-12-081-1/+1
| | | | | | | | We already support using "r" on 64-bit values (a GPRPair is allocated), but Sema doesn't know this yet so issues a warning. This should fix it. llvm-svn: 196724
* Fix the message to go along with the assertion that was just fixed.Faisal Vali2013-12-081-1/+1
| | | | | | argh! llvm-svn: 196722
* Fix an assertion introduced by my previous refactoring.Faisal Vali2013-12-081-6/+4
| | | | | | Add back the test that was triggering the assertion (which I removed mistakenly thinking it was triggering just a warning and not an assertion). My error was brought to my attention by Rafael (Thanks!). llvm-svn: 196721
* Extend assembler handling for NetBSD/MIPS to pass down the correct ABI,Joerg Sonnenberger2013-12-081-5/+32
| | | | | | architecture and PIC flag. llvm-svn: 196720
* Fix pr18174.Rafael Espindola2013-12-081-1/+1
| | | | | | | | | | | | | | | Clang outputs LLVM one top level decl at a time. This combined with the visibility computation code looking for the newest NamespaceDecl would cause it to produce different results for nested namespaces. The two options for producing consistent results are * Delay codegen of anything inside a namespace until the end of the file. * Don't look for the newest NamespaceDecl. This patch implements the second option. This matches the gcc behavior too. llvm-svn: 196712
* [REFACTOR] Refactored some of the generic-lambda capturing code.Faisal Vali2013-12-073-135/+247
| | | | | | | | | | | | | | | Employed the following refactorings: - Renamed some functions - Introduced explaining variables - Cleaned up & added comments - Used Optional<unsigned> for return value instead of an out parameter - Added assertions - Constified a few member functions No functionality change. All regressions pass. llvm-svn: 196662
* CodeGen: Don't emit linkage on thunks that aren't emitted because they're ↵Benjamin Kramer2013-12-071-3/+4
| | | | | | | | | | | | vararg. This can happen when we're trying to emit a thunk with available_externally linkage with optimization enabled but bail because it doesn't make sense for vararg functions. PR18098. llvm-svn: 196658
* Eliminate the last trivial NDEBUG uses in clang headersAlp Toker2013-12-073-4/+7
| | | | | | assert(sanity()) reads so much better than preprocessor conditional blocks. llvm-svn: 196657
* CommentLexer: eliminate an NDEBUG from the headersAlp Toker2013-12-071-0/+13
| | | | | | Code in headers shouldn't be conditional on the build configuration. llvm-svn: 196656
* Changed ConditionValue argument to PPCallbacks If and Elif callbacks to be a ↵John Thompson2013-12-072-5/+5
| | | | | | 3-state enum. llvm-svn: 196648
* Tweak r196646Alp Toker2013-12-071-5/+3
| | | | | | | | | There was already a condition earlier in the function so just place the check there. Cleanup only. llvm-svn: 196647
* Type traits: No need for switch to handle __builtin_types_compatible_pAlp Toker2013-12-071-10/+4
| | | | | | | | | | | | __builtin_types_compatible_p() isn't a C++ type trait at all, rather a GNU C special-case, so it's fine to use BoolTy the default return type for binary type traits. This brings BTT in line with other arities that already default to BoolTy. Cleanup only, no change in behaviour. llvm-svn: 196646
* Add a SubsetSubject in Attr.td to automate checking of where the ↵Argyrios Kyrtzidis2013-12-071-17/+2
| | | | | | | | objc_designated_initializer attribute is acceptable. llvm-svn: 196644
* Give a more appropriate diagnostic when a template specialization orRichard Smith2013-12-071-31/+33
| | | | | | | instantiation appears in a non-enclosing namespace (the previous diagnostic talked about the C++98 rule even in C++11 mode). llvm-svn: 196642
* Pass correct flags to assembler and linker for OpenBSD on AMD64, PowerPCJoerg Sonnenberger2013-12-071-0/+39
| | | | | | and MIPS64. From Brad Smith. llvm-svn: 196630
* ObjectiveC. Continuing implementation of objc_bridge_relatedFariborz Jahanian2013-12-073-0/+123
| | | | | | | | | attribute in sema and issuing a variety of diagnostics lazily for misuse of this attribute (and what to do) when converting from CF types to ObjectiveC types (and vice versa). // rdar://15499111 llvm-svn: 196629
* Fixing assertion failure introduced in 196602.Warren Hunt2013-12-071-6/+4
| | | | | | Also includes a minor refactor with no functional change. llvm-svn: 196627
* Added support for mcpu kraitAna Pazos2013-12-064-7/+18
| | | | | | | | | | | | - krait processor currently modeled with the same features as A9. - Krait processor additionally has VFP4 (fused multiply add/sub) and hardware division features enabled. - krait has currently the same Schedule model as A9 - krait cpu flag is not recognized by the GNU assembler yet, it is replaced with march=armv7-a to avoid a lower march from being used. llvm-svn: 196618
* Add option to use temporary file for assembling with clangDavid Peixotto2013-12-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | This commit adds the flag '-via-file-asm' to the clang driver. The purpose of this flag is to have a way to test that clang can consume the assembly code that it outputs. When passed this flag, clang will generate a temporary file that contains the assembly output from the compile step. This assembly file will then be consumed by either the integrated assembler or the external assembler. To test that the integrated assembler can consume its own output compile with: $ clang -integrated-assembler -via-file-asm Without the '-via-file-asm' flag, clang would directly create the object file when using the integrated assembler. With the flag it will first create the temporary assembly file and then read that file and assemble it with the integrated assembler. The flow is similar to -save-temps, except that it only effects the assembly input and the temporary file is not saved. llvm-svn: 196606
* [MS-ABI] adds padding before all vbases after a bitfieldWarren Hunt2013-12-061-8/+7
| | | | | | | | | | MS-ABI adds padding before *every* vbase if the last field in a record is a bit-field. This changes clangs behavior to match. I also fix some windows-style line endings in the test file. Differential Revision: http://llvm-reviews.chandlerc.com/D2277 llvm-svn: 196605
* [MS-ABI] Fix alias-avoidance padding between basesWarren Hunt2013-12-062-63/+74
| | | | | | | | | | | Adds padding between bases or virtual bases in an attempt to avoid aliasing of zero-sized sub-objects. The approach used by the ABI adds two more bits of state. Detailed comments are in the code. Test cases included. Differential Revision: http://llvm-reviews.chandlerc.com/D2258 llvm-svn: 196602
* Revert "[analyzer] Refactor conditional expression evaluating code"Anna Zaks2013-12-063-92/+64
| | | | | | | | | | This reverts commit r189090. The original patch introduced regressions (see the added live-variables.* tests). The patch depends on the correctness of live variable analyses, which are not computed correctly. I've opened PR18159 to track the proper resolution to this problem. The patch was a stepping block to r189746. This is why part of the patch reverts temporary destructor tests that started crashing. The temporary destructors feature is disabled by default. llvm-svn: 196593
* Turning the __w64 attribute into an ignored attribute to match other ↵Aaron Ballman2013-12-062-5/+0
| | | | | | Microsoft extensions we do not currently support. Note that __w64 has been deprecated in MSVC since 2008. llvm-svn: 196592
* Move the body of GCCInstallationDetector ctor into an init() functionRoman Divacky2013-12-062-6/+8
| | | | | | | and call it from its only user. The linux toolchain. This saves quite a lot of directory searching on other platforms. llvm-svn: 196590
* Fix code typos spotted while working on type traitsAlp Toker2013-12-067-35/+35
| | | | llvm-svn: 196587
* Tweak the ordering of a conditional to possibly avoid a few strcmps.Aaron Ballman2013-12-061-1/+1
| | | | llvm-svn: 196584
* Reverting changes from r196415; this patch exposed a different, but ↵Aaron Ballman2013-12-061-1/+2
| | | | | | unrelated bug regarding the __has_attribute implementation. Reverting to unblock the Chrome tsan builds. llvm-svn: 196583
* clang-format: Change line break decisions for array subscripts.Daniel Jasper2013-12-061-1/+1
| | | | | | | | | | | Before: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<int> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [aaaaaaaaaaaa]; After: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<int> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaa]; llvm-svn: 196582
* Allow string literals as module names.Daniel Jasper2013-12-062-21/+3
| | | | | | | | | | | | | | | | | | In order to make the migration to modules easier, it seems to be helpful to allow a 1:1 mapping between target names of a current build system and the corresponding C++ modules. As such targets commonly contain characters like "-". ":" and "/", allowing arbitrary quote-escaped strings seems to be a straightforward option. After several offline discussions, the precise mechanisms for C++ module names especially regarding submodules and import statements has yet to be determined. Thus, this patch only enables string literals as names inside the module map files which can be used by automatic module import (through #include). Also improve the error message on missing use-declarations. llvm-svn: 196573
* PR18152: When computing the semantic form for an initializer list, keep trackRichard Smith2013-12-061-2/+2
| | | | | | of whether the initializer list is dependent. llvm-svn: 196558
* Support MS-ABI's concept of "Required Alignment" imposed by Warren Hunt2013-12-062-29/+61
| | | | | | | | | | | | | | | | | | __declspec(align()) This patch implements required alignment in a way that makes __declspec(align()) and #pragma pack play correctly together. In the MS-ABI, __declspec(align()) is a hard rule and cannot be overridden by #pragma pack. This cases each record to have two interesting alignments "preferred alignment" (which matches Itanium's concept of alignment) and "required alignment" which is an alignment that must never be violated, even in the case of #pragma pack. This patch introduces the concept of Required Alignment to the record builder and tracks/uses it appropriately. Test cases are included. Differential Revision: http://llvm-reviews.chandlerc.com/D2283 llvm-svn: 196549
* -Wassign-enum: compare unqualified typesDmitri Gribenko2013-12-051-2/+2
| | | | | | | | | | | | | | This commit changes -Wassign-enum to compare unqualified types. One could think that this does not matter much, because who wants a value of enum type that is const-qualified? But this breaks the intended pattern to silence this warning with an explicit cast: static const enum Foo z = (enum Foo) 42; In this case, source type is 'enum Foo', and destination type is 'const enum Foo', and if we compare qualified types, they don't match, so we used warn. llvm-svn: 196548
* Allow the warning 'case value not in enumerated type' to be silenced withDmitri Gribenko2013-12-051-8/+39
| | | | | | | | | | the following pattern. If 'case' expression refers to a static const variable of the correct enum type, then we count this as a sufficient declaration of intent by the user, so we silence the warning. llvm-svn: 196546
* [ms-cxxabi] bitcast to i8* to deref a data member pointerReid Kleckner2013-12-051-0/+5
| | | | | | | | This was causing us to miscompile llvm::SymbolTableListTraits::getListOwner(), which uses data member pointers. llvm-svn: 196545
* For NetBSD, use arm1176jzf-s as default CPU for ARMv6.Joerg Sonnenberger2013-12-052-0/+10
| | | | llvm-svn: 196538
* Pass down the target CPU to the system assembler for NetBSD/ARM.Joerg Sonnenberger2013-12-051-0/+7
| | | | llvm-svn: 196532
* ObjectiveC: Don't warn when method implemented inFariborz Jahanian2013-12-051-11/+23
| | | | | | | | category is declared in category's primary class's super class. Because the super class is expected to implemented the method. // rdar://15580969 llvm-svn: 196531
OpenPOWER on IntegriCloud