summaryrefslogtreecommitdiffstats
path: root/clang/test
Commit message (Collapse)AuthorAgeFilesLines
* Add <foo> = [<bar> nextObject] to the -Widiomatic-parentheses category,John McCall2009-11-121-0/+35
| | | | | | | and give that category an explicit test. Generalize the internal diagnostic name. llvm-svn: 86905
* Remove an overly-eager assertion when replacing tokens with anDouglas Gregor2009-11-121-0/+3
| | | | | | | | | | | annotation token, because some of the tokens we're annotating might not be in the set of cached tokens (we could have consumed them unconditionally). Also, move the tentative parsing from ParseTemplateTemplateArgument into the one caller that needs it, improving recovery. llvm-svn: 86904
* Template argument deduction for template template parameters. ThisDouglas Gregor2009-11-111-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | permits, among other things, ripping apart and reconstructing templates via partial specialization: template<typename T> struct DeepRemoveConst { typedef T type; }; template<typename T> struct DeepRemoveConst<const T> { typedef typename DeepRemoveConst<T>::type type; }; template<template<typename> class TT, typename T> struct DeepRemoveConst<TT<T> > { typedef TT<typename DeepRemoveConst<T>::type> type; }; Also, fix a longstanding thinko in the code handling partial ordering of class template partial specializations. We were performing the second deduction without clearing out the results of the first deduction. It's amazing we got through so much code with such a horrendous error :( llvm-svn: 86893
* Fix PR 5422: handle lvalue results when evaluating 'based' ptrtoints as part ofJohn McCall2009-11-111-0/+6
| | | | | | the -Wconversion check. llvm-svn: 86891
* Make test more platform independent.Fariborz Jahanian2009-11-111-1/+2
| | | | llvm-svn: 86890
* Make test more platform independent (per Sebastian's comment).Fariborz Jahanian2009-11-111-2/+2
| | | | llvm-svn: 86888
* writable atomic property's setter/getter must be in 'lock' step ofFariborz Jahanian2009-11-112-0/+370
| | | | | | | either both synthesized or bith user defined. Implements radar 6557233. llvm-svn: 86887
* Improve diagnostics when a default template argument does not matchDouglas Gregor2009-11-112-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | with its corresponding template parameter. This can happen when we performed some substitution into the default template argument and what we had doesn't match any more, e.g., template<int> struct A; template<typename T, template<T> class X = A> class B; B<long> b; Previously, we'd emit a pretty but disembodied diagnostic showing how the default argument didn't match the template parameter. The diagnostic was good, but nothing tied it to the *use* of the default argument in "B<long>". This commit fixes that. Also, tweak the counting of active template instantiations to avoid counting non-instantiation records, such as those we create for (surprise!) checking default arguments, instantiating default arguments, and performing substitutions as part of template argument deduction. llvm-svn: 86884
* Before checking a template template argument against its correspondingDouglas Gregor2009-11-115-3/+28
| | | | | | | | | | | | | | | | | | | | | | | template template parameter, substitute any prior template arguments into the template template parameter. This, for example, allows us to properly check the template template argument for a class such as: template<typename T, template<T Value> class X> struct Foo; The actual implementation of this feature was trivial; most of the change is dedicated to giving decent diagnostics when this substitution goes horribly wrong. We now get a note like: note: while substituting prior template arguments into template template parameter 'X' [with T = float] As part of this change, enabled some very pedantic checking when comparing template template parameter lists, which shook out a bug in our overly-eager checking of default arguments of template template parameters. We now perform only minimal checking of such default arguments when they are initially parsed. llvm-svn: 86864
* Value initialize non-class array members in ctor'sFariborz Jahanian2009-11-111-0/+28
| | | | | | initializer list. Fixes PR5463. llvm-svn: 86849
* Split buffer overflow test case into two test cases, removing out logic that ↵Ted Kremenek2009-11-111-4/+9
| | | | | | was commented out. llvm-svn: 86845
* Instantiation of template template parameters for nested templates, e.g.,Douglas Gregor2009-11-111-0/+18
| | | | | | | | | template<typename T> struct X { template<template<T Value> class Y> struct Inner; }; llvm-svn: 86844
* Fix speculative parsing of dependent template names inDouglas Gregor2009-11-112-17/+24
| | | | | | | | | | | | | | | | | | | | | | nested-name-specifiers so that they don't gobble the template name (or operator-function-id) unless there is also a template-argument-list. For example, given T::template apply we would previously consume both "template" and "apply" as part of parsing the nested-name-specifier, then error when we see that there is no "<" starting a template argument list. Now, we parse such constructs tentatively, and back off if the "<" is not present. This allows us to parse dependent template names as one would use them for, e.g., template template parameters: template<typename T, template<class> class X = T::template apply> struct MetaSomething; Also, test default arguments for template template parameters. llvm-svn: 86841
* Add undefined array subscript checker.Zhongxing Xu2009-11-111-0/+4
| | | | llvm-svn: 86837
* Reimplement out-of-bound array access checker with the new checker interface.Zhongxing Xu2009-11-113-4/+4
| | | | | | Now only one test case is XFAIL'ed. llvm-svn: 86834
* CastToStructChecker: use 'isStructureType()' instead of 'isRecordType()' to ↵Ted Kremenek2009-11-111-2/+23
| | | | | | determine if a pointer is casted to a struct pointer. This fixes an observed false positive when a value is casted to a union. llvm-svn: 86813
* And now a test fix in +Asserts mode, which I broke.Daniel Dunbar2009-11-111-1/+1
| | | | llvm-svn: 86801
* Fix some tests in -Asserts mode.Daniel Dunbar2009-11-114-30/+28
| | | | | | | | | | | | | - FileCheck is a *huuuuge* improvement here. - Still feels like we could use a better tool for this though, either teach llvm-dis to spit out the FileCheck syntax, or provide another tool to turn a .ll into a "matchable" input. - Also on my Christmas list is better FileCheck diagnostics with missing variables or mismatches. llvm-svn: 86800
* Apparently the following idiom is specifically encouraged:John McCall2009-11-111-0/+10
| | | | | | | if (self = [super init]) Recognize it and only warn if -Wparentheses is explicitly enabled. llvm-svn: 86790
* Introduce a new representation for template templateDouglas Gregor2009-11-112-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | parameters. Rather than storing them as either declarations (for the non-dependent case) or expressions (for the dependent case), we now (always) store them as TemplateNames. The primary change here is to add a new kind of TemplateArgument, which stores a TemplateName. However, making that change ripples to every switch on a TemplateArgument's kind, also affecting TemplateArgumentLocInfo/TemplateArgumentLoc, default template arguments for template template parameters, type-checking of template template arguments, etc. This change is light on testing. It should fix several pre-existing problems with template template parameters, such as: - the inability to use dependent template names as template template arguments - template template parameter default arguments cannot be instantiation However, there are enough pieces missing that more implementation is required before we can adequately test template template parameters. llvm-svn: 86777
* Create a new Scope when parsing a declaration with a C++ scope specifier.John McCall2009-11-111-0/+13
| | | | llvm-svn: 86764
* Diagnose illegally typed operator new/new[].Fariborz Jahanian2009-11-102-1/+29
| | | | llvm-svn: 86755
* Fix for PR5454: make sure to use the right block as the predecessor in theEli Friedman2009-11-101-0/+10
| | | | | | generated PHI node for the null check of a new operator. llvm-svn: 86738
* Make -Wsemicolon-before-method-body opt-in (and part of -Wextra). Addresses ↵Ted Kremenek2009-11-101-1/+1
| | | | | | <rdar://problem/7381735>. llvm-svn: 86731
* This patch implements Code gen. for destruction ofFariborz Jahanian2009-11-101-0/+33
| | | | | | global array of objects. llvm-svn: 86701
* Make a somewhat more convincing test case for unqualified lookup throughJohn McCall2009-11-101-0/+128
| | | | | | | | | using directives, and fix a bug thereby exposed: since we're playing tricks with pointers, we need to make certain we're always using the same pointers for things. Also tweak an existing error message. llvm-svn: 86679
* Simple test case for [basic.lookup.udir].John McCall2009-11-101-0/+35
| | | | llvm-svn: 86674
* Fix unqualified lookup through using directives.John McCall2009-11-101-0/+24
| | | | | | This is a pretty minimal test case; I'll make a better one later. llvm-svn: 86669
* When trying to assign a regular string literal to an Objective-C 'id' type ↵Anders Carlsson2009-11-101-2/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | or a pointer to an NSString, emit a code insertion hint that turns it into an Objective-C string. For example: @class NSString; @interface Test + (void)test:(NSString *)string; @end void g(NSString *a); void f() { NSString *a = "Foo"; g("Foo"); [Test test:"Foo"]; } will produce t.m:10:17: warning: incompatible pointer types initializing 'char [4]', expected 'NSString *' NSString *a = "Foo"; ^~~~~ @ t.m:11:5: warning: incompatible pointer types passing 'char [4]', expected 'NSString *' g("Foo"); ^~~~~ @ t.m:12:14: warning: incompatible pointer types sending 'char [4]', expected 'NSString *' [Test test:"Foo"]; ^~~~~ @ 3 diagnostics generated. llvm-svn: 86665
* If a function with a default argument is redefined and the new function also ↵Anders Carlsson2009-11-101-0/+9
| | | | | | has a defualt argument then add a fixit hint that removes the default argument. Fixes PR5444. llvm-svn: 86659
* Add test case for PointerSubChecker.Zhongxing Xu2009-11-101-0/+5
| | | | llvm-svn: 86657
* Refine PointerSubChecker: compare the base region instead of the original Zhongxing Xu2009-11-101-0/+5
| | | | | | region, so that arithmetic within a memory chunk is allowed. llvm-svn: 86652
* Enable the use of the new llvm objectsize intrinsic.Mike Stump2009-11-091-2/+2
| | | | llvm-svn: 86607
* Changed error for nested type qualifier mismatch toFariborz Jahanian2009-11-091-3/+3
| | | | | | | warning, to match gcc. It used to be warning, so better keep it a warning (it broke a certain project). llvm-svn: 86597
* Make sure that we look into nested, transparent declaration contextsDouglas Gregor2009-11-091-2/+6
| | | | | | | when looking for a name within a given DeclContext. Now enumerators will show up in code-completion results. llvm-svn: 86591
* For array pointee type, get its cvr qualifier fromFariborz Jahanian2009-11-091-0/+10
| | | | | | its element type. Fixes pr5432. llvm-svn: 86587
* Make sure that we instantiate default function arguments for anDouglas Gregor2009-11-091-2/+15
| | | | | | overloaded operator(). llvm-svn: 86581
* Add additional note to mark the cause of synthesized constructors. MarkEli Friedman2009-11-093-5/+5
| | | | | | | declaration invalid if the constructor can't be properly built. Addresses remaining review comments from Fariborz for r86500. llvm-svn: 86579
* Improve instantiation of default template arguments for nestedDouglas Gregor2009-11-091-0/+51
| | | | | | | | | templates. The instantiation of these default arguments must be (and now, is) delayed until the template argument is actually used, at which point we substitute all levels of template arguments concurrently. llvm-svn: 86578
* Add code generation test for r86500.Eli Friedman2009-11-091-0/+8
| | | | llvm-svn: 86574
* Test case for Sean Hunt's patch which I left out.Fariborz Jahanian2009-11-091-0/+10
| | | | llvm-svn: 86573
* Add support for cdecl attribute. (As far as I know, it doesn't affect CodeGenEli Friedman2009-11-091-0/+4
| | | | | | | | unless we start implementing command-line switches which override the default calling convention, so the effect is mostly to silence unknown attribute warnings.) llvm-svn: 86571
* Slightly more testing for instantiation of non-type template parameters in ↵Douglas Gregor2009-11-091-0/+13
| | | | | | nested templates, for my own sanity's sake llvm-svn: 86570
* Add a triple to try to fix the buildbot error.Anders Carlsson2009-11-091-1/+1
| | | | llvm-svn: 86563
* __uint128_t is indeed an unsigned integer type. Fixes PR5435.Anders Carlsson2009-11-091-0/+3
| | | | llvm-svn: 86561
* Simplify test to deal with type-based ordering variationsDouglas Gregor2009-11-091-2/+0
| | | | llvm-svn: 86552
* Verify that code-completion is at least a little bit robust against ↵Douglas Gregor2009-11-091-1/+1
| | | | | | inclusion of missing headers llvm-svn: 86551
* Minor cleanup for CIndex-based code-completion:Douglas Gregor2009-11-091-0/+51
| | | | | | | | - Provide an actual test for code-completion via CIndex. - Actually print optional strings in c-index-test - Export clang_getCompletionChunkCompletionString from CIndex llvm-svn: 86550
* update test case.Zhongxing Xu2009-11-091-1/+1
| | | | llvm-svn: 86541
* Add check for pointer arithmetic on non-array variables.Zhongxing Xu2009-11-091-0/+9
| | | | llvm-svn: 86538
OpenPOWER on IntegriCloud