]> granicus.if.org Git - clang/log
clang
14 years agoWhenever completing ordinary names for an Objective-C source, also
Douglas Gregor [Wed, 13 Jan 2010 21:24:21 +0000 (21:24 +0000)]
Whenever completing ordinary names for an Objective-C source, also
provide completions for @ keywords. Previously, we only provided
@-completions after an @ was actually typed, which is useful but
probably not the common case.

Also, make sure a few Objective-C 2.0 completions only show up when
Objective-C 2.0 support is enabled (the default).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93354 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix Release-Asserts.
Mike Stump [Wed, 13 Jan 2010 21:23:04 +0000 (21:23 +0000)]
Fix Release-Asserts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93353 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix for Release-Assert.
Mike Stump [Wed, 13 Jan 2010 20:58:35 +0000 (20:58 +0000)]
Fix for Release-Assert.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93348 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix for Release-Asserts.
Mike Stump [Wed, 13 Jan 2010 20:57:29 +0000 (20:57 +0000)]
Fix for Release-Asserts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93347 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix Release-Asserts.
Mike Stump [Wed, 13 Jan 2010 20:43:31 +0000 (20:43 +0000)]
Fix Release-Asserts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93346 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd a BaseSubobject class to uniquely identify a base class subobject. Not yet used.
Anders Carlsson [Wed, 13 Jan 2010 20:11:15 +0000 (20:11 +0000)]
Add a BaseSubobject class to uniquely identify a base class subobject. Not yet used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93345 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd type source information for both kinds of typeof types.
John McCall [Wed, 13 Jan 2010 20:03:27 +0000 (20:03 +0000)]
Add type source information for both kinds of typeof types.
Patch by Enea Zaffanella.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93344 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd 'referringDecl' field to CXCursor to prepare the way to better model declaration...
Ted Kremenek [Wed, 13 Jan 2010 19:59:20 +0000 (19:59 +0000)]
Add 'referringDecl' field to CXCursor to prepare the way to better model declaration references from other delcarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93343 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix for Release-Asserts.
Mike Stump [Wed, 13 Jan 2010 19:40:37 +0000 (19:40 +0000)]
Fix for Release-Asserts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93340 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPredefine __weak attribute when doing objective-c
Fariborz Jahanian [Wed, 13 Jan 2010 18:51:17 +0000 (18:51 +0000)]
Predefine __weak attribute when doing objective-c
rewriting for any target. (refixes radar 7530235).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93331 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd extra null check in clang_disposeString().
Ted Kremenek [Wed, 13 Jan 2010 18:45:36 +0000 (18:45 +0000)]
Add extra null check in clang_disposeString().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93328 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoReimplement constructor declarator parsing to cope with template-ids
Douglas Gregor [Wed, 13 Jan 2010 17:31:36 +0000 (17:31 +0000)]
Reimplement constructor declarator parsing to cope with template-ids
that name constructors, the endless joys of out-of-line constructor
definitions, and various other corner cases that the previous hack
never imagined. Fixes PR5688 and tightens up semantic analysis for
constructor names.

Additionally, fixed a problem where we wouldn't properly enter the
declarator scope of a parenthesized declarator. We were entering the
scope, then leaving it when we saw the ")"; now, we re-enter the
declarator scope before parsing the parameter list.

Note that we are forced to perform some tentative parsing within a
class (call it C) to tell the difference between

  C(int); // constructor

and

  C (f)(int); // member function

which is rather unfortunate. And, although it isn't necessary for
correctness, we use the same tentative-parsing mechanism for
out-of-line constructors to improve diagnostics in icky cases like:

  C::C C::f(int); // error: C::C refers to the constructor name, but
                  // we complain nicely and recover by treating it as
                  // a type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93322 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix pasto in __has_feature(cxx_lambdas) docs
