summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* Objective-C: Fixes a comment.Fariborz Jahanian2013-03-121-1/+1
| | | | llvm-svn: 176878
* Revert "Disallow using -fmodules with -no-integrated-as."Ted Kremenek2013-03-123-24/+3
| | | | | | | Per comment from Benjamin Kramer, this isn't portable (yet). I'll come up with a better fix. llvm-svn: 176876
* We already reported an error forRafael Espindola2013-03-122-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | extern "C" { void test5_f() { extern int test5_b; } } static float test5_b; This patch makes us report one for extern "C" { void test6_f() { extern int test6_b; } } extern "C" { static float test6_b; } Not because we think the declaration would be extern C, but because of the rule: An entity with C language linkage shall not be declared with the same name as an entity in global scope... We were just not looking past the extern "C" to see if the decl was in global scope. llvm-svn: 176875
* Implemented formatting of rvalue referencesAlexander Kornienko2013-03-122-17/+34
| | | | | | | | | | | | | | | | | | Summary: Handle "&&" usage as rvalue reference, added tests and fixed incorrect tests that interfere with this feature. http://llvm.org/bugs/show_bug.cgi?id=15051 Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D531 llvm-svn: 176874
* [docs] Add rtags to the external examples.Sean Silva2013-03-121-0/+5
| | | | llvm-svn: 176871
* Modify comment in user test.Fariborz Jahanian2013-03-121-1/+1
| | | | llvm-svn: 176870
* Correctly compute linkage of decls forward declared extern C.Rafael Espindola2013-03-122-5/+14
| | | | | | | | | | | | | | This fixes a crash in namespace { struct X {}; } extern "C" X test2_b; X test2_b before we would assign different linkages to each of the test2_b decls. llvm-svn: 176869
* Error if an extern C declaration matches a previous hidden extern C declaration.Rafael Espindola2013-03-122-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Without this patch we produce an error for extern "C" { void f() { extern int b; } } extern "C" { extern float b; } but not for extern "C" { void f() { extern int b; } } extern "C" { float b; } llvm-svn: 176867
* Remove a bogus assert so we don't crash inRafael Espindola2013-03-122-7/+17
| | | | | | | | | | | namespace { struct X {}; } extern "C" { X b = X(); } llvm-svn: 176866
* Remove bad space after "default".Daniel Jasper2013-03-122-1/+6
| | | | | | | | | | | | | | Before: switch (x) { default : {} } After: switch (x) { default: {} } llvm-svn: 176861
* Remove driver support for Hexagon V2 and V3Matthew Curtis2013-03-122-2/+16
| | | | | | | | | Driver will now error when trying to compile for V2 or V3. Removal of V2 and V3 support will allow us to simplify the hexagon back-end. llvm-svn: 176859
* [docs] Add SourceWeb as external example.Sean Silva2013-03-121-0/+3
| | | | llvm-svn: 176848
* Objective-C: When using super.prop, property should beFariborz Jahanian2013-03-113-4/+33
| | | | | | | looked up the current class's super class. // rdar://13349296 llvm-svn: 176832
* [analyzer] Look for calls along with lvalue nodes in trackNullOrUndefValue.Jordan Rose2013-03-111-9/+10
| | | | | | | | | | | | | | | | | | r176737 fixed bugreporter::trackNullOrUndefValue to find nodes for an lvalue even if the rvalue node had already been collected. This commit extends that to call statement nodes as well, so that if a call is contained within implicit casts we can still track the return value. No test case because node reclamation is extremely finicky (dependent on how the AST and CFG are built, and then on our current reclamation rules, and /then/ on how many nodes were generated by the analyzer core and the current set of checkers). I consider this a low-risk change, though, and it will only happen in cases of reclamation when the rvalue node isn't available. <rdar://problem/13340764> llvm-svn: 176829
* Disallow using -fmodules with -no-integrated-as.Ted Kremenek2013-03-113-3/+24
| | | | | | | | | | | | | Modules enables features such as auto-linking, and we simply do not want to support a matrix of subtly enabled/disabled features depending on whether or not a user is using the integrated assembler. It isn't clear if this is the best place to do this check. For one thing, these kind of errors are not caught by the serialized diagnostics. Fixes <rdar://problem/13289240> llvm-svn: 176826
* Improve the caching of debuginfo Objective C interface types.Adrian Prantl2013-03-113-27/+68
| | | | | | | | Generate forward declarations that are RAUW'd by finalize(). We thus avoid outputting the same type several times in multiple stages of completion. llvm-svn: 176820
* Add -Wc99-compat warning for C11 unicode string and character literals.Richard Smith2013-03-113-6/+32
| | | | llvm-svn: 176817
* Partly revert "Move clang tests that depend on llvm/ADT/Statistic.h to a ↵Jan Wen Voung2013-03-113-5/+3
| | | | | | | | subdir". This reverts commit 176730, and uses "REQUIRES: asserts" instead. llvm-svn: 176815
* [docs] Add ellipsis.Sean Silva2013-03-111-1/+1
| | | | llvm-svn: 176810
* [libclang] Fix a test and a warning on windows.Argyrios Kyrtzidis2013-03-112-5/+5
| | | | | | Patch by Guy Benyei! llvm-svn: 176806
* Add a test case for the 'vec_type_hint' attribute that was introduced inJoey Gouly2013-03-111-0/+16
| | | | | | r176686. I missed this file in the previous commit. llvm-svn: 176803
* PR15480: fixed second parameter types of vec_lde, vec_lvebx, vec_lvehx, and ↵Anton Yartsev2013-03-102-28/+28
| | | | | | vec_lvewx according to AltiVec Programming Interface Manual llvm-svn: 176789
* Driver: do not strip file extensions when printing diagnostics.Benjamin Kramer2013-03-101-1/+1
| | | | | | | | | | Before: clang-3: error: no input files After: clang-3.3: error: no input files This means that we'll also print clang.exe on windows, but I don't see a problem with that. llvm-svn: 176788
* Fix indirect byval passing of records in address spaced memory. Allocate ↵Guy Benyei2013-03-102-2/+31
| | | | | | memory on stack, and memcpy the actual value before the call. llvm-svn: 176786
* www tweaks to embiggen up our near-complete C++11 and C11 support.Richard Smith2013-03-102-6/+8
| | | | llvm-svn: 176781
* When lexing in C11 mode, accept unicode character and string literals, per C11Richard Smith2013-03-095-36/+92
| | | | | | 6.4.4.4/1 and 6.4.5/1. llvm-svn: 176780
* Handle _Pragma on a u8, u, or U string literal per the C11 specification. AlsoRichard Smith2013-03-095-37/+78
| | | | | | | | handle raw string literals here. C++11 doesn't yet specify how they will behave, but discussion on core suggests that we should just strip off everything but the r-char-sequence. llvm-svn: 176779
* Remove unused diagnostic.Benjamin Kramer2013-03-091-2/+0
| | | | llvm-svn: 176774
* Make helper function static.Benjamin Kramer2013-03-091-2/+2
| | | | llvm-svn: 176767
* [analyzer] Make Suppress IDC checker aware that it might not start from the ↵Anna Zaks2013-03-093-19/+80
| | | | | | | | | | | | | | | | | | | | same node it was registered at The visitor used to assume that the value it’s tracking is null in the first node it examines. This is not true. If we are registering the Suppress Inlined Defensive checks visitor while traversing in another visitor (such as FindlastStoreVisitor). When we restart with the IDC visitor, the invariance of the visitor does not hold since the symbol we are tracking no longer exists at that point. I had to pass the ErrorNode when creating the IDC visitor, because, in some cases, node N is neither the error node nor will be visible along the path (we had not finalized the path at that point and are dealing with ExplodedGraph.) We should revisit the other visitors which might not be aware that they might get nodes, which are later in path than the trigger point. This suppresses a number of inline defensive checks in JavaScriptCore. llvm-svn: 176756
* [analyzer] Rename AttrNonNullChecker -> NonNullParamCheckerAnna Zaks2013-03-095-15/+18
| | | | llvm-svn: 176755
* [analyzer] Add test case for reference to null pointer param checkAnna Zaks2013-03-091-0/+12
| | | | | | This tests that we track the original Expr if getDerefExpr fails. llvm-svn: 176754
* [analyzer] Be more consistent about Objective-C methods that free memory.Jordan Rose2013-03-093-69/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, MallocChecker's pointer escape check and its post-call state update for Objective-C method calls had a fair amount duplicated logic and not-entirely-consistent checks. This commit restructures all this to be more consistent and possibly allow us to be more aggressive in warning about double-frees. New policy (applies to system header methods only): (1) If this is a method we know about, model it as taking/holding ownership of the passed-in buffer. (1a) ...unless there's a "freeWhenDone:" parameter with a zero (NO) value. (2) If there's a "freeWhenDone:" parameter (but it's not a method we know about), treat the buffer as escaping if the value is non-zero (YES) and non-escaping if it's zero (NO). (3) If the first selector piece ends with "NoCopy" (but it's not a method we know about and there's no "freeWhenDone:" parameter), treat the buffer as escaping. The reason that (2) and (3) don't explicitly model the ownership transfer is because we can't be sure that they will actually free the memory using free(), and we wouldn't want to emit a spurious "mismatched allocator" warning (coming in Anton's upcoming patch). In the future, we may have an idea of a "generic deallocation", i.e. we assume that the deallocator is correct but still continue tracking the region so that we can warn about double-frees. Patch by Anton Yartsev, with modifications from me. llvm-svn: 176744
* Adjust the special non-C++ enum block return type inferenceJohn McCall2013-03-092-90/+171
| | | | | | | | | | | | | | | so that it looks through certain syntactic forms and applies even if normal inference would have succeeded. There is potential for source incompatibility from this change, but overall we feel that it produces a much cleaner and more defensible result, and the block compatibility rules should curb a lot of the potential for annoyance. rdar://13200889 llvm-svn: 176743
* Add TagDecl::hasNameForLinkage(), which is true if the tagJohn McCall2013-03-097-9/+26
| | | | | | is non-anonymous or is defined in a typedef of itself. llvm-svn: 176742
* Documentation parsing. Some refactoring and codeFariborz Jahanian2013-03-085-85/+112
| | | | | | improvements per Dmtiri's comments. // rdar://12379114 llvm-svn: 176739
* [analyzer] Look for lvalue nodes when tracking a null pointer.Jordan Rose2013-03-082-81/+495
| | | | | | | | | | | | | | | | | | r176010 introduced the notion of "interesting" lvalue expressions, whose nodes are guaranteed never to be reclaimed by the ExplodedGraph. This was used in bugreporter::trackNullOrUndefValue to find the region that contains the null or undef value being tracked. However, the /rvalue/ nodes (i.e. the loads from these lvalues that produce a null or undef value) /are/ still being reclaimed, and if we couldn't find the node for the rvalue, we just give up. This patch changes that so that we look for the node for either the rvalue or the lvalue -- preferring the former, since it lets us fall back to value-only tracking in cases where we can't get a region, but allowing the latter as well. <rdar://problem/13342842> llvm-svn: 176737
* [analyzer] Don't rely on finding the correct return statement for suppression.Jordan Rose2013-03-081-58/+86
| | | | | | | | | | | | | | | | | | Previously, ReturnVisitor waited to suppress a null return path until it had found the inlined "return" statement. Now, it checks up front whether the return value was NULL, and suppresses the warning right away if so. We still have to wait until generating the path notes to invalidate the bug report, or counter-suppression will never be triggered. (Counter-suppression happens while generating path notes, but the generation won't happen for reports already marked invalid.) This isn't actually an issue today because we never reclaim nodes for top-level statements (like return statements), but it could be an issue some day in the future. (But, no expected behavioral change and no new test case.) llvm-svn: 176736
* [libclang] Change clang_findReferencesInFile and clang_findIncludesInFile to ↵Argyrios Kyrtzidis2013-03-082-41/+53
| | | | | | | | return an enum, as suggested by Jordan. llvm-svn: 176732
* <rdar://problem/13170740> Be a little more careful when instantiating 'this' ↵Douglas Gregor2013-03-081-2/+7
| | | | | | expressions. llvm-svn: 176731
* Move clang tests that depend on llvm/ADT/Statistic.h to a subdir.Jan Wen Voung2013-03-083-0/+4
| | | | | | | | | | The subdirectory has a lit.local.cfg that marks the tests unsupported if llvm was built without Asserts. There will be a patch in LLVM that disables statistics gathering when built without Asserts so that full Release builds can be faster. Statistics can also be enabled by building with -DLLVM_ENABLE_STATS. llvm-svn: 176730
* Sema: Preserve attributes on parameters in instantiated function templates.Jordan Rose2013-03-088-49/+103
| | | | | | | | | | | | | | | | | | This was causing correctness issues for ARC and the static analyzer when a function template has "consumed" Objective-C object parameters (i.e. parameters that will be released by the function before returning). The fix is threefold: (1) Actually copy over the attributes from old ParmVarDecls to new ones. (2) Have Sema::BuildFunctionType only work for building FunctionProtoTypes, which it was doing anyway. This allows us to pass an ExtProtoInfo instead of a plain ExtInfo and several flags. (3) Drop param attributes as part of StripImplicitInstantiation, which is used when an implicit instantiation is followed by an explicit one. <rdar://problem/12685622> llvm-svn: 176728
* <rdar://problem/13094134> Don't try to wire up typedef names for invalid ↵Douglas Gregor2013-03-082-2/+13
| | | | | | anonymous tag declarations encountered during template instantiation. llvm-svn: 176727
* ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType.Jordan Rose2013-03-0824-239/+245
| | | | | | No (intended) functionality change. llvm-svn: 176726
* <rdar://problem/13140795> Transform the scope type of a pseudo-destructor ↵Douglas Gregor2013-03-082-1/+22
| | | | | | | | | | | | | expression within the object scope. We were transforming the scope type of a pseudo-destructor expression (e.g., the first T in x->T::~T()) as a freestanding type, which meant that dependent template specialization types here would stay dependent even when no template parameters were named. This would eventually mean that a dependent expression would end up in what should be fully-instantiated ASTs, causing IRgen to assert. llvm-svn: 176723
* [PCH] When complaining that a header from the PCH was modified, also mentionArgyrios Kyrtzidis2013-03-083-3/+3
| | | | | | the filename of the PCH file. llvm-svn: 176717
* [libclang] Modify clang_findReferencesInFile and clang_findIncludesInFile to ↵Argyrios Kyrtzidis2013-03-084-68/+87
| | | | | | | | | | | return a value. Possible values are: 1 : if a parameter was invalid -1 : if the callback returned CXVisit_Break, otherwise returns 0. llvm-svn: 176716
* Fixes breaking of string literals.Manuel Klimek2013-03-082-2/+95
| | | | | | | | | 1. We now ignore all non-default string literals, including raw literals. 2. We do not break inside escape sequences any more. FIXME: We still break in trigraphs. llvm-svn: 176710
* Remove unused variable.Benjamin Kramer2013-03-081-1/+0
| | | | llvm-svn: 176704
* Add support for the OpenCL attribute 'vec_type_hint'.Joey Gouly2013-03-088-15/+156
| | | | | | Patch by Murat Bolat! llvm-svn: 176686
OpenPOWER on IntegriCloud