summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Enable SafeStack on all Linux platforms.Evgeniy Stepanov2015-09-241-1/+1
| | | | llvm-svn: 248518
* [analyzer] When memcpy'ing into a fixed-size array, do not invalidate entire ↵Devin Coughlin2015-09-242-9/+176
| | | | | | | | | | | | | | | | | | | | region. Change the analyzer's modeling of memcpy to be more precise when copying into fixed-size array fields. With this change, instead of invalidating the entire containing region the analyzer now invalidates only offsets for the array itself when it can show that the memcpy stays within the bounds of the array. This addresses false positive memory leak warnings of the kind reported by krzysztof in https://llvm.org/bugs/show_bug.cgi?id=22954 (This is the second attempt, now with assertion failures resolved.) A patch by Pierre Gousseau! Differential Revision: http://reviews.llvm.org/D12571 llvm-svn: 248516
* Module Debugging: Emit submodules as nested DW_TAG_modules.Adrian Prantl2015-09-242-7/+12
| | | | llvm-svn: 248511
* Debug Info: Use the module pointer as key for the module cache.Adrian Prantl2015-09-242-6/+10
| | | | | | This way we don't need to rebuild the full module name for every decl. llvm-svn: 248510
* Refactor ASTSourceDescriptor to not store copies of all strings. (NFC)Adrian Prantl2015-09-242-7/+15
| | | | llvm-svn: 248509
* Drop useless const in for-range loops.Benjamin Kramer2015-09-244-11/+11
| | | | | | | | StringRefs always point to immutable memory so the const doesn't add value here. Also quiets clang's -Wrange-loop-analysis which warns about the implicit copying. llvm-svn: 248496
* [Driver] Don't implicitly copy std::strings in for-range loop.Benjamin Kramer2015-09-241-1/+1
| | | | | | Found by -Wrange-loop-analysis. llvm-svn: 248495
* [mips] Relax -mnan=2008 acceptance to permit MIPS32R2 and MIPS64R2.Daniel Sanders2015-09-241-2/+5
| | | | | | | | | | | | | | | Summary: Strictly speaking, the MIPS*R2 ISA's should not permit -mnan=2008 since this feature was added in MIPS*R3. However, other toolchains permit this and we should do the same. Reviewers: atanasyan Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13057 llvm-svn: 248481
* [ARM] Follow-up to fix crash "-target arm -mcpu=generic", without "-march="Vladimir Sukharev2015-09-241-1/+1
| | | | | | | | | | | Fix of dangling StringRef after temporary std::string is destroyed Follow-up to: http://reviews.llvm.org/rL248479 Reviewers: alexfh Subscribers: cfe-commits llvm-svn: 248480
* [ARM] Follow-up to fix crash "-target arm -mcpu=generic", without "-march="Vladimir Sukharev2015-09-241-3/+3
| | | | | | | | | | | Fix of dangling StringRef after temporary std::string is destroyed Follow-up to: http://reviews.llvm.org/rL248370 Reviewers: alexfh Subscribers: cfe-commits llvm-svn: 248479
* [Driver] Add support for Windows 10 SDKIgor Kudrin2015-09-242-68/+102
| | | | | | | | | | | | | | | | Summary: With Windows 10 SDK, Include and Lib directories now contain an additional subfolder with the name that corresponds to the full version of the SDK, for example: - C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\um - C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\x64 Reviewers: ruiu, rnk Subscribers: majnemer, cfe-commits Differential Revision: http://reviews.llvm.org/D12832 llvm-svn: 248463
* cuda-path: StringRef cannot be used here.NAKAMURA Takumi2015-09-241-1/+1
| | | | llvm-svn: 248459
* Improve the printing of ranges when macros are involved.Richard Trieu2015-09-242-30/+88
| | | | | | | | | | | | Trace the ranges through the macro backtrace better. This allows better range highlighting through all levels of the macro bracktrace. Also some improvements to backtrace printer for omitting different backtraces. Patch by Zhengkai Wu. Differential Revision: http://reviews.llvm.org/D12379 llvm-svn: 248454
* [analyzer] Discard malloc-overflow bug-report when a known size is malloc'ed.Devin Coughlin2015-09-231-33/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch ignores malloc-overflow bug in two cases: Case1: x = a/b; where n < b malloc (x*n); Then x*n will not overflow. Case2: x = a; // when 'a' is a known value. malloc (x*n); Also replaced isa with dyn_cast. Reject multiplication by zero cases in MallocOverflowSecurityChecker Currently MallocOverflowSecurityChecker does not catch cases like: malloc(n * 0 * sizeof(int)); This patch rejects such cases. Two test cases added. malloc-overflow2.c has an example inspired from a code in linux kernel where the current checker flags a warning while it should not. A patch by Aditya Kumar! Differential Revision: http://reviews.llvm.org/D9924 llvm-svn: 248446
* [darwin] [builtins] Stop generating cc_kext_ios5 and move iOS architectures ↵Chris Bieneman2015-09-231-5/+3
| | | | | | | | | | | | | | | | | out of cc_kext into cc_kext_ios Summary: This corresponds to a patch to compiler-rt (D13112). Xcode 7 doesn't support targeting iOS5 and earlier. Instead of just dropping cc_kext_ios5, I've repurposed it to cc_kext_ios, and I'm pulling the iOS architectures out of cc_kext. Putting OS X and iOS slices inside the same archive was just odd. Reviewers: bogner, bob.wilson Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13113 llvm-svn: 248442
* Forbid qualifiers on ObjC generic parameters and arguments, butJohn McCall2015-09-234-23/+124
| | | | | | | | | | | | | | silently ignore them on arguments when they're provided indirectly (.e.g behind a template argument or typedef). This is mostly just good language design --- specifying that a generic argument is __weak doesn't actually do anything --- but it also prevents assertions when trying to apply a different ownership qualifier. rdar://21612439 llvm-svn: 248436
* Remove warning on over-wide bit-field of boolean type; there's no risk thatRichard Smith2015-09-231-3/+8
| | | | | | | | | | someone thought all the bits would be value bits in this case. Also fix the wording of the warning -- it claimed that the width of 'bool' is 8, which is not correct; the width is 1 bit, whereas the size is 8 bits in our implementation. llvm-svn: 248435
* [CUDA] Added CUDA installation detector class.Artem Belevich2015-09-232-1/+77
| | | | | | | | | | | Added new option --cuda-path=<path> which allows overriding default search paths. If it's not specified we look for CUDA installation in /usr/include/cuda and /usr/include/cuda-7.0. Differential Revision: http://reviews.llvm.org/D12989 llvm-svn: 248433
* [analyzer] Improve localizability checks for iOS / OS X.Devin Coughlin2015-09-232-97/+707
| | | | | | | | | | | | | | | | | | | | Various improvements to the localization checker: * Adjusted copy to be consistent with diagnostic text in other Apple API checkers. * Added in ~150 UIKit / AppKit methods that require localized strings in UnlocalizedStringsChecker. * UnlocalizedStringChecker now checks for UI methods up the class hierarchy and UI methods that conform for a certain Objective-C protocol. * Added in alpha version of PluralMisuseChecker and some regression tests. False positives are still not ideal. (This is the second attempt, with the memory issues on Linux resolved.) A patch by Kulpreet Chilana! Differential Revision: http://reviews.llvm.org/D12417 llvm-svn: 248432
* PR14858: Initial support for proper sizeof... handling within alias templates.Richard Smith2015-09-238-54/+161
| | | | | | | This doesn't quite get alias template equivalence right yet, but handles the egregious cases where we would silently give the wrong answers. llvm-svn: 248431
* Remove wrong implication that value-dependent implies instantiation-dependent,Richard Smith2015-09-231-0/+2
| | | | | | | | | and fix the only code that was depending on this so that it sets all the relevant flags appropriately. No functionality change intended. llvm-svn: 248430
* Support linking against OpenMP runtime on NetBSD.Joerg Sonnenberger2015-09-231-0/+1
| | | | llvm-svn: 248426
* Push OpenMP linker flags after linker input on Darwin. Don't add anyJoerg Sonnenberger2015-09-231-2/+4
| | | | | | libraries if -nostdlib is specified. Test. llvm-svn: 248424
* Reverted r248408 "[CUDA] Added CUDA installation detector class."Artem Belevich2015-09-232-77/+1
| | | | | | because included test fails on some platforms. llvm-svn: 248413
* [CUDA] Added CUDA installation detector class.Artem Belevich2015-09-232-1/+77
| | | | | | | | | | | Added new option --cuda-path=<path> which allows overriding default search paths. If it's not specified we look for CUDA installation in /usr/include/cuda and /usr/include/cuda-7.0. Differential Revision: http://reviews.llvm.org/D12989 llvm-svn: 248408
* [CUDA] __global__ functions should always be visible externally.Artem Belevich2015-09-232-9/+6
| | | | | | | | | Adjust __global__ functions with DiscardableODR linkage to use StrongODR linkage instead, so they are visible externally. Differential Revision: http://reviews.llvm.org/D13067 llvm-svn: 248400
* [Lex] A source-file new-line in a raw string literal results in a new-lineDavid Majnemer2015-09-231-4/+17
| | | | | | | | | Our string literal parser copied any source-file new-line characters into the execution string-literal. This is incorrect if the source-file new-line character was a \r\n sequence because new-line characters are merely \n. llvm-svn: 248392
* [Sema] Don't create an invalid source range for overlong initializer lists.Benjamin Kramer2015-09-231-2/+4
| | | | | | | | | We took both source locations from the end of the initializer list what the code below doesn't expect. This can lead to a crash when rendering the diagnostic (PR24816). Assert that we have more than one element in a scalar initializer with too many elements. llvm-svn: 248391
* Refactor library decision for -fopenmp support from Darwin into aJoerg Sonnenberger2015-09-231-17/+23
| | | | | | function for sharing with other platforms. llvm-svn: 248379
* Add -fplugin=name.so option to the driverJohn Brawn2015-09-231-0/+7
| | | | | | | | This translates to -load name.so in the cc1 command. We can't name the driver option -load, as that means "link against oad", so instead we follow GCC's lead and name the option -fplugin. llvm-svn: 248378
* [DeclPrinter] Don't crash when printing a using decl with a special nameBenjamin Kramer2015-09-231-1/+1
| | | | | | Fixes PR24872. llvm-svn: 248376
* Fix bad iterator access.Daniel Jasper2015-09-231-1/+2
| | | | llvm-svn: 248375
* [ARM] Fix crash "-target arm -mcpu=generic", without "-march="Vladimir Sukharev2015-09-233-12/+18
| | | | | | | | | | | | | | | | An assertion hit has been fixed for cmdlines like $ clang --target=arm-linux-gnueabi -mcpu=generic hello.c Related to: http://reviews.llvm.org/rL245445 Reviewers: rengolin Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13013 llvm-svn: 248370
* clang-format: Add initial #include sorting capabilities.Daniel Jasper2015-09-233-3/+235
| | | | | | | | | To implement this nicely, add a function that merges two sets of replacements that are meant to be done in sequence. This functionality will also be useful for other applications, e.g. formatting the result of clang-tidy fixes. llvm-svn: 248367
* Revert "[analyzer] Improve localizability checks for iOS / OS X."Devin Coughlin2015-09-232-707/+97
| | | | | | This reverts commit r248350. The pluralization checks are failing on some bots. llvm-svn: 248351
* [analyzer] Improve localizability checks for iOS / OS X.Devin Coughlin2015-09-222-97/+707
| | | | | | | | | | | | | | | | | | Various improvements to the localization checker: * Adjusted copy to be consistent with diagnostic text in other Apple API checkers. * Added in ~150 UIKit / AppKit methods that require localized strings in UnlocalizedStringsChecker. * UnlocalizedStringChecker now checks for UI methods up the class hierarchy and UI methods that conform for a certain Objective-C protocol. * Added in alpha version of PluralMisuseChecker and some regression tests. False positives are still not ideal. A patch by Kulpreet Chilana! Differential Revision: http://reviews.llvm.org/D12417 llvm-svn: 248350
* Module Debugging: Use the clang module signature as the module's dwo_idAdrian Prantl2015-09-224-2/+12
| | | | | | | | | | | when building a module. Clang already records the module signature when building a skeleton CU to reference a clang module. Matching the id in the skeleton with the one in the module allows a DWARF consumer to verify that they found the correct version of the module without them needing to know about the clang module format. llvm-svn: 248345
* Serialization: Let ASTWriter return the signature of the written module.Adrian Prantl2015-09-221-15/+22
| | | | | | NFC llvm-svn: 248344
* [analyzer] Make realloc(ptr, 0) handling equivalent to malloc(0).Devin Coughlin2015-09-221-13/+25
| | | | | | | | | | | | | | | | | | Currently realloc(ptr, 0) is treated as free() which seems to be not correct. C standard (N1570) establishes equivalent behavior for malloc(0) and realloc(ptr, 0): "7.22.3 Memory management functions calloc, malloc, realloc: If the size of the space requested is zero, the behavior is implementation-defined: either a null pointer is returned, or the behavior is as if the size were some nonzero value, except that the returned pointer shall not be used to access an object." The patch equalizes the processing of malloc(0) and realloc(ptr,0). The patch also enables unix.Malloc checker to detect references to zero-allocated memory returned by realloc(ptr,0) ("Use of zero-allocated memory" warning). A patch by Антон Ярцев! Differential Revision: http://reviews.llvm.org/D9040 llvm-svn: 248336
* [analyzer] Create one state for a range switch case instead of multiple.Devin Coughlin2015-09-225-77/+250
| | | | | | | | | | | | | This fixes PR16833, in which the analyzer was using large amounts of memory for switch statements with large case ranges. rdar://problem/14685772 A patch by Aleksei Sidorin! Differential Revision: http://reviews.llvm.org/D5102 llvm-svn: 248318
* Analyzer: Teach analyzer how to handle TypeTraitExprIsmail Pazarbasi2015-09-223-2/+8
| | | | | | | | | | | | | | | | | | | | Summary: `TypeTraitExpr`s are not supported by the ExprEngine today. Analyzer creates a sink, and aborts the block. Therefore, certain bugs that involve type traits intrinsics cannot be detected (see PR24710). This patch creates boolean `SVal`s for `TypeTraitExpr`s, which are evaluated by the compiler. Test within the patch is a summary of PR24710. Reviewers: zaks.anna, dcoughlin, krememek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D12482 llvm-svn: 248314
* [CUDA] Allow parsing of host and device code simultaneously.Artem Belevich2015-09-228-44/+90
| | | | | | | | | | | | * adds -aux-triple option to specify target triple * propagates aux target info to AST context and Preprocessor * pulls in target specific preprocessor macros. * pulls in target-specific builtins from aux target. * sets appropriate host or device attribute on builtins. Differential Revision: http://reviews.llvm.org/D12917 llvm-svn: 248299
* Augmented CudaHostAction to carry device-side triple.Artem Belevich2015-09-222-10/+11
| | | | | | Differential Revision: http://reviews.llvm.org/D12893 llvm-svn: 248298
* [CUDA] Fixes minor cuda-related issues in the driverArtem Belevich2015-09-221-13/+20
| | | | | | | | | | * Only the last of the --cuda-host-only/--cuda-device-only options has effect. * CudaHostAction always wraps host-side compilation now. * Fixed printing of empty action lists. Differential Revision: http://reviews.llvm.org/D12892 llvm-svn: 248297
* [CUDA] Add appropriate host/device attribute to builtins.Artem Belevich2015-09-222-1/+13
| | | | | | | | | The changes are part of attribute-based CUDA function overloading (D12453) and as such are only enabled when it's in effect (-fcuda-target-overloads). Differential Revision: http://reviews.llvm.org/D12122 llvm-svn: 248296
* [CUDA] Allow function overloads in CUDA based on host/device attributes.Artem Belevich2015-09-225-1/+194
| | | | | | | | | | | | | | | | | | | The patch makes it possible to parse CUDA files that contain host/device functions with identical signatures, but different attributes without having to physically split source into host-only and device-only parts. This change is needed in order to parse CUDA header files that have a lot of name clashes with standard include files. Gory details are in design doc here: https://goo.gl/EXnymm Feel free to leave comments there or in this review thread. This feature is controlled with CC1 option -fcuda-target-overloads and is disabled by default. Differential Revision: http://reviews.llvm.org/D12453 llvm-svn: 248295
* [CUDA] Add implicit __attribute__((used)) to all __global__ functions.Artem Belevich2015-09-221-0/+4
| | | | | | | | | | This makes sure that we emit kernels that were instantiated from the host code and which would never be explicitly referenced by anything else on device side. Differential Revision: http://reviews.llvm.org/D11666 llvm-svn: 248293
* [tooling] Provide the compile commands of the JSON database in the order ↵Argyrios Kyrtzidis2015-09-221-7/+4
| | | | | | | | | | | that they were provided in the JSON file. This is useful for debugging of issues and reduction of test cases. For example, an issue may show up due to the order that some commands were processed. It is convenient to be able to remove commands from the file and still preserve the order that they are returned, instead of getting a completely different order when removing a few commands. llvm-svn: 248292
* [mips] Added support for using the command line options -Wa,-msoft-float and ↵Daniel Sanders2015-09-221-0/+6
| | | | | | | | | | | | | | -Wa,-mhard-float. Patch by Scott Egerton. Reviewers: vkalintiris, dsanders Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D12600 llvm-svn: 248276
* clang-format: Fix alignConsecutiveAssignments.Daniel Jasper2015-09-221-34/+44
| | | | | | | | | | | | | It wasn't correctly handling this case: int oneTwoThree = 123; int oneTwo = 12; method(); Review: http://reviews.llvm.org/D12369 Patch by Beren Minor. Thank you! llvm-svn: 248254
OpenPOWER on IntegriCloud