Douglas Gregor [Wed, 13 Jan 2010 16:27:49 +0000 (16:27 +0000)]
Fix pasto in __has_feature(cxx_lambdas) docs

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93320 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRecord some basic information about bad conversion sequences. Use that
John McCall [Wed, 13 Jan 2010 09:16:55 +0000 (09:16 +0000)]
Record some basic information about bad conversion sequences.  Use that
information to feed diagnostics instead of regenerating it.  Much room for
improvement here, but fixes some unfortunate problems reporting on method calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93316 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImplement semantic checking for C++ literal operators.
Sean Hunt [Wed, 13 Jan 2010 09:01:02 +0000 (09:01 +0000)]
Implement semantic checking for C++ literal operators.
This now rejects literal operators that don't meet the requirements.
Templates are not yet checked for.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93315 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUpdate test function names so as not to use potential keywords.
Sean Hunt [Wed, 13 Jan 2010 08:58:42 +0000 (08:58 +0000)]
Update test function names so as not to use potential keywords.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93314 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd a bunch more feature-checking macros for C++0x features. Some of these are
Sean Hunt [Wed, 13 Jan 2010 08:31:49 +0000 (08:31 +0000)]
Add a bunch more feature-checking macros for C++0x features. Some of these are
disabled with the intent that users can start with them now and not have to change
a thing to have them work when we implement the features.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93312 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoInsert clang-flags into the clang command. Currently it needs to be a list;
John McCall [Wed, 13 Jan 2010 06:44:51 +0000 (06:44 +0000)]
Insert clang-flags into the clang command.  Currently it needs to be a list;
future work should permit strings (by splitting them into a list o' strings).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93299 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agodiagnose invalid values of -ftabstop, patch by Christian Adaker!
Chris Lattner [Wed, 13 Jan 2010 03:06:50 +0000 (03:06 +0000)]
diagnose invalid values of -ftabstop, patch by Christian Adaker!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93288 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd an unreachable code checker.
Mike Stump [Wed, 13 Jan 2010 02:59:54 +0000 (02:59 +0000)]
Add an unreachable code checker.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93287 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agocc1: Factor out CompilerInstance::ExecuteAction which has the majority of the
Daniel Dunbar [Wed, 13 Jan 2010 00:48:06 +0000 (00:48 +0000)]
cc1: Factor out CompilerInstance::ExecuteAction which has the majority of the
clang -cc1 logic for running an action against a set of options.
 - This should make it easier to build tools that have a clang -cc1 like
   interface, but aren't actually part of clang -cc1.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93282 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agocc1: Lift creation of the FrontendAction higher.
Daniel Dunbar [Wed, 13 Jan 2010 00:47:51 +0000 (00:47 +0000)]
cc1: Lift creation of the FrontendAction higher.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93281 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImprove the reporting of non-viable overload candidates by noting the reason
John McCall [Wed, 13 Jan 2010 00:25:19 +0000 (00:25 +0000)]
Improve the reporting of non-viable overload candidates by noting the reason
why the candidate is non-viable.  There's a lot we can do to improve this, but
it's a good start.  Further improvements should probably be integrated with the
bad-initialization reporting routines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93277 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMove definitions for visitor methods in CDeclVisitor out-of-line.
Ted Kremenek [Wed, 13 Jan 2010 00:22:49 +0000 (00:22 +0000)]
Move definitions for visitor methods in CDeclVisitor out-of-line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93276 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake method definitions in TUVisitor out-of-line, making it easy to tell what visitor...
Ted Kremenek [Wed, 13 Jan 2010 00:13:47 +0000 (00:13 +0000)]
Make method definitions in TUVisitor out-of-line, making it easy to tell what visitor methods are defined.
Generalize TUVisitor to take a general "root" and "iterator" callback; this is prep. work to merging TUVisitor and CDeclVisitor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93275 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove broken fix-it when a default function argument has been
Douglas Gregor [Wed, 13 Jan 2010 00:12:48 +0000 (00:12 +0000)]
Remove broken fix-it when a default function argument has been
redefined. There's a FIXME with an apology about why we don't try to
do better here. Fixes <rdar://problem/7513023>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93274 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen in objective-c methods, do the built-in name lookup after
Fariborz Jahanian [Tue, 12 Jan 2010 23:58:59 +0000 (23:58 +0000)]
When in objective-c methods, do the built-in name lookup after
ivar name lookup. Fixes pr5986.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93271 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd USR printing modes to c-index-test.
Ted Kremenek [Tue, 12 Jan 2010 23:34:26 +0000 (23:34 +0000)]
Add USR printing modes to c-index-test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93269 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake clang_getDeclUSR() visible.
Ted Kremenek [Tue, 12 Jan 2010 23:34:05 +0000 (23:34 +0000)]
Make clang_getDeclUSR() visible.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93268 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRename clang_getUSR() -> clang_getDeclUSR(). For now we take a CXDecl instead of...
Ted Kremenek [Tue, 12 Jan 2010 23:33:42 +0000 (23:33 +0000)]
Rename clang_getUSR() -> clang_getDeclUSR().  For now we take a CXDecl instead of a CXEntity.
Enhance USR generation a bit with support for records.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93267 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDon't emit string-comparison or self-comparison warnings in
Douglas Gregor [Tue, 12 Jan 2010 23:18:54 +0000 (23:18 +0000)]
Don't emit string-comparison or self-comparison warnings in
unevaluated contexts, because they only matter for code that will
actually be evaluated at runtime.

As part of this, I had to extend PartialDiagnostic to support fix-it
hints.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93266 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove unused code.
Mike Stump [Tue, 12 Jan 2010 22:20:00 +0000 (22:20 +0000)]
Remove unused code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93262 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agotestcase for -ftabstop, patch by Christian Adaker!
Chris Lattner [Tue, 12 Jan 2010 22:06:58 +0000 (22:06 +0000)]
testcase for -ftabstop, patch by Christian Adaker!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93260 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agouse DiagRuntimeBehavior to silence the div/rem by zero warning when
Chris Lattner [Tue, 12 Jan 2010 21:30:55 +0000 (21:30 +0000)]
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

14 years agoImprove recovery for template-ids whose template-name doesn't actually
Douglas Gregor [Tue, 12 Jan 2010 21:28:44 +0000 (21:28 +0000)]
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

14 years agoimplement PR6004, warning about divide and remainder by zero.
Chris Lattner [Tue, 12 Jan 2010 21:23:57 +0000 (21:23 +0000)]
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

14 years agoimplement PR6007, diagnosing invalid attribute((section))
Chris Lattner [Tue, 12 Jan 2010 20:58:53 +0000 (20:58 +0000)]
implement PR6007, diagnosing invalid attribute((section))

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93255 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImprove covariance tester to randomize the return value more.
Mike Stump [Tue, 12 Jan 2010 20:55:39 +0000 (20:55 +0000)]
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

14 years agoFix the CodeGen half of PR5911 by changing reference initialization to
Chandler Carruth [Tue, 12 Jan 2010 20:32:25 +0000 (20:32 +0000)]
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

14 years agoFurther tweaking of USR generation. WIP.
Ted Kremenek [Tue, 12 Jan 2010 19:35:53 +0000 (19:35 +0000)]
Further tweaking of USR generation.  WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93250 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake 'CXTranslationUnitIterator' an argument to perform_test_load(),
Ted Kremenek [Tue, 12 Jan 2010 18:53:15 +0000 (18:53 +0000)]
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

14 years agoDefine __weak attribute for objective-c pointers in
Fariborz Jahanian [Tue, 12 Jan 2010 18:33:57 +0000 (18:33 +0000)]
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

14 years agoParse dependent template-ids in base clauses and member
Douglas Gregor [Tue, 12 Jan 2010 17:52:59 +0000 (17:52 +0000)]
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

14 years agoImprove on objective-c pointer recognition
Fariborz Jahanian [Tue, 12 Jan 2010 17:31:23 +0000 (17:31 +0000)]
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

14 years agoWhen determining whether a given name is a template in a dependent
Douglas Gregor [Tue, 12 Jan 2010 17:06:20 +0000 (17:06 +0000)]
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

14 years agoFix tests for r93231.
Benjamin Kramer [Tue, 12 Jan 2010 11:52:20 +0000 (11:52 +0000)]
Fix tests for r93231.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93238 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove trailing semicolons and silence MSVC warning about C linkage.
Benjamin Kramer [Tue, 12 Jan 2010 11:32:40 +0000 (11:32 +0000)]
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

14 years agoSo I was sitting around, trying vainly to think of something to commit, and then
John McCall [Tue, 12 Jan 2010 07:18:19 +0000 (07:18 +0000)]
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

14 years agoUse horizontal-space markers in code-completion results rather than
Douglas Gregor [Tue, 12 Jan 2010 06:38:28 +0000 (06:38 +0000)]
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

14 years agoAdd covariance tester.
Mike Stump [Tue, 12 Jan 2010 03:01:18 +0000 (03:01 +0000)]
Add covariance tester.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93226 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove duplicate class name, MSVC doesn't like this.
Daniel Dunbar [Tue, 12 Jan 2010 02:34:07 +0000 (02:34 +0000)]
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

14 years agoReorganize some of the code to note overload candidates. Improves the
John McCall [Tue, 12 Jan 2010 02:15:36 +0000 (02:15 +0000)]
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

14 years agoAdd a boilerplate implementation for clang_getUSR(). WIP.
Ted Kremenek [Tue, 12 Jan 2010 02:07:58 +0000 (02:07 +0000)]
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

14 years agoFix rewriting of MacOS sjlj based eh.
Fariborz Jahanian [Tue, 12 Jan 2010 01:22:23 +0000 (01:22 +0000)]
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

14 years agoName lookup should know better than to look into a class before it's defined
Douglas Gregor [Tue, 12 Jan 2010 01:17:50 +0000 (01:17 +0000)]
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

14 years agoChris thinks these diagnostics are better now. :)
John McCall [Tue, 12 Jan 2010 01:09:12 +0000 (01:09 +0000)]
Chris thinks these diagnostics are better now. :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93216 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSort overload results by viability.
John McCall [Tue, 12 Jan 2010 00:48:53 +0000 (00:48 +0000)]
Sort overload results by viability.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93215 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIntroduce a specific representation for the ambiguous implicit conversion
John McCall [Tue, 12 Jan 2010 00:44:57 +0000 (00:44 +0000)]
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

