summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Simplify slightly.Richard Smith2013-05-041-4/+4
| | | | llvm-svn: 181092
* Separate out and special-case the diagnostic for 'auto' in aRichard Smith2013-05-042-7/+16
| | | | | | | conversion-type-id, in preparation for this becoming valid in c++1y mode. No functionality change; small diagnostic improvement. llvm-svn: 181089
* [analyzer;alternate edges] start experimenting with control flow "barriers" ↵Ted Kremenek2013-05-041-14/+102
| | | | | | to prevent an edge being optimized away. llvm-svn: 181088
* [analyzer;alternate edges] ignore parentheses when determining edge levels.Ted Kremenek2013-05-041-3/+3
| | | | llvm-svn: 181087
* [analyzer; alternate edges] - eliminate unnecessary edges where between ↵Ted Kremenek2013-05-041-8/+68
| | | | | | parents and subexpressions. llvm-svn: 181086
* [analyzer; alternate edges] - merge control edges where we descend to a ↵Ted Kremenek2013-05-041-0/+20
| | | | | | subexpression and pop back out. llvm-svn: 181085
* [analyzer; alternate edges] prune edges whose end/begin locations have the ↵Ted Kremenek2013-05-041-27/+95
| | | | | | | | | | | | | | | | | same statement parents. This change required some minor changes to LocationContextMap to have it map from PathPieces to LocationContexts instead of PathDiagnosticCallPieces to LocationContexts. These changes are in the other diagnostic generation logic as well, but are functionally equivalent. Interestingly, this optimize requires delaying "cleanUpLocation()" until later; possibly after all edges have been optimized. This is because we need PathDiagnosticLocations to refer to the semantic entity (e.g. a statement) as long as possible. Raw source locations tell us nothing about the semantic relationship between two locations in a path. llvm-svn: 181084
* [analyzer;alternate edges] - add in events (loop iterations, etc)Ted Kremenek2013-05-041-7/+15
| | | | | | | These were being dropped due a transcription mistake from the original algorithm. llvm-svn: 181083
* [doc parsing]: Make warning about unknown commandFariborz Jahanian2013-05-041-3/+2
| | | | | | | tags off by default for now. Move diagnostic code to DiagnosticCommentKinds.td. // rdar://12381408 llvm-svn: 181081
* ArrayRef'ize MultiLevelTemplateArgumentList::ArgList. Patch by Faisal Vali!Richard Smith2013-05-032-20/+14
| | | | llvm-svn: 181077
* <rdar://problem/13806270> A template argument list is a constant-evaluated ↵Douglas Gregor2013-05-031-0/+3
| | | | | | context. llvm-svn: 181076
* Revert r177218.Argyrios Kyrtzidis2013-05-034-10/+0
| | | | | | Per discussion in cfe-commits, asserting may be a better way than introducing a special test flag. llvm-svn: 181073
* [Doc parsing] Provide diagnostics for unknown documentation Fariborz Jahanian2013-05-032-4/+10
| | | | | | commands. // rdar://12381408 llvm-svn: 181071
* Remove DiagnosticConsumer::clone(), a bad idea that is now unused.Douglas Gregor2013-05-0310-63/+5
| | | | llvm-svn: 181070
* When building a module, forward diagnostics to the outer diagnostic consumer.Douglas Gregor2013-05-036-12/+69
| | | | | | | | | | | | | | | Previously, we would clone the current diagnostic consumer to produce a new diagnostic consumer to use when building a module. The problem here is that we end up losing diagnostics for important diagnostic consumers, such as serialized diagnostics (where we'd end up with two diagnostic consumers writing the same output file). With forwarding, the diagnostics from all of the different modules being built get forwarded to the one serialized-diagnostic consumer and are emitted in a sane way. Fixes <rdar://problem/13663996>. llvm-svn: 181067
* [Preprocessor] For the MacroExpands preprocessor callback, also pass the ↵Argyrios Kyrtzidis2013-05-037-134/+11
| | | | | | | | MacroArgs object that provides information about the argument tokens for a function macro. llvm-svn: 181065
* Rename ObjCImplementationDecl::getSuperLoc() -> getSuperClassLoc() for ↵Argyrios Kyrtzidis2013-05-032-2/+2
| | | | | | consistency with ObjCInterfaceDecl::getSuperClassLoc() llvm-svn: 181064
* Test commitWei Pan2013-05-031-1/+1
| | | | llvm-svn: 181057
* Reapply r180982 with repaired logic and an additional testcase.Adrian Prantl2013-05-034-22/+35
| | | | | | | | | | | | | | Un-break the gdb buildbot. - Use the debug location of the return expression for the cleanup code if the return expression is trivially evaluatable, regardless of the number of stop points in the function. - Ensure that any EH code in the cleanup still gets the line number of the closing } of the lexical scope. - Added a testcase with EH in the cleanup. rdar://problem/13442648 llvm-svn: 181056
* Serialization for captured statementsBen Langmuir2013-05-036-12/+75
| | | | | | | | | | | Add serialization for captured statements and captured decls. Also add a const_capture_iterator to CapturedStmt. Test contributed by Wei Pan Differential Revision: http://llvm-reviews.chandlerc.com/D727 llvm-svn: 181048
* PR15906: The body of a lambda is not an evaluated subexpression; don't visit ↵Richard Smith2013-05-031-1/+1
| | | | | | it when visiting such subexpressions. llvm-svn: 181046
* Move CapturedStmt parameters to CapturedDeclBen Langmuir2013-05-034-10/+24
| | | | | | | | | | | Move the creation of CapturedStmt parameters out of CodeGen and into Sema, making it easier to customize the outlined function. The ImplicitParamDecls are stored in the CapturedDecl using an ASTContext-allocated array. Differential Revision: http://llvm-reviews.chandlerc.com/D722 llvm-svn: 181043
* [analyzer] Start hacking up alternate control-flow edge generation. WIP. ↵Ted Kremenek2013-05-031-0/+216
| | | | | | Not guaranteed to do anything useful yet. llvm-svn: 181040
* Keep track of an @implementation's super class name location, if one was ↵Argyrios Kyrtzidis2013-05-035-2/+6
| | | | | | provided. llvm-svn: 181039
* Micro-optimization: check the overloaded operator kind beforeJohn McCall2013-05-031-2/+2
| | | | | | | | checking for a lambda. Thanks to Jordan for the pointer. llvm-svn: 181031
* ArrayRef'ize InitializationSequence constructor and ↵Dmitri Gribenko2013-05-039-176/+132
| | | | | | | | InitializationSequence::Diagnose() Patch by Robert Wilhelm. llvm-svn: 181022
* Initialize WarnOnSpellCheck.Rafael Espindola2013-05-031-0/+1
| | | | | | | | | Clang always calls setWarnOnSpellCheck, but we shouldn't require every client to do so. Issue noticed by Enea Zaffanella. llvm-svn: 181021
* Add space between ; and (.Daniel Jasper2013-05-031-1/+1
| | | | | | Before: for (int i = 0;(i < 10); ++i) {} After: for (int i = 0; (i < 10); ++i) {} llvm-svn: 181020
* Fix expression recognition in for-loops.Daniel Jasper2013-05-031-0/+3
| | | | | | Before: for (; a&& b;) {} After: for (; a && b;) {} llvm-svn: 181017
* Add const qualifier to Sema::getTypeName's parameter `II`Dmitri Gribenko2013-05-031-1/+1
| | | | | | Patch by Ismail Pazarbasi. llvm-svn: 181011
* Add support for -march=btver2.Benjamin Kramer2013-05-031-0/+15
| | | | llvm-svn: 181006
* Support __wchar_t in -fms-extensions and -fms-compatibility modes.Hans Wennborg2013-05-032-3/+4
| | | | | | | | | | | | | | MSVC provides __wchar_t, either as an alias for the built-in wchar_t type, or as a separate type depending on language (C vs C++) and flags (-fno-wchar). In -fms-extensions, Clang will simply accept __wchar_t as an alias for whatever type is used for wide character literals. In -fms-compatibility, we try to mimic MSVC's behavior by always making __wchar_t a builtin type. This fixes PR15815. llvm-svn: 181004
* Correctly emit certain implicit references to 'self' even withinJohn McCall2013-05-039-53/+61
| | | | | | | | | | | | | | | | | | a lambda. Bug #1 is that CGF's CurFuncDecl was "stuck" at lambda invocation functions. Fix that by generally improving getNonClosureContext to look through lambdas and captured statements but only report code contexts, which is generally what's wanted. Audit uses of CurFuncDecl and getNonClosureAncestor for correctness. Bug #2 is that lambdas weren't specially mapping 'self' when inside an ObjC method. Fix that by removing the requirement for that and using the normal EmitDeclRefLValue path in LoadObjCSelf. rdar://13800041 llvm-svn: 181000
* [analyzer] Check the stack frame when looking for a var's initialization.Jordan Rose2013-05-031-7/+32
| | | | | | | | | | | | | FindLastStoreBRVisitor is responsible for finding where a particular region gets its value; if the region is a VarRegion, it's possible that value was assigned at initialization, i.e. at its DeclStmt. However, if a function is called recursively, the same DeclStmt may be evaluated multiple times in multiple stack frames. FindLastStoreBRVisitor was not taking this into account and just picking the first one it saw. <rdar://problem/13787723> llvm-svn: 180997
* [analyzer] Fix trackNullOrUndef when tracking args that have nil receivers.Jordan Rose2013-05-031-2/+2
| | | | | | | | | | | | | | | There were actually two bugs here: - if we decided to look for an interesting lvalue or call expression, we wouldn't go find its node if we also knew we were at a (different) call. - if we looked through one message send with a nil receiver, we thought we were still looking at an argument to the original call. Put together, this kept us from being able to track the right values, which means sub-par diagnostics and worse false-positive suppression. Noticed by inspection. llvm-svn: 180996
* Revert "Attempt to un-break the gdb buildbot."Adrian Prantl2013-05-034-33/+22
| | | | | | This reverts commit 180982. llvm-svn: 180990
* Make cleanUpLocation() a self-contained function.Ted Kremenek2013-05-031-44/+47
| | | | llvm-svn: 180986
* [ms-cxxabi] Emit non-virtual member function pointersReid Kleckner2013-05-031-18/+87
| | | | | | | | | | | | | | Without any conversion, this is pretty straightforward. Most of the fields can be zeros. The order is: - field offset or pointer - nonvirtual adjustment (for MI functions) - vbptr offset (for unspecified) - virtual adjustment offset (for virtual inheritance) Differential Revision: http://llvm-reviews.chandlerc.com/D699 llvm-svn: 180985
* Attempt to un-break the gdb buildbot.Adrian Prantl2013-05-034-22/+33
| | | | | | | | | | | | | - Use the debug location of the return expression for the cleanup code if the return expression is trivially evaluatable, regardless of the number of stop points in the function. - Ensure that any EH code in the cleanup still gets the line number of the closing } of the lexical scope. - Added a testcase with EH in the cleanup. rdar://problem/13442648 llvm-svn: 180982
* Re-apply 180974 with the build error fixed. This was the resultTed Kremenek2013-05-031-16/+27
| | | | | | of a weird merge error with git. llvm-svn: 180981
* Revert "Change LocationContextMap to be a temporary instead of shared ↵Rafael Espindola2013-05-031-27/+16
| | | | | | | | variable in BugReporter." This reverts commit 180974. It broke the build. llvm-svn: 180979
* Move parsing of identifiers in MS-style inline assembly intoJohn McCall2013-05-0316-367/+682
| | | | | | | | | | | | | | | | | | | | | the actual parser and support arbitrary id-expressions. We're actually basically set up to do arbitrary expressions here if we wanted to. Assembly operands permit things like A::x to be written regardless of language mode, which forces us to embellish the evaluation context logic somewhat. The logic here under template instantiation is incorrect; we need to preserve the fact that an expression was unevaluated. Of course, template instantiation in general is fishy here because we have no way of delaying semantic analysis in the MC parser. It's all just fishy. I've also fixed the serialization of MS asm statements. This commit depends on an LLVM commit. llvm-svn: 180976
* Change LocationContextMap to be a temporary instead of shared variable in ↵Ted Kremenek2013-05-021-16/+27
| | | | | | | | | | | | | BugReporter. BugReporter is used to process ALL bug reports. By using a shared map, we are having mappings from different PathDiagnosticPieces to LocationContexts well beyond the point where we are processing a given report. This state is inherently error prone, and is analogous to using a global variable. Instead, just create a temporary map, one per report, and when we are done with it we throw it away. No extra state. llvm-svn: 180974
* Use attribute argument information to determine when to parse attribute ↵Douglas Gregor2013-05-023-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | arguments as expressions. This change partly addresses a heinous problem we have with the parsing of attribute arguments that are a lone identifier. Previously, we would end up parsing the 'align' attribute of this as an expression "(Align)": template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align((Align)))) char storage[Size]; }; while this would parse as a "parameter name" 'Align': template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align(Align))) char storage[Size]; }; The code that handles the alignment attribute would completely ignore the parameter name, so the while the first of these would do what's expected, the second would silently be equivalent to template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align)) char storage[Size]; }; i.e., use the maximal alignment rather than the specified alignment. Address this by sniffing the "Args" provided in the TableGen description of attributes. If the first argument is "obviously" something that should be treated as an expression (rather than an identifier to be matched later), parse it as an expression. Fixes <rdar://problem/13700933>. llvm-svn: 180973
* Revert r180970; it's causing breakage.Douglas Gregor2013-05-023-13/+2
| | | | llvm-svn: 180972
* Use attribute argument information to determine when to parse attribute ↵Douglas Gregor2013-05-023-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | arguments as expressions. This change partly addresses a heinous problem we have with the parsing of attribute arguments that are a lone identifier. Previously, we would end up parsing the 'align' attribute of this as an expression "(Align)": template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align((Align)))) char storage[Size]; }; while this would parse as a "parameter name" 'Align': template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align(Align))) char storage[Size]; }; The code that handles the alignment attribute would completely ignore the parameter name, so the while the first of these would do what's expected, the second would silently be equivalent to template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align)) char storage[Size]; }; i.e., use the maximal alignment rather than the specified alignment. Address this by sniffing the "Args" provided in the TableGen description of attributes. If the first argument is "obviously" something that should be treated as an expression (rather than an identifier to be matched later), parse it as an expression. Fixes <rdar://problem/13700933>. llvm-svn: 180970
* [analyzer] Don't try to evaluate MaterializeTemporaryExpr as a constant.Jordan Rose2013-05-022-3/+15
| | | | | | | | | | | | | | | ...and don't consider '0' to be a null pointer constant if it's the initializer for a float! Apparently null pointer constant evaluation looks through both MaterializeTemporaryExpr and ImplicitCastExpr, so we have to be more careful about types in the callers. For RegionStore this just means giving up a little more; for ExprEngine this means handling the MaterializeTemporaryExpr case explicitly. Follow-up to r180894. llvm-svn: 180944
* Use the Itanium ABI for thread_local on Darwin.Bill Wendling2013-05-022-2/+12
| | | | | | | | | | | After some discussion, it was decided to use the Itanium ABI for thread_local on Darwin OS X platforms. This involved a couple of changes. First, we use "_tlv_atexit" instead of "__cxa_thread_atexit". Secondly, the global variables are marked with 'internal' linkage, because we want all access to be calls to the Itanium-specific entry point, which has normal linkage. <rdar://problem/13733006> llvm-svn: 180941
* Fix crasher when the range in a C++ range-for loop has an ill-formed ↵Douglas Gregor2013-05-021-2/+11
| | | | | | | | initializer. Fixes <rdar://problem/13712739>. llvm-svn: 180937
* When looking for the module associated with one of our magical builtin ↵Douglas Gregor2013-05-021-18/+37
| | | | | | | | | | | | | | | headers, speculatively load module maps. The "magical" builtin headers are the headers we provide as part of the C standard library, which typically comes from /usr/include. We essentially merge our headers into that location (due to cyclic dependencies). This change makes sure that, when header search finds one of our builtin headers, we figure out which module it actually lives in. This case is fairly rare; one ends up having to include one of the few built-in C headers we provide before including anything from /usr/include to trigger it. Fixes <rdar://problem/13787184>. llvm-svn: 180934
OpenPOWER on IntegriCloud