summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Make clang to mark static stack allocations with lifetime markers to enable ↵Nadav Rotem2013-03-236-9/+150
| | | | | | | | | a more aggressive stack coloring. Patch by John McCall with help by Shuxin Yang. rdar://13115369 llvm-svn: 177819
* Revert svn r176894 and r177658.Bob Wilson2013-03-231-11/+10
| | | | | | | | | | | Changing -ccc-install-dir to affect cc1's resource-dir setting broke our internal LNT tests. After discussing the situation with Jim, we've decided to pursue an alternate approach. We really want the resource-dir to be located relative to clang, even when using -ccc-install-dir, but we're going to add a fallback setting for the libc++ headers if they don't exist alongside the compiler. llvm-svn: 177815
* Under ARC, when we're passing the address of a strong variableJohn McCall2013-03-235-19/+111
| | | | | | | | | | | | to an out-parameter using the indirect-writeback conversion, and we copied the current value of the variable to the temporary, make sure that we register an intrinsic use of that value with the optimizer so that the value won't get released until we have a chance to retain it. rdar://13195034 llvm-svn: 177813
* Strip off local qualifiers when converting from RecordType toRichard Trieu2013-03-231-1/+1
| | | | | | | TemplateSpecializationType during template type diffing. This allows the correct printing of diffing qualifiers on templates. llvm-svn: 177809
* [analyzer] Teach constraint managers about unsigned comparisons.Jordan Rose2013-03-233-20/+35
| | | | | | | | | | | In C, comparisons between signed and unsigned numbers are always done in unsigned-space. Thus, we should know that "i >= 0U" is always true, even if 'i' is signed. Similarly, "u >= 0" is also always true, even though '0' is signed. Part of <rdar://problem/13239003> (false positives related to std::vector) llvm-svn: 177806
* [analyzer] Loc-Loc operations (subtraction or comparison) produce a NonLoc.Jordan Rose2013-03-232-8/+8
| | | | | | | | | | For two concrete locations, we were producing another concrete location and then casting it to an integer. We should just create a nonloc::ConcreteInt to begin with. No functionality change. llvm-svn: 177805
* [analyzer] Also transform "a < b" to "(b - a) > 0" in the constraint manager.Jordan Rose2013-03-231-15/+17
| | | | | | | | | | | | We can support the full range of comparison operations between two locations by canonicalizing them as subtraction, as in the previous commit. This won't work (well) if either location includes an offset, or (again) if the comparisons are not consistent about which region comes first. <rdar://problem/13239003> llvm-svn: 177803
* Add reverseComparisonOp and negateComparisonOp to BinaryOperator.Jordan Rose2013-03-232-46/+5
| | | | | | ...and adopt them in the analyzer. llvm-svn: 177802
* [analyzer] Translate "a != b" to "(b - a) != 0" in the constraint manager.Jordan Rose2013-03-233-23/+44
| | | | | | | | | | | | | | | | | | | | | | | Canonicalizing these two forms allows us to better model containers like std::vector, which use "m_start != m_finish" to implement empty() but "m_finish - m_start" to implement size(). The analyzer should have a consistent interpretation of these two symbolic expressions, even though it's not properly reasoning about either one yet. The other unfortunate thing is that while the size() expression will only ever be written "m_finish - m_start", the comparison may be written "m_finish == m_start" or "m_start == m_finish". Right now the analyzer does not attempt to canonicalize those two expressions, since it doesn't know which length expression to pick. Doing this correctly will probably require implementing unary minus as a new SymExpr kind (<rdar://problem/12351075>). For now, the analyzer inverts the order of arguments in the comparison to build the subtraction, on the assumption that "begin() != end()" is written more often than "end() != begin()". This is purely speculation. <rdar://problem/13239003> llvm-svn: 177801
* [analyzer] Use SymExprs to represent '<loc> - <loc>' and '<loc> == <loc>'.Jordan Rose2013-03-231-17/+22
| | | | | | | | | | We just treat this as opaque symbols, but even that allows us to handle simple cases where the same condition is tested twice. This is very common in the STL, which means that any project using the STL gets spurious errors. Part of <rdar://problem/13239003>. llvm-svn: 177800
* documentation parsing: when providing code completion commentFariborz Jahanian2013-03-231-2/+9
| | | | | | | for a getter used in property-dot syntax, if geter has its own comment use it. // rdar://12791315 llvm-svn: 177797
* [analyzer] Warn when a nil key or value are passed to NSMutableDictionary ↵Anna Zaks2013-03-231-16/+62
| | | | | | and ensure it works with subscripting. llvm-svn: 177789
* [analyzer] Correct the stale comment.Anna Zaks2013-03-231-3/+3
| | | | llvm-svn: 177788
* If a .syms file is available alongside a sanitizer runtime, pass it to theRichard Smith2013-03-232-4/+17
| | | | | | | | linker via --dynamic-list instead of using --export-dynamic. This reduces the size of the dynamic symbol table, and thus of the binary (in some cases by up to ~30%). llvm-svn: 177783
* Use RequireCompleteType() instead of isIncompleteType().Bill Wendling2013-03-221-1/+3
| | | | | | | | | | | | isIncompleteType() returns true or false for template types depending on whether the type is instantiated yet. In this context, that's arbitrary. The better way to check for a complete type is RequireCompleteType(). Thanks to Eli Friedman for noticing this! <rdar://problem/12700799> llvm-svn: 177768
* <rdar://problem/13479539> Only rebuild the global module cache when we're ↵Douglas Gregor2013-03-221-1/+2
| | | | | | | | allowed to. This eliminates excessive rebuilds of the global module cache. llvm-svn: 177766
* Revert "[analyzer] Break cycles (optionally) when trimming an ExplodedGraph."Jordan Rose2013-03-222-19/+3
| | | | | | | | | | | | | | The algorithm used here was ridiculously slow when a potential back-edge pointed to a node that already had a lot of successors. The previous commit makes this feature unnecessary anyway. This reverts r177468 / f4cf6b10f863b9bc716a09b2b2a8c497dcc6aa9b. Conflicts: lib/StaticAnalyzer/Core/BugReporter.cpp llvm-svn: 177765
* [analyzer] Use a forward BFS instead of a reverse BFS to find shortest paths.Jordan Rose2013-03-221-150/+93
| | | | | | | | | | | | | | | | | | | | | | | | | For a given bug equivalence class, we'd like to emit the report with the shortest path. So far to do this we've been trimming the ExplodedGraph to only contain relevant nodes, then doing a reverse BFS (starting at all the error nodes) to find the shortest paths from the root. However, this is fairly expensive when we are suppressing many bug reports in the same equivalence class. r177468-9 tried to solve this problem by breaking cycles during graph trimming, then updating the BFS priorities after each suppressed report instead of recomputing the whole thing. However, breaking cycles is not a cheap operation because an analysis graph minus cycles is still a DAG, not a tree. This fix changes the algorithm to do a single forward BFS (starting from the root) and to use that to choose the report with the shortest path by looking at the error nodes with the lowest BFS priorities. This was Anna's idea, and has the added advantage of requiring no update step: we can just pick the error node with the next lowest priority to produce the next bug report. <rdar://problem/13474689> llvm-svn: 177764
* [analyzer] Fix ExprEngine::ViewGraph to handle C++ initializers.Jordan Rose2013-03-221-40/+55
| | | | | | Debugging aid only, no functionality change. llvm-svn: 177762
* [PCH/Modules] De/Serialize MacroInfos separately than MacroDirectives.Argyrios Kyrtzidis2013-03-224-298/+487
| | | | | | | | | -Serialize the macro directives history into its own section -Get rid of the macro updates section -When de/serializing an identifier from a module, associate only one macro per submodule that defined+exported it. llvm-svn: 177761
* [modules] When a MacroInfo object is deserialized, allocate and store its ↵Argyrios Kyrtzidis2013-03-223-2/+16
| | | | | | submodule ID. llvm-svn: 177760
* [ms-cxxabi] Implement member data pointers for non-dynamic classesReid Kleckner2013-03-223-10/+130
| | | | | | | | | | | | | | | | | | | | Summary: For non-dynamic classes (no virtual bases), member data pointers are simple offsets from the base of the record. Dynamic classes use an aggregate for member data pointers and are therefore currently unsupported. Unlike Itanium, the ms ABI uses 0 to represent null for polymorphic classes. Non-polymorphic classes use -1 like Itanium, since 0 is a valid field offset. Reviewers: rjmccall CC: timurrrr, cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D558 llvm-svn: 177753
* <rdar://problem/13479539> Simplify ModuleManager/GlobalModuleIndex ↵Douglas Gregor2013-03-223-113/+55
| | | | | | | | | | | | | | interaction to eliminate a pile of extraneous stats(). The refactoring in r177367 introduced a serious performance bug where the "lazy" resolution of module file names in the global module index to actual module file entries in the module manager would perform repeated negative stats(). The new interaction requires the module manager to inform the global module index when a module file has been loaded, eliminating the extraneous stat()s and a bunch of bookkeeping on both sides. llvm-svn: 177750
* documentation parsing. Provide code completion comment Fariborz Jahanian2013-03-221-0/+14
| | | | | | | | for self.GetterName where GetterName is the getter method for a property with name different from the property name (declared via a property getter attribute) // rdar://12791315 llvm-svn: 177744
* Better fix for r177725.Daniel Jasper2013-03-222-7/+4
| | | | | | | | | | | | It turns out that -foo; can be an objective C method declaration. So instead of the previous solution, recognize objective C methods only if we are in a declaration scope. llvm-svn: 177740
* Align comments to surrounding unformatted comments.Daniel Jasper2013-03-221-3/+18
| | | | | | | | | | | | | | | Before: int a; // not formatted // formatting this line only After: int a; // not formatted // formatting this line only This makes clang-format stable independent of whether the whole file or single lines are formatted in most cases. llvm-svn: 177739
* [cxxabi] Get ptrdiff_t from the CodeGenModule instead of caching itReid Kleckner2013-03-221-32/+16
| | | | | | As the comment says, it's a little silly to cache it in the ABI code. llvm-svn: 177738
* More precisely recognize ObjC method declarations.Daniel Jasper2013-03-221-3/+5
| | | | | | | | | Otherwise, +/- and the beginning of constants can be recognized incorrectly. Before: #define A - 1 After: #define A -1 llvm-svn: 177725
* Fix DeclRefExpr::getFoundDecl() for usages by reference.Daniel Jasper2013-03-221-6/+6
| | | | llvm-svn: 177721
* Make clang-format understand more line comments.Daniel Jasper2013-03-221-0/+1
| | | | | | | | | | | Apparently one needs to set LangOptions.LineComment. Before "//* */" got reformatted to "/ /* */" as the lexer was returning the token sequence (slash, comment). This could also lead to weird other stuff, e.g. for people that like to using comments like: //**************** llvm-svn: 177720
* OpenMP threadprivate directive parsing and semantic analysisAlexey Bataev2013-03-2221-3/+554
| | | | llvm-svn: 177705
* Warn about attempts to reinterpret_cast between two types that areJohn McCall2013-03-221-2/+87
| | | | | | | | hierarchy-related at a possibly nonzero offset. Patch by Alexander Zinenko! llvm-svn: 177698
* Fix a crash-on-valid where a block capture copy expression wasJohn McCall2013-03-225-4/+15
| | | | | | | | | | | | picking up cleanups from earlier in the statement. Also fix a crash-on-invalid where a reference to an invalid decl from an enclosing scope was causing an expression to fail to build, but only *after* a cleanup was registered from that statement, causing an assertion downstream. The crash-on-valid is rdar://13459289. llvm-svn: 177692
* ubsan: Pass floating-point arguments to the runtime by value if they fit theRichard Smith2013-03-221-1/+10
| | | | | | value argument. If not, be sure we don't accidentally use a dynamic alloca. llvm-svn: 177690
* <rdar://problem/13479214> Make Clang's <stddef.h> robust against system ↵Douglas Gregor2013-03-221-5/+19
| | | | | | | | | | | | | | headers defining size_t/ptrdiff_t/wchar_t. Clang's <stddef.h> provides definitions for the C standard library types size_t, ptrdiff_t, and wchar_t. However, the system's C standard library headers tend to provide the same typedefs, and the two generally avoid each other using the macros _SIZE_T/_PTRDIFF_T/_WCHAR_T. With modules, however, we need to see *all* of the places where these types are defined, so provide the typedefs (ignoring the macros) when modules are enabled. llvm-svn: 177686
* <rdar://problem/13477190> Give the Clang module cache directory some ↵Douglas Gregor2013-03-211-1/+2
| | | | | | | | | | structure, so it's easier to find. We now put the Clang module cache in <system-temp-directory>/org.llvm.clang/ModuleCache. Perhaps some day there will be other caches under <system-temp-directory>/org.llvm.clang>. llvm-svn: 177671
* Fix indentationDavid Blaikie2013-03-211-3/+3
| | | | llvm-svn: 177665
* Objective-C: Tighten the rules when warningFariborz Jahanian2013-03-212-1/+68
| | | | | | | | | | is issused for on overriding 'readwrite' property which is not auto-synthesized. Buttom line is that if hueristics determine that there will be a user implemented setter, no warning will be issued. // rdar://13388503 llvm-svn: 177662
* Remove unused variable.Benjamin Kramer2013-03-211-3/+0
| | | | llvm-svn: 177657
* Avoid warnings from compilers that think you can drop off the end of a fully ↵Benjamin Kramer2013-03-211-0/+2
| | | | | | covered switch. llvm-svn: 177656
* [analyzer] Print return values from debug.DumpCalls checker.Jordan Rose2013-03-211-1/+23
| | | | | | Debug utility only, no functionality change. llvm-svn: 177649
* Better block comment formatting.Alexander Kornienko2013-03-211-29/+35
| | | | | | | | | | | | | | | | | Summary: 1. When splitting one-line block comment, use indentation and *s. 2. Remove trailing whitespace from all lines of a comment, not only the ones being splitted. 3. Add backslashes for all lines if a comment is used insed a preprocessor directive. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D557 llvm-svn: 177635
* [ASan] Let the users to invoke `clang -fsanitize=address` to link binaries ↵Alexander Potapenko2013-03-211-8/+10
| | | | | | targeting the iOS simulator. llvm-svn: 177633
* <rdar://problem/13037793> Allow the names of modules to differ from the name ↵Douglas Gregor2013-03-211-8/+31
| | | | | | of their subdirectory in the include path. llvm-svn: 177621
* Further weaken block conversion rules to permit blocks withJohn McCall2013-03-211-10/+25
| | | | | | | | | enum return type to be converted to blocks with any integer type of the same size. rdar://13463504 llvm-svn: 177613
* 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
OpenPOWER on IntegriCloud