14 years agoChange clang_getUSR() to return a CXString instead of a 'const char *'.
Ted Kremenek [Tue, 12 Jan 2010 00:38:53 +0000 (00:38 +0000)]
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

14 years agoMake createCXString() a static member function of class CIndex.
Ted Kremenek [Tue, 12 Jan 2010 00:36:38 +0000 (00:36 +0000)]
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

14 years agoAllow N_FIELDS to be 0.
Mike Stump [Tue, 12 Jan 2010 00:28:59 +0000 (00:28 +0000)]
Allow N_FIELDS to be 0.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93211 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoCIndex:
Ted Kremenek [Mon, 11 Jan 2010 23:56:39 +0000 (23:56 +0000)]
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

14 years agoEliminate an embarrassing performance regression in C/ObjC, where we
Douglas Gregor [Mon, 11 Jan 2010 23:29:10 +0000 (23:29 +0000)]
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

14 years agoReverted r93198; done without reading relevant PR.
David Chisnall [Mon, 11 Jan 2010 23:08:08 +0000 (23:08 +0000)]
Reverted r93198; done without reading relevant PR.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93205 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix rewriting for forward class declaration.
Fariborz Jahanian [Mon, 11 Jan 2010 22:48:40 +0000 (22:48 +0000)]
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

