Граф коммитов

18386 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner cb329c506d use DiagRuntimeBehavior to silence the div/rem by zero warning when
not in an evaluated context.  This removes some bogus warnings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93258 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 21:30:55 +00:00
Douglas Gregor 84d0a19828 Improve recovery for template-ids whose template-name doesn't actually
name a template, when they occur in a base-specifier. This is one of
the (few) places where we know for sure that an identifier followed by
a '<' must be a template name, so we can diagnose and recover well:

test/SemaTemplate/dependent-base-classes.cpp:9:16: error: missing
'template'
      keyword prior to dependent template name 'T::apply'
struct X1 : T::apply<U> { }; // expected-error{{missing 'template' ...
               ^
               template 
test/SemaTemplate/dependent-base-classes.cpp:12:13: error: unknown
template name
      'vector'
struct X2 : vector<T> { }; // expected-error{{unknown template name
'vector'}}
            ^
2 diagnostics generated.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93257 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 21:28:44 +00:00
Chris Lattner 7ef655a788 implement PR6004, warning about divide and remainder by zero.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93256 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 21:23:57 +00:00
Chris Lattner a1e1dc77e9 implement PR6007, diagnosing invalid attribute((section))
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93255 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 20:58:53 +00:00
Mike Stump cffd516070 Improve covariance tester to randomize the return value more.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93254 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 20:55:39 +00:00
Chandler Carruth 5535c38a2f Fix the CodeGen half of PR5911 by changing reference initialization to
correctly look through arrays to see cv-qualifiers. Also enhances the routine
for doing this to preserve more type sugaring for diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93252 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 20:32:25 +00:00
Ted Kremenek e9cde116a9 Further tweaking of USR generation. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93250 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 19:35:53 +00:00
Ted Kremenek 98271567b6 Make 'CXTranslationUnitIterator' an argument to perform_test_load(),
perform_test_load_tu(), and perform_test_load_source().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 18:53:15 +00:00
Fariborz Jahanian 453c1349a5 Define __weak attribute for objective-c pointers in
win32 targets. Fixes radar 7530235. Daniel please review.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93246 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 18:33:57 +00:00
Douglas Gregor d9b600c1a5 Parse dependent template-ids in base clauses and member
initializers. This isn't actually in the C++ grammar (in any version),
but that's clearly an oversight: both GCC and EDG support this syntax,
and it's used within Boost code. I'll file a core issue proposing
precisely the change made here. Fixes PR6008.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93243 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 17:52:59 +00:00
Fariborz Jahanian 26337b2f6d Improve on objective-c pointer recognition
during rewrite. No functionality chang.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93241 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 17:31:23 +00:00
Douglas Gregor 2e9338824f When determining whether a given name is a template in a dependent
context, do not attempt typo correction. This harms performance (as
Abramo noted) and can cause some amusing errors, as in this new
testcase.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93240 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 17:06:20 +00:00
Benjamin Kramer 148299f5eb Fix tests for r93231.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93238 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 11:52:20 +00:00
Benjamin Kramer 9895c6ab2a Remove trailing semicolons and silence MSVC warning about C linkage.
warning C4190: 'GetEntity' has C-linkage specified, but returns UDT
'clang::idx::Entity' which is incompatible with C


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93237 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 11:32:40 +00:00
John McCall cbce60633c So I was sitting around, trying vainly to think of something to commit, and then
I said to myself, self, why don't you go add a couple of parameters to a method
and then fail to use them, and I thought that sounded like a pretty good idea,
so I did it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93233 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 07:18:19 +00:00
Douglas Gregor 834389b874 Use horizontal-space markers in code-completion results rather than
embedding single space characters. <rdar://problem/7485503>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93231 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 06:38:28 +00:00
Mike Stump 72e933e998 Add covariance tester.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93226 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 03:01:18 +00:00
Daniel Dunbar 140fce2e7f Remove duplicate class name, MSVC doesn't like this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93225 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 02:34:07 +00:00
John McCall 3c80f573df Reorganize some of the code to note overload candidates. Improves the
fidelity with which we note them as functions/constructors and templates
thereof.  Also will be helpful when reporting bad conversions (next).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93224 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 02:15:36 +00:00
Ted Kremenek 8776382f7e Add a boilerplate implementation for clang_getUSR(). WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93223 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 02:07:58 +00:00
Fariborz Jahanian 66867c526c Fix rewriting of MacOS sjlj based eh.
Fixes radar 7522880.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93219 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 01:22:23 +00:00
Douglas Gregor 3f477a1a80 Name lookup should know better than to look into a class before it's defined
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93217 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 01:17:50 +00:00
John McCall 4248491ce4 Chris thinks these diagnostics are better now. :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93216 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 01:09:12 +00:00
John McCall bf65c0bb57 Sort overload results by viability.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93215 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 00:48:53 +00:00
John McCall 1d31833450 Introduce a specific representation for the ambiguous implicit conversion
sequence.  Lots of small relevant changes.  Fixes some serious problems with
ambiguous conversions;  also possibly improves associated diagnostics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93214 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 00:44:57 +00:00
Ted Kremenek 1fc00e6e49 Change clang_getUSR() to return a CXString instead of a 'const char *'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93213 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 00:38:53 +00:00
Ted Kremenek 4b333d2215 Make createCXString() a static member function of class CIndex.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93212 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 00:36:38 +00:00
Mike Stump 66d29ec664 Allow N_FIELDS to be 0.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93211 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 00:28:59 +00:00
Ted Kremenek 3172383341 CIndex:
- Remove unused (and unimplemented) clang_getDeclarationName().
- Remove unused (and unimplemented) clang_getEntity().
- Add clang_getEntityFromDecl(): maps from a CXDecl to a CXEntity)
- Add clang_getDeclaration(): maps from a (CXEntity, CXTranslationUnit) to a CXDecl).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93209 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 23:56:39 +00:00
Douglas Gregor b862b8f934 Eliminate an embarrassing performance regression in C/ObjC, where we
were performing name lookup for template names in C/ObjC and always
finding nothing. Turn off such lookup unless we're in C++ mode, along
with the check that determines whether the given identifier is a
"current class name", and assert that we don't make this mistake
again.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93207 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 23:29:10 +00:00
David Chisnall af40776922 Reverted r93198; done without reading relevant PR.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93205 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 23:08:08 +00:00
Fariborz Jahanian 91fbd12d8b Fix rewriting for forward class declaration.
(fixes radar 6969189).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93201 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 22:48:40 +00:00
Douglas Gregor 277d280c20 When performing name lookup into a scope, check that its entity is
non-NULL before looking at the entity itself.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93199 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 22:40:45 +00:00
David Chisnall 004f81f8d1 Allow VLAs in C++ if in GNU mode (GNU C++ permits them). Clang can now compile LanguageKit, although the resulting code crashes (although not in any of the functions that use VLAs).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93198 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 22:33:19 +00:00
Douglas Gregor 05f650001b C++0x [dcl.typedef]p4, take 3, where we actually figure out what "that
is not also a typedef-name" actually means. For anyone keeping score,
that's John: 2, Doug: 0.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93196 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 22:30:10 +00:00
Douglas Gregor 39700992bf Use isa<ElaboratedType> rather than getAs<ElaboratedType>, since the
latter may (eventually) perform multiple levels of desugaring (thus
breaking the newly-added tests) and the former is faster. Thanks, John!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93192 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 22:04:54 +00:00
Douglas Gregor b4a89998b2 Add test case from PR5763
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93190 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 21:58:49 +00:00
Douglas Gregor 93dda720a6 Allow redefinitions of typedef-names within class scope when the type
they redefine is a class-name but not a typedef-name, per C++0x
[dcl.typedef]p4. The code in the test was valid C++98 and is valid
C++0x, but an unintended consequence of DR56 made it ill-formed in
C++03 (which we were luck enough to implement). Fixes PR5455.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93188 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 21:54:40 +00:00
Fariborz Jahanian 97fd83a8d8 Fix a problem related to rewrite of anonymous unions.
(fixes radar 6948022)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93186 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 21:17:32 +00:00
Benjamin Kramer c027e54d66 Fix pasto.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93181 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 20:15:06 +00:00
Chris Lattner 6f41c17ae8 Use the new isInteger() method in a couple places, some random cleanup, and
add a fixme.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93179 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 19:58:10 +00:00
Douglas Gregor 9e68871f1e When resolving a single function template specialization to a
function, be sure to adjust the resulting argument type to a pointer
(if necessary). Fixes PR5910 and PR5949.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93178 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 19:55:36 +00:00
Douglas Gregor 9791bdc9b6 Test case for naming of conversion function template specializations
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93177 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 19:52:23 +00:00
Benjamin Kramer e45c149996 Avoid use of deprecated functions (CStrInCStrNoCase and StringsEqualNoCase).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93175 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 19:46:28 +00:00
Douglas Gregor 9007328043 When computing surrogates for calls to a value of object type, look
for all visible conversion functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93173 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 19:36:35 +00:00
Ken Dyck aa8741a1db Change return type of getObjCEncodingTypeSize() to CharUnits as the units are in characters.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93171 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 19:19:56 +00:00
David Chisnall f950837b82 Fix type mismatch on 64-bit platforms (GNU ObjC).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93169 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 19:02:35 +00:00
Douglas Gregor 066b0f122f Remove some pointless FIXMEs. No functionality change
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93168 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 19:00:50 +00:00
Douglas Gregor 0c55106cf9 Add support for out-of-line definitions of conversion function
templates. Previously, a little thinko in the code that replaced a
conversion function template with its redeclaration was causing some
very weird lookup behavior.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93166 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 18:53:25 +00:00
Douglas Gregor 58408bc4ea Tighten up the "cannot return array or function type" diagnostic to
say either "array type" or "function type", whichever it is. No reason
to make the user guess.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93164 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 18:46:21 +00:00