summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Split ubsan runtime into three pieces (clang part):Richard Smith2013-03-201-11/+27
| | | | | | | | | | | | | | | | | | | | | | | | * libclang_rt-san-* is sanitizer_common, and is linked in only if no other sanitizer runtime is present. * libclang_rt-ubsan-* is the piece of the runtime which doesn't depend on a C++ ABI library, and is always linked in. * libclang_rt-ubsan_cxx-* is the piece of the runtime which depends on a C++ ABI library, and is only linked in when linking a C++ binary. This change also switches us to using -whole-archive for the ubsan runtime (which is made possible by the above split), and switches us to only linking the sanitizer runtime into the main binary and not into DSOs (which is made possible by using -whole-archive). The motivation for this is to only link a single copy of sanitizer_common into any binary. This is becoming important now because we want to share more state between multiple sanitizers in the same process (for instance, we want a single shared output mutex). The Darwin ubsan runtime is unchanged; because we use a DSO there, we don't need this complexity. llvm-svn: 177605
* [ms-cxxabi] Mangle function pointer template arguments correctlyReid Kleckner2013-03-201-1/+3
| | | | | | | | | | Reviewers: rjmccall CC: timurrrr, llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D554 llvm-svn: 177589
* [analyzer] Appease buildbots: include template arguments in base class ref.Jordan Rose2013-03-201-1/+1
| | | | llvm-svn: 177583
* Documentation cleanup for MacroInfo.James Dennett2013-03-201-4/+4
| | | | | | | | | | | | | | * Clarify what MacroInfo::isBuiltinMacro means, as it really means something more like "isMagicalMacro" or "requiresProcessingBeforeExpansion" -- the macros defined in "<built-in>" are not considered built-in by this function; * Escape __LINE__ as \__LINE__ in Doxygen comments so that the underscores don't get replaced by *bold* output; * Turn comments in MacroInfo.cpp into non-Doxygen comments, so that they don't result in duplicated/badly formatted Doxygen output; * Clean up a bunch of \brief formatting, and add a \file comment for MacroInfo.h. llvm-svn: 177581
* <rdar://problem/12368093> Extend module maps with a 'conflict' declaration, ↵Douglas Gregor2013-03-207-43/+216
| | | | | | and warn when a newly-imported module conflicts with an already-imported module. llvm-svn: 177577
* [analyzer] Don't invalidate globals when there's no call involved.Jordan Rose2013-03-201-11/+9
| | | | | | | | | | | | | | This fixes some mistaken condition logic in RegionStore that caused global variables to be invalidated when /any/ region was invalidated, rather than only as part of opaque function calls. This was only being used by CStringChecker, and so users will now see that strcpy() and friends do not invalidate global variables. Also, add a test case we don't handle properly: explicitly-assigned global variables aren't being invalidated by opaque calls. This is being tracked by <rdar://problem/13464044>. llvm-svn: 177572
* [analyzer] Track malloc'd memory into struct fields.Jordan Rose2013-03-201-6/+0
| | | | | | | | | | | | | | | Due to improper modelling of copy constructors (specifically, their const reference arguments), we were producing spurious leak warnings for allocated memory stored in structs. In order to silence this, we decided to consider storing into a struct to be the same as escaping. However, the previous commit has fixed this issue and we can now properly distinguish leaked memory that happens to be in a struct from a buffer that escapes within a struct wrapper. Originally applied in r161511, reverted in r174468. <rdar://problem/12945937> llvm-svn: 177571
* [analyzer] Invalidate regions indirectly accessible through const pointers.Jordan Rose2013-03-203-66/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | In this case, the value of 'x' may be changed after the call to indirectAccess: struct Wrapper { int *ptr; }; void indirectAccess(const Wrapper &w); void test() { int x = 42; Wrapper w = { x }; clang_analyzer_eval(x == 42); // TRUE indirectAccess(w); clang_analyzer_eval(x == 42); // UNKNOWN } This is important for modelling return-by-value objects in C++, to show that the contents of the struct are escaping in the return copy-constructor. <rdar://problem/13239826> llvm-svn: 177570
* [analyzer] Remove strip of ElementRegion in CallEvent::invalidateRegions.Jordan Rose2013-03-201-26/+0
| | | | | | | | | | | | | | This is a bit of old code trying to deal with the fact that functions that take pointers often use them to access an entire array via pointer arithmetic. However, RegionStore already conservatively assumes you can use pointer arithmetic to access any part of a region. Some day we may want to go back to handling this specifically for calls, but we can do that in the future. No functionality change. llvm-svn: 177569
* Do the error recovery for @end only.Fariborz Jahanian2013-03-201-4/+7
| | | | | | | | I am not sure how much we can improve for when a randon ObjC keyword is thrown into the ivar decl. block. // rdar://6854840 llvm-svn: 177553
* Objective-C [qoi] more gracefull recovery when Fariborz Jahanian2013-03-201-17/+28
| | | | | | | '}' is missing for the ivar declarations. // rdar://6854840 llvm-svn: 177549
* PR7256: Provide a fixit for incorrect destructor declarationsDavid Blaikie2013-03-201-2/+10
| | | | | | Fix by Ismail Pazarbasi (ismail.pazarbasi@gmail.com), review by Dmitri Gribenko. llvm-svn: 177546
* Only introduce the SDKSettings.plist dependency in modules/PCH files that ↵Douglas Gregor2013-03-201-1/+1
| | | | | | don't depend on any other modules or PCH files. llvm-svn: 177542
* Exploit this-return of a callsite in a this-return function.Manman Ren2013-03-207-12/+64
| | | | | | | | | | | | | | For constructors/desctructors that return 'this', if there exists a callsite that returns 'this' and is immediately before the return instruction, make sure we are using the return value from the callsite. We don't need to keep 'this' alive through the callsite. It also enables optimizations in the backend, such as tail call optimization. Updated from r177211. rdar://12818789 llvm-svn: 177541
* Support for pointers-to-members usage via .*Alexander Kornienko2013-03-201-2/+4
| | | | | | | | | | | | | | Summary: Added support for pointers-to-members usage via .* and a few tests. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D556 llvm-svn: 177537
* Remove assertion that can be triggered on bad input.Daniel Jasper2013-03-201-2/+1
| | | | | | | clang-format can't do anything useful, so it should leave the remainder of the line unchanged, but it should not assert/segfault. llvm-svn: 177530
* Fix infinite-loop in unwrapped line parser.Daniel Jasper2013-03-201-1/+1
| | | | | | Discovered when accidentally formatting a python file :-). llvm-svn: 177527
* Do not consider comments when adjusting to local indent style.Daniel Jasper2013-03-201-1/+2
| | | | | | | | | | | | | | | | Before (when only reformatting "int b"): int a; // comment // comment int b; After: int a; // comment // comment int b; This also fixes llvm.org/PR15433. llvm-svn: 177524
* Reduce penalty for breaks after "(" for functions with parameters.Daniel Jasper2013-03-202-3/+3
| | | | | | | | | | | | | Before: aaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: aaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); llvm-svn: 177521
* Add extra indentation for multiline comparisons.Daniel Jasper2013-03-203-31/+30
| | | | | | | | | | | | | | | | This seems to be generally more desired. Before: if (aaaaaaaa && bbbbbbbb > cccccccc) {} After: if (aaaaaaaa && bbbbbbbb > cccccccc) {} Also: Some formatting cleanup on clang-format's files. llvm-svn: 177514
* Don't remove all indentation when in #defines.Daniel Jasper2013-03-201-1/+1
| | | | | | | | | | Otherwise, this can become hard to read. Before: #define A \ case 1: After: #define A \ case 1: llvm-svn: 177509
* Improve formatting of function types in template parameters.Daniel Jasper2013-03-201-3/+9
| | | | | | Before: A<int * (int)>; After: A<int *(int)>; llvm-svn: 177505
* Fix redundant comparison in gcc::Common::ConstructJob.Hans Wennborg2013-03-201-1/+1
| | | | | | | | | | We were checking "Arch == llvm::Triple::x86_64 || Arch == llvm::Triple::x86_64", but the rhs should actually check for powerpc64. Found while experimenting with a potential new Clang warning. llvm-svn: 177496
* Remove some dead code.John McCall2013-03-201-11/+0
| | | | | | Patch by Stephen Lin! llvm-svn: 177490
* Make sure that Module::ConfigMacrosExhaustive gets initialized and ↵Douglas Gregor2013-03-202-6/+10
| | | | | | | | | deserialized correctly. This fixes regressions introduced in r177466 that caused several module tests to fail sporadically. llvm-svn: 177481
* Teach statement / declaration disambiguation about C++11-style generalized ↵Richard Smith2013-03-201-7/+21
| | | | | | initializers. llvm-svn: 177480
* Remove the Tools DensMap from the toolchain.Rafael Espindola2013-03-204-165/+204
| | | | | | | | | | Each toolchain has a set of tools, but they are all of known types. It can have a linker, an assembler, a "clang" (compile, analyze, ...) a non-clang compiler, etc. Instead of keeping a map, just have member variable for each type of tool. llvm-svn: 177479
* The flag "-coverage-function-names-in-data" is actually backwards -- we doNick Lewycky2013-03-202-4/+3
| | | | | | | | | | emit function names in .gcda files by default, and the flag turns that off! Rename the flag to make it match what it actually does. This keeps the default format compatible with gcc 4.2. Also add a test for this flag. llvm-svn: 177475
* Don't look outside the innermost enclosing namespace whenJohn McCall2013-03-201-0/+23
| | | | | | | | performing unqualified lookup for a friend class declaration. rdar://13393749 llvm-svn: 177473
* [ms-cxxabi] Fix assertion on unhandled function template arg typesReid Kleckner2013-03-201-49/+22
| | | | | | | | | | | | This code was changed in r158376 to get template argument source info for better diagnostics, but the current code asserts for any kind of unsupported template argument before it can issue a diagnostic. This change goes back to the Itanium implementation of isTemplate() and puts the argument index into the diagnostic instead of a source location. Review URL: http://llvm-reviews.chandlerc.com/D553 llvm-svn: 177471
* Make clang emit linkage names in debug info for subprograms when coverage infoNick Lewycky2013-03-203-3/+10
| | | | | | | is enabled. Also add a new -test-coverage cc1 flag which makes testing coverage possible and add our first clang-side coverage test. llvm-svn: 177470
* [analyzer] Re-apply "Do part of the work to find shortest bug paths up front".Jordan Rose2013-03-201-43/+126
| | | | | | | | | | With the assurance that the trimmed graph does not contain cycles, this patch is safe (with a few tweaks), and provides the performance boost it was intended to. Part of performance work for <rdar://problem/13433687>. llvm-svn: 177469
* [analyzer] Break cycles (optionally) when trimming an ExplodedGraph.Jordan Rose2013-03-202-3/+19
| | | | | | | | | Having a trimmed graph with no cycles (a DAG) is much more convenient for trying to find shortest paths, which is exactly what BugReporter needs to do. Part of the performance work for <rdar://problem/13433687>. llvm-svn: 177468
* <rdar://problem/10796651> Introduce configuration macros into module maps.Douglas Gregor2013-03-205-6/+213
| | | | | | | | | | | | | | | | | | | | | | Configuration macros are macros that are intended to alter how a module works, such that we need to build different module variants for different values of these macros. A module can declare its configuration macros, in which case we will complain if the definition of a configation macro on the command line (or lack thereof) differs from the current preprocessor state at the point where the module is imported. This should eliminate some surprises when enabling modules, because "#define CONFIG_MACRO ..." followed by "#include <module/header.h>" would silently ignore the CONFIG_MACRO setting. At least it will no longer be silent about it. Configuration macros are eventually intended to help reduce the number of module variants that need to be built. When the list of configuration macros for a module is exhaustive, we only need to consider the settings for those macros when building/finding the module, which can help isolate modules for various project-specific -D flags that should never affect how modules are build (but currently do). llvm-svn: 177466
* [analyzer] Do not believe lazy binding when symbolic region types do not matchAnna Zaks2013-03-191-5/+16
| | | | | | | | | | | This fixes a crash when analyzing LLVM that was exposed by r177220 (modeling of trivial copy/move assignment operators). When we look up a lazy binding for “Builder”, we see the direct binding of Loc at offset 0. Previously, we believed the binding, which led to a crash. Now, we do not believe it as the types do not match. llvm-svn: 177453
* Revert "[analyzer] Do part of the work to find shortest bug paths up front."Jordan Rose2013-03-191-115/+42
| | | | | | | | | | | | | The whole reason we were doing a BFS in the first place is because an ExplodedGraph can have cycles. Unfortunately, my removeErrorNode "update" doesn't work at all if there are cycles. I'd still like to be able to avoid doing the BFS every time, but I'll come back to it later. This reverts r177353 / 481fa5071c203bc8ba4f88d929780f8d0f8837ba. llvm-svn: 177448
* Objective-C [qoi]: Provide improved parse diagnostics whenFariborz Jahanian2013-03-191-0/+4
| | | | | | | | | closing rbrace is missing in an ObjC class declaration. Can do beter than this, but it involves addition of overhead which will be present in correct code. // rdar://6854840 llvm-svn: 177435
* Fix indentation for case: // comment.Daniel Jasper2013-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Before: switch (x) { case 1: // Do amazing stuff { g(); f(); } } After: switch (x) { case 1: // Do amazing stuff { g(); f(); } } llvm-svn: 177420
* Split long lines in multi-line comments.Alexander Kornienko2013-03-191-57/+147
| | | | | | | | | | | | | | Summary: This is implementation for /* */ comments only. Reviewers: djasper, klimek Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D547 llvm-svn: 177415
* Don't try to set attributes in alias, they have none.Rafael Espindola2013-03-191-1/+3
| | | | llvm-svn: 177402
* Revert r177329.Rafael Espindola2013-03-191-2/+1
| | | | | | | | | If this should not happen, we should have an assert. If it should happen, we should have a test and remove the comment. In no case should we have this self inconsistent code. llvm-svn: 177399
* Go back to using the integrated assembler on windows ever when passedRafael Espindola2013-03-191-2/+3
| | | | | | -no-integrated-as. It is the only assembler we have there. llvm-svn: 177398
* [ASan] Make -fsanitize=address always imply -fsanitize=init-orderAlexey Samsonov2013-03-192-11/+9
| | | | llvm-svn: 177391
* Add a clarifying note when a return statement is rejected becauseJohn McCall2013-03-195-27/+116
| | | | | | | | we expect a related result type. rdar://12493140 llvm-svn: 177378
* Minor optimization to r177367 to treat a module with missing dependencies as ↵Douglas Gregor2013-03-191-1/+1
| | | | | | out-of-date rather than missing. llvm-svn: 177369
* Finish refactoring the tool selection logic.Rafael Espindola2013-03-194-48/+26
| | | | | | | | | The general pattern now is that Foobar::constructTool only creates tools defined in the tools::foobar namespace and then delegates to the parent. The remaining duplicated code is now in the tools themselves. llvm-svn: 177368
* <rdar://problem/13363214> Eliminate race condition between module rebuild ↵Douglas Gregor2013-03-197-286/+323
| | | | | | | | | | | | | | | | | | | | | | | | | | and the global module index. The global module index was querying the file manager for each of the module files it knows about at load time, to prune out any out-of-date information. The file manager would then cache the results of the stat() falls used to find that module file. Later, the same translation unit could end up trying to import one of the module files that had previously been ignored by the module cache, but after some other Clang instance rebuilt the module file to bring it up-to-date. The stale stat() results in the file manager would trigger a second rebuild of the already-up-to-date module, causing failures down the line. The global module index now lazily resolves its module file references to actual AST reader module files only after the module file has been loaded, eliminating the stat-caching race. Moreover, the AST reader can communicate to its caller that a module file is missing (rather than simply being out-of-date), allowing us to simplify the module-loading logic and allowing the compiler to recover if a dependent module file ends up getting deleted. llvm-svn: 177367
* PR15383: When -fsanitize=float-cast-overflow checks a float-to-int conversion,Richard Smith2013-03-191-8/+24
| | | | | | | | it wasn't taking into account that the float should be truncated *before* the range check happens. Thus (unsigned)-0.99 and (unsigned char)255.9 have defined behavior and should not be trapped. llvm-svn: 177362
* Centralize the logic for using the integrated assembler.Rafael Espindola2013-03-183-41/+13
| | | | llvm-svn: 177360
* documentation comment parsing. Added couple of Fariborz Jahanian2013-03-181-2/+8
| | | | | | | | top-level HeaderDoc tags @functiongroup and @methodgroup to doc. tags recognized. // rdar://12379114 llvm-svn: 177358
OpenPOWER on IntegriCloud