14 years agoWhen performing name lookup into a scope, check that its entity is
Douglas Gregor [Mon, 11 Jan 2010 22:40:45 +0000 (22:40 +0000)]
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

14 years agoAllow VLAs in C++ if in GNU mode (GNU C++ permits them). Clang can now compile Langu...
David Chisnall [Mon, 11 Jan 2010 22:33:19 +0000 (22:33 +0000)]
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

14 years agoC++0x [dcl.typedef]p4, take 3, where we actually figure out what "that
Douglas Gregor [Mon, 11 Jan 2010 22:30:10 +0000 (22:30 +0000)]
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

14 years agoUse isa<ElaboratedType> rather than getAs<ElaboratedType>, since the
Douglas Gregor [Mon, 11 Jan 2010 22:04:54 +0000 (22:04 +0000)]
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

14 years agoAdd test case from PR5763
Douglas Gregor [Mon, 11 Jan 2010 21:58:49 +0000 (21:58 +0000)]
Add test case from PR5763

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93190 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAllow redefinitions of typedef-names within class scope when the type
Douglas Gregor [Mon, 11 Jan 2010 21:54:40 +0000 (21:54 +0000)]
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

14 years agoFix a problem related to rewrite of anonymous unions.
Fariborz Jahanian [Mon, 11 Jan 2010 21:17:32 +0000 (21:17 +0000)]
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

14 years agoFix pasto.
Benjamin Kramer [Mon, 11 Jan 2010 20:15:06 +0000 (20:15 +0000)]
Fix pasto.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93181 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUse the new isInteger() method in a couple places, some random cleanup, and
Chris Lattner [Mon, 11 Jan 2010 19:58:10 +0000 (19:58 +0000)]
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

14 years agoWhen resolving a single function template specialization to a
Douglas Gregor [Mon, 11 Jan 2010 19:55:36 +0000 (19:55 +0000)]
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

14 years agoTest case for naming of conversion function template specializations
Douglas Gregor [Mon, 11 Jan 2010 19:52:23 +0000 (19:52 +0000)]
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

14 years agoAvoid use of deprecated functions (CStrInCStrNoCase and StringsEqualNoCase).
Benjamin Kramer [Mon, 11 Jan 2010 19:46:28 +0000 (19:46 +0000)]
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

14 years agoWhen computing surrogates for calls to a value of object type, look
Douglas Gregor [Mon, 11 Jan 2010 19:36:35 +0000 (19:36 +0000)]
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

14 years agoChange return type of getObjCEncodingTypeSize() to CharUnits as the units are in...
Ken Dyck [Mon, 11 Jan 2010 19:19:56 +0000 (19:19 +0000)]
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

14 years agoFix type mismatch on 64-bit platforms (GNU ObjC).
David Chisnall [Mon, 11 Jan 2010 19:02:35 +0000 (19:02 +0000)]
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

14 years agoRemove some pointless FIXMEs. No functionality change
Douglas Gregor [Mon, 11 Jan 2010 19:00:50 +0000 (19:00 +0000)]
Remove some pointless FIXMEs. No functionality change

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93168 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd support for out-of-line definitions of conversion function
Douglas Gregor [Mon, 11 Jan 2010 18:53:25 +0000 (18:53 +0000)]
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

14 years agoTighten up the "cannot return array or function type" diagnostic to
Douglas Gregor [Mon, 11 Jan 2010 18:46:21 +0000 (18:46 +0000)]
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

14 years agoImplement name lookup for conversion function template specializations
Douglas Gregor [Mon, 11 Jan 2010 18:40:55 +0000 (18:40 +0000)]
Implement name lookup for conversion function template specializations
(C++ [temp.mem]p5-6), which involves template argument deduction based
on the type named, e.g., given

  struct X { template<typename T> operator T*(); } x;

when we call

  x.operator int*();

we perform template argument deduction to determine that T=int. This
template argument deduction is needed for template specialization and
explicit instantiation, e.g.,

  template<> X::operator float*() { /* ... */ }

and when calling or otherwise naming a conversion function (as in the
first example).

This fixes PR5742 and PR5762, although there's some remaining ugliness
that's causing out-of-line definitions of conversion function
templates to fail. I'll look into that separately.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93162 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFixup rewrite of ivars accessed via an explicit object
Fariborz Jahanian [Mon, 11 Jan 2010 17:50:35 +0000 (17:50 +0000)]
Fixup rewrite of ivars accessed via an explicit object
in a function. Fixes radar 7522803.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93159 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRoll out ASTContext::getTypeSizeInChars(), replacing instances of
Ken Dyck [Mon, 11 Jan 2010 17:06:35 +0000 (17:06 +0000)]
Roll out ASTContext::getTypeSizeInChars(), replacing instances of
"ASTContext::getTypeSize() / 8". Replace [u]int64_t variables with CharUnits
ones as appropriate.

Also rename RawType, fromRaw(), and getRaw() in CharUnits to QuantityType,
fromQuantity(), and getQuantity() for clarity.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93153 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake Clang complain about taking the address of an unqualified member function. Fixes...
Sebastian Redl [Mon, 11 Jan 2010 15:56:56 +0000 (15:56 +0000)]
Make Clang complain about taking the address of an unqualified member function. Fixes PR5985.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93150 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoEnhance ScanReachableSymbols::scan(). Now another OSAtomic test case passes.
Zhongxing Xu [Mon, 11 Jan 2010 07:40:00 +0000 (07:40 +0000)]
Enhance ScanReachableSymbols::scan(). Now another OSAtomic test case passes.
The old test case has a little mistake.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93148 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoEnhance SVals::getAsRegion: get the region that is converted to an integer.
Zhongxing Xu [Mon, 11 Jan 2010 06:52:53 +0000 (06:52 +0000)]
Enhance SVals::getAsRegion: get the region that is converted to an integer.
This with previous patch fixes a OSAtomic test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93146 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoadd a TODO for a perf improvement in LexIdentifier.
Chris Lattner [Mon, 11 Jan 2010 02:38:50 +0000 (02:38 +0000)]
add a TODO for a perf improvement in LexIdentifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93141 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSwitch RegionStore over to using <BaseRegion+raw offset> to store
Ted Kremenek [Mon, 11 Jan 2010 02:33:26 +0000 (02:33 +0000)]
Switch RegionStore over to using <BaseRegion+raw offset> to store
value bindings.  Along with a small change to OSAtomicChecker, this
resolves <rdar://problem/7527292> and resolves some long-standing
issues with how values can be bound to the same physical address by
not have the same "key".  This change is only a beginning; logically
RegionStore needs to better handle loads from addresses where the
stored value is larger/smaller/different type than the loaded value.
We handle these cases in an approximate fashion now (via
CastRetrievedVal and help in SimpleSValuator), but it could be made
much smarter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93137 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPreliminary reworking of value-binding logic in RegionStore:
Ted Kremenek [Mon, 11 Jan 2010 00:07:44 +0000 (00:07 +0000)]
Preliminary reworking of value-binding logic in RegionStore:

(1) Introduce a new 'BindingKey' class to match 'BindingValue'.  This
gives us the flexibility to change the current key value from 'const
MemRegion*' to something more interesting.

(2) Rework additions/removals/lookups from the store to use new
'Remove', 'Add', 'Lookup' utility methods.

No "real" functionality change; just prep work and abstraction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93136 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDo not parse hexadecimal floating point literals in C++0x mode because they are
Sean Hunt [Sun, 10 Jan 2010 23:37:56 +0000 (23:37 +0000)]
Do not parse hexadecimal floating point literals in C++0x mode because they are
incompatible with user-defined literals, specifically with the following form:

  0x1p+1

The preprocessing-number token extends only as far as the 'p'; the '+' is not
included. Previously we could get away with this extension as p was an invalid
suffix, but now with user-defined literals, 'p' might well be a valid suffix
and we are forced to consider it as such.

This patch also adds a warning in non-0x C++ modes telling the user that
this extension is incompatible with C++0x that is enabled by default
(previously and with other languages, we warn only with a compliance
option such as -pedantic).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93135 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImprove code completion by introducing patterns for the various C and
Douglas Gregor [Sun, 10 Jan 2010 23:08:15 +0000 (23:08 +0000)]
Improve code completion by introducing patterns for the various C and
C++ grammatical constructs that show up in top-level (namespace-level)
declarations, member declarations, template declarations, statements,
expressions, conditions, etc. For example, we now provide a pattern
for

  static_cast<type>(expr)

when we can have an expression, or

  using namespace identifier;

when we can have a using directive.

Also, improves the results of code completion at the beginning of a
top-level declaration. Previously, we would see value names (function
names, global variables, etc.); now we see types, namespace names,
etc., but no values.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93134 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake sure this test case tests analyzing both x86_64 and i386 archs.
Ted Kremenek [Sun, 10 Jan 2010 22:31:25 +0000 (22:31 +0000)]
Make sure this test case tests analyzing both x86_64 and i386 archs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93133 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSilence MSVC warning.
Benjamin Kramer [Sun, 10 Jan 2010 19:57:50 +0000 (19:57 +0000)]
Silence MSVC warning.

RewriteObjC.cpp(4419) : warning C4804: '>' : unsafe use of type 'bool' in operation

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93124 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake clone() method out-of-line for Attr classes.
Anton Korobeynikov [Sun, 10 Jan 2010 14:38:13 +0000 (14:38 +0000)]
Make clone() method out-of-line for Attr classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93120 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTry to make cmake happy
Anton Korobeynikov [Sun, 10 Jan 2010 13:06:34 +0000 (13:06 +0000)]
Try to make cmake happy

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93119 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoGeneralize target weirdness handling having proper layering in mind:
Anton Korobeynikov [Sun, 10 Jan 2010 12:58:08 +0000 (12:58 +0000)]
Generalize target weirdness handling having proper layering in mind:
 1. Add helper class for sema checks for target attributes
 2. Add helper class for codegen of target attributes

As a proof-of-concept - implement msp430's 'interrupt' attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93118 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRename file to generalization in next commits
Anton Korobeynikov [Sun, 10 Jan 2010 12:57:30 +0000 (12:57 +0000)]
Rename file to generalization in next commits

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93117 91177308-0d34-0410-b5e6-96231b3b80d8