]> granicus.if.org Git - clang/log
clang
14 years agoAdd test case that was causing an infinite loop when reading PCH files. The test...
Douglas Gregor [Wed, 14 Jul 2010 04:45:33 +0000 (04:45 +0000)]
Add test case that was causing an infinite loop when reading PCH files. The test works with ToT Clang already

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

14 years agoRemove a few mangling FIXMEs:
John McCall [Wed, 14 Jul 2010 04:38:21 +0000 (04:38 +0000)]
Remove a few mangling FIXMEs:
 - TSTs whose template is a template template parameter already work
 - we don't provide an imaginary type, so we can't mangle one
 - we don't need a generic FIXME for vendor type qualifiers

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

14 years agoImplement the standard mangling for array-subscript expressions, and implement
John McCall [Wed, 14 Jul 2010 04:20:34 +0000 (04:20 +0000)]
Implement the standard mangling for array-subscript expressions, and implement
the current proposals from David Vandervoorde for new, delete, throw, typeid,
imaginary literals, string literals, and null literals.

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

14 years agoFix typo in test program
Douglas Gregor [Wed, 14 Jul 2010 00:09:17 +0000 (00:09 +0000)]
Fix typo in test program

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

14 years agoDriver/Darwin: Pass -pie/-no_pie to the linker when -fpie/-fno-pie and friends
Daniel Dunbar [Tue, 13 Jul 2010 23:31:40 +0000 (23:31 +0000)]
Driver/Darwin: Pass -pie/-no_pie to the linker when -fpie/-fno-pie and friends
are explicitly given.

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

14 years agoAdd missing testcases for lvalue bitcasts
Douglas Gregor [Tue, 13 Jul 2010 23:27:15 +0000 (23:27 +0000)]
Add missing testcases for lvalue bitcasts

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

14 years agoWork around an obnoxious GCC warning by changing semantics in a hopefully-
John McCall [Tue, 13 Jul 2010 23:19:49 +0000 (23:19 +0000)]
Work around an obnoxious GCC warning by changing semantics in a hopefully-
harmless way.

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

14 years agoIntroduce a new cast kind for an "lvalue bitcast", which handles
Douglas Gregor [Tue, 13 Jul 2010 23:17:26 +0000 (23:17 +0000)]
Introduce a new cast kind for an "lvalue bitcast", which handles
reinterpret_casts (possibly indirectly via C-style/functional casts)
on values, e.g.,

  int i;
  reinterpret_cast<short&>(i);

The IR generated for this is essentially the same as for

  *reinterpret_cast<short*>(&i).

Fixes PR6437, PR7593, and PR7344.

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

14 years agoAdd __builtin_snprintf.
Nick Lewycky [Tue, 13 Jul 2010 22:35:05 +0000 (22:35 +0000)]
Add __builtin_snprintf.

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

14 years agoSwitch the __cxa_rethrow cleanup to be lazy.
John McCall [Tue, 13 Jul 2010 22:24:23 +0000 (22:24 +0000)]
Switch the __cxa_rethrow cleanup to be lazy.

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

14 years agoAllow for the possibility that __cxa_end_catch might throw for a catch-all block
John McCall [Tue, 13 Jul 2010 22:12:14 +0000 (22:12 +0000)]
Allow for the possibility that __cxa_end_catch might throw for a catch-all block
or a catch of a record type by value or reference.  Also convert this to a
lazy cleanup.

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

14 years agoCheck on property attributes which are declared
Fariborz Jahanian [Tue, 13 Jul 2010 22:04:56 +0000 (22:04 +0000)]
Check on property attributes which are declared
in class extensions (radar 8171968).

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

14 years agoSwitch the __cxa_free_exception cleanup to be lazy.
John McCall [Tue, 13 Jul 2010 21:17:51 +0000 (21:17 +0000)]
Switch the __cxa_free_exception cleanup to be lazy.

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

14 years agoSet DeclContext of ParamVarDecl only. No need
Fariborz Jahanian [Tue, 13 Jul 2010 21:05:02 +0000 (21:05 +0000)]
Set DeclContext of ParamVarDecl only. No need
to set that of VarDecl for block variables
(they are already set). Per Doug's comment.

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

14 years agoTeach IR generation how to lazily emit cleanups. This has a lot of advantages,
John McCall [Tue, 13 Jul 2010 20:32:21 +0000 (20:32 +0000)]
Teach IR generation how to lazily emit cleanups.  This has a lot of advantages,
mostly in avoiding unnecessary work at compile time but also in producing more
sensible block orderings.

Move the destructor cleanups for local variables over to use lazy cleanups.
Eventually all cleanups will do this;  for now we have some awkward code
duplication.

Tell IR generation just to never produce landing pads in -fno-exceptions.
This is a much more comprehensive solution to a problem which previously was
half-solved by checks in most cleanup-generation spots.

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

14 years agoAdd two small utility functions to PCHReader that the writer will use. WIP.
Sebastian Redl [Tue, 13 Jul 2010 20:12:07 +0000 (20:12 +0000)]
Add two small utility functions to PCHReader that the writer will use. WIP.

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

14 years agoMore block instantiation stuff. Set variable/param DeclContext
Fariborz Jahanian [Tue, 13 Jul 2010 20:05:58 +0000 (20:05 +0000)]
More block instantiation stuff. Set variable/param DeclContext
to block context when first instantiating them.

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

14 years agoAdd a warning to catch a bug recently caught by code review, like this:
Chris Lattner [Tue, 13 Jul 2010 19:41:32 +0000 (19:41 +0000)]
Add a warning to catch a bug recently caught by code review, like this:
t2.c:2:12: warning: use of logical && with constant operand; switch to bitwise &
      or remove constant [-Wlogical-bitwise-confusion]
  return x && 4;
           ^  ~

wording improvement suggestions are welcome.

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

14 years ago80 column issues.
Chris Lattner [Tue, 13 Jul 2010 19:22:31 +0000 (19:22 +0000)]
80 column issues.

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

14 years agoWhenever we're creating an expression that is typically an rvalue
Douglas Gregor [Tue, 13 Jul 2010 18:40:04 +0000 (18:40 +0000)]
Whenever we're creating an expression that is typically an rvalue
(e.g., a call, cast, etc.), immediately adjust the expression's type
to strip cv-qualifiers off of all non-class types (in C++) or all
types (in C). This effectively extends my previous fix for PR7463,
which was restricted to calls, to other kinds of expressions within
similar characteristics. I've audited every use of
getNonReferenceType() in the code base, switching to the newly-renamed
getNonLValueExprType() where necessary.

Big thanks to Eli for pointing out just how incomplete my original fix
for PR7463 actually was. We've been handling cv-qualifiers on rvalues
wrong for a very, very long time. Fixes PR7463.

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

14 years agoSilence Doug's favorite GCC warning.
Chandler Carruth [Tue, 13 Jul 2010 17:07:17 +0000 (17:07 +0000)]
Silence Doug's favorite GCC warning.

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

14 years agoAdd volatile qualifiers for "this".
Devang Patel [Tue, 13 Jul 2010 16:23:13 +0000 (16:23 +0000)]
Add volatile qualifiers for "this".

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

14 years agoProperly add to 32
Douglas Gregor [Tue, 13 Jul 2010 15:57:00 +0000 (15:57 +0000)]
Properly add to 32

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

14 years agoDowngrade the "when type is in parentheses, array cannot have dynamic
Douglas Gregor [Tue, 13 Jul 2010 15:54:32 +0000 (15:54 +0000)]
Downgrade the "when type is in parentheses, array cannot have dynamic
size" error for code like

  new (int [size])

to a warning, add a Fix-It to remove the parentheses, and make this
diagnostic work properly when it occurs in a template
instantiation. <rdar://problem/8018245>.

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

14 years agoModify the pragma handlers to accept and use StringRefs instead of IdentifierInfos.
Argyrios Kyrtzidis [Tue, 13 Jul 2010 09:07:17 +0000 (09:07 +0000)]
Modify the pragma handlers to accept and use StringRefs instead of IdentifierInfos.

When loading the PCH, IdentifierInfos that are associated with pragmas cause declarations that use these identifiers to be deserialized (e.g. the "clang" pragma causes the "clang" namespace to be loaded).
We can avoid this if we just use StringRefs for the pragmas.

As a bonus, since we don't have to create and pass IdentifierInfos, the pragma interfaces get a bit more simplified.

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

14 years agoImprove diagnostics for the "type qualifier on return type has no
Douglas Gregor [Tue, 13 Jul 2010 08:50:30 +0000 (08:50 +0000)]
Improve diagnostics for the "type qualifier on return type has no
effect warning" by printing the qualifiers we saw and correctly
pluralizing the message, e.g.,

test/SemaCXX/conditional-expr.cpp:295:3: warning: 'const volatile' type
      qualifiers on return type have no effect
  const volatile Enum g2() {
  ^~~~~ ~~~~~~~~

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

14 years agoWhen computing the canonical profile of a DeclRefExpr or MemberExpr,
Douglas Gregor [Tue, 13 Jul 2010 08:37:11 +0000 (08:37 +0000)]
When computing the canonical profile of a DeclRefExpr or MemberExpr,
don't include the nested-name-specifier or template arguments: they
were only relevant when resolving the declaration. Fixes PR7460.

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

14 years agoWhen forming a function call or message send expression, be sure to
Douglas Gregor [Tue, 13 Jul 2010 08:18:22 +0000 (08:18 +0000)]
When forming a function call or message send expression, be sure to
strip cv-qualifiers from the expression's type when the language calls
for it: in C, that's all the time, while C++ only does it for
non-class types.

Centralized the computation of the call expression type in
QualType::getCallResultType() and some helper functions in other nodes
(FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant
callers of getResultType() to getCallResultType().

Fixes PR7598 and PR7463, along with a bunch of getResultType() call
sites that weren't stripping references off the result type (nothing
stripped cv-qualifiers properly before this change).

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

14 years agoDiagnose typedef of an operator name. Fixes PR7462
Douglas Gregor [Tue, 13 Jul 2010 06:37:01 +0000 (06:37 +0000)]
Diagnose typedef of an operator name. Fixes PR7462

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

14 years agoCheck in this -Wconversion C++ test case that's been sitting on my machine
John McCall [Tue, 13 Jul 2010 06:26:23 +0000 (06:26 +0000)]
Check in this -Wconversion C++ test case that's been sitting on my machine
for awhile.

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

14 years agoComplain when an unnamed enumeration has no enumerations (in
Douglas Gregor [Tue, 13 Jul 2010 06:24:26 +0000 (06:24 +0000)]
Complain when an unnamed enumeration has no enumerations (in
C++). Fixes PR7466.

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

14 years agoReinstate the optimization suppressing available_externally functions
Douglas Gregor [Tue, 13 Jul 2010 06:02:28 +0000 (06:02 +0000)]
Reinstate the optimization suppressing available_externally functions
at -O0. The only change from the previous patch is that we don't try
to generate virtual method thunks for an available_externally
function.

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

14 years agoconst qualify debug info for "this" for const methods.
Devang Patel [Tue, 13 Jul 2010 00:24:30 +0000 (00:24 +0000)]
const qualify debug info for "this" for const methods.

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

14 years agoInstantiate attributes when first building an instantiated
Fariborz Jahanian [Tue, 13 Jul 2010 00:16:40 +0000 (00:16 +0000)]
Instantiate attributes when first building an instantiated
VarDecl.

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

14 years agoProvide a special diagnostic for attempts to explicitly specialize
Douglas Gregor [Tue, 13 Jul 2010 00:10:04 +0000 (00:10 +0000)]
Provide a special diagnostic for attempts to explicitly specialize
class templates within class scope (which is ill-formed), and recover
by dropping the explicit specialization entirely. Fixes the infinite
loop in PR7622.

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

14 years agoFix a documentation paste-o and eliminate a useless function parameter, both found...
Douglas Gregor [Mon, 12 Jul 2010 23:48:14 +0000 (23:48 +0000)]
Fix a documentation paste-o and eliminate a useless function parameter, both found by Sebastian

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

14 years agoWe should not be recursing over the shadow definitions in UsingDecl --
Craig Silverstein [Mon, 12 Jul 2010 23:30:43 +0000 (23:30 +0000)]
We should not be recursing over the shadow definitions in UsingDecl --
they're not something the user typed (at least, not here).

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

14 years agoProduce an error on encountering a pointer or reference to a qualified function type...
Sebastian Redl [Mon, 12 Jul 2010 23:11:43 +0000 (23:11 +0000)]
Produce an error on encountering a pointer or reference to a qualified function type. Fixes PR7470.

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

14 years agoWhile collecting members for a class, always create delcaration entry for methods...
Devang Patel [Mon, 12 Jul 2010 22:54:41 +0000 (22:54 +0000)]
While collecting members for a class, always create delcaration entry for methods. Debug info for method definition will be generated while generating code for method body.
Tested by classes.exp in gdb testsuite.

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

14 years agoSplit the normal and chained PCH writing paths and add a tiny bit of implementation...
Sebastian Redl [Mon, 12 Jul 2010 22:02:52 +0000 (22:02 +0000)]
Split the normal and chained PCH writing paths and add a tiny bit of implementation to the latter. WIP.

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

14 years agoRemove the check for repeated tok::eofs, we are not supposed to go past eof so this...
Argyrios Kyrtzidis [Mon, 12 Jul 2010 21:41:41 +0000 (21:41 +0000)]
Remove the check for repeated tok::eofs, we are not supposed to go past eof so this code is
totally unnecessary.

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

14 years agoSimplify code using the new FoldingSetImpl::InsertNode() overload.
Argyrios Kyrtzidis [Mon, 12 Jul 2010 21:41:31 +0000 (21:41 +0000)]
Simplify code using the new FoldingSetImpl::InsertNode() overload.

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

14 years agoCopy over attributes to instantiated variable.
Fariborz Jahanian [Mon, 12 Jul 2010 21:12:19 +0000 (21:12 +0000)]
Copy over attributes to instantiated variable.

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

14 years agoSpeculatively revert r108156; it appears to be breaking self-host.
Douglas Gregor [Mon, 12 Jul 2010 21:08:32 +0000 (21:08 +0000)]
Speculatively revert r108156; it appears to be breaking self-host.

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

14 years agoIf we are past tok::eof and in caching lex mode, avoid caching repeated tok::eofs.
Argyrios Kyrtzidis [Mon, 12 Jul 2010 18:49:30 +0000 (18:49 +0000)]
If we are past tok::eof and in caching lex mode, avoid caching repeated tok::eofs.

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

14 years agoAdd a -code-completion-timing= mode to c-index-test, so that we can
Douglas Gregor [Mon, 12 Jul 2010 18:38:41 +0000 (18:38 +0000)]
Add a -code-completion-timing= mode to c-index-test, so that we can
test the performance of code-completion without testing the
performance of printf().

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

14 years agoCompute Type dependent-ness of BlockDeclRefExpr
Fariborz Jahanian [Mon, 12 Jul 2010 18:12:03 +0000 (18:12 +0000)]
Compute Type dependent-ness of BlockDeclRefExpr
on the fly when constructing it.

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

14 years agoAdd test case for <rdar://problem/8177927> (which triggered an assertion failure...
Ted Kremenek [Mon, 12 Jul 2010 17:35:39 +0000 (17:35 +0000)]
Add test case for <rdar://problem/8177927> (which triggered an assertion failure in SemaChecking).

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

14 years agoMove setting of Dependent Type to BlockDeclRefExpr's
Fariborz Jahanian [Mon, 12 Jul 2010 17:26:57 +0000 (17:26 +0000)]
Move setting of Dependent Type to BlockDeclRefExpr's
constructor.

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

14 years agoDo not generate LLVM IR for available_externally function bodies at
Douglas Gregor [Mon, 12 Jul 2010 17:24:55 +0000 (17:24 +0000)]
Do not generate LLVM IR for available_externally function bodies at
-O0, since we won't be using the definitions for anything anyway. For
lib/System/Path.o when built in Debug+Asserts mode, this leads to a 4%
improvement in compile time (and suppresses 440 function bodies).

<rdar://problem/7987644>

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

14 years agoFix another aspect of PR7047, macro expansions. Previously, this was hacked
Chandler Carruth [Mon, 12 Jul 2010 06:23:38 +0000 (06:23 +0000)]
Fix another aspect of PR7047, macro expansions. Previously, this was hacked
around by exempting enums from the check, but this doesn't handle a lot of
cases. A better approach is to directly check if the operator comes from
a macro expansion.

I've removed a reference to the rdar that originally led to the enum
suppression when removing it's overly contrived test case. Let me know if that
number or a more reasilistic test case involving enums is still needed.

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

14 years agowe do in fact have to cache the EOF token returned by the preprocessor.
Chris Lattner [Mon, 12 Jul 2010 04:25:32 +0000 (04:25 +0000)]
we do in fact have to cache the EOF token returned by the preprocessor.
In the case of backtracking, the cached token lexer will be the only
lexer on the stack, without this the token stack will be empty and EOF
won't be returned.

This fixes PR7072.

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

14 years agorevert a hunk of code that Argiris added in r106213, which is the
Chris Lattner [Mon, 12 Jul 2010 01:48:28 +0000 (01:48 +0000)]
revert a hunk of code that Argiris added in r106213, which is the
root cause of PR7481 and probably more, and has no apparent
testcases.  I don't understand the logic here so I can't repair it.

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

14 years agofix PR7280 by making the warning on code like this:
Chris Lattner [Sun, 11 Jul 2010 23:34:02 +0000 (23:34 +0000)]
fix PR7280 by making the warning on code like this:

int test1() {
  return;
}

default to an error.

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

14 years agochange the 'invalid token after top level declarator' message to be
Chris Lattner [Sun, 11 Jul 2010 22:46:04 +0000 (22:46 +0000)]
change the 'invalid token after top level declarator' message to be
'expected ';' after top level declarator' which is much less vague.

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

14 years agoFix PR7617 by not entering ParseFunctionDefinition when
Chris Lattner [Sun, 11 Jul 2010 22:42:07 +0000 (22:42 +0000)]
Fix PR7617 by not entering ParseFunctionDefinition when
a function prototype is followed by a declarator if we
aren't parsing a K&R style identifier list.

Also, avoid skipping randomly after a declaration if a
semicolon is missing.  Before we'd get:

t.c:3:1: error: expected function body after function declarator
void bar();
^

Now we get:

t.c:1:11: error: invalid token after top level declarator
void foo()
          ^
          ;

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

14 years agoadd a const qualifier, refactor some code.
Chris Lattner [Sun, 11 Jul 2010 22:24:20 +0000 (22:24 +0000)]
add a const qualifier, refactor some code.

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

14 years agoSwitch to void-cast for this. Chris prefers that over the attribute, I'll
Chandler Carruth [Sun, 11 Jul 2010 07:42:13 +0000 (07:42 +0000)]
Switch to void-cast for this. Chris prefers that over the attribute, I'll
probably try and switch more of these if I can.

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

14 years agoMark assert-only variables as unused.
Chandler Carruth [Sun, 11 Jul 2010 03:24:05 +0000 (03:24 +0000)]
Mark assert-only variables as unused.

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

14 years agoRename clang.dll to libclang.dll, to fix Windows build.
John Thompson [Sun, 11 Jul 2010 03:23:30 +0000 (03:23 +0000)]
Rename clang.dll to libclang.dll, to fix Windows build.

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

14 years agoPrintFunctionNames is a plugin, it should pull in symbols from the clang binary
Nick Lewycky [Sat, 10 Jul 2010 20:24:23 +0000 (20:24 +0000)]
PrintFunctionNames is a plugin, it should pull in symbols from the clang binary
that loads it, not by linking against them directly.

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

14 years agoClang do so have plugins, we can't prune exports. Fixes plugin support.
Nick Lewycky [Sat, 10 Jul 2010 20:19:47 +0000 (20:19 +0000)]
Clang do so have plugins, we can't prune exports.  Fixes plugin support.

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

14 years agoFix compile error. Per Fariborz.
Dale Johannesen [Sat, 10 Jul 2010 19:53:56 +0000 (19:53 +0000)]
Fix compile error.  Per Fariborz.

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

14 years agoLay the ground work for resoving PR7047. This doesn't actually fix it because
Chandler Carruth [Sat, 10 Jul 2010 12:30:03 +0000 (12:30 +0000)]
Lay the ground work for resoving PR7047. This doesn't actually fix it because
default arguments to template parameters don't have a DeclContext when
instantiated, and so we can't detect that we're in an instantiation context as
opposed to the definition context. However, it fixes the more commonly-occuring
cases in TMP code that use devolve to this type of tautology after
substitution.

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

14 years agoAdd PCH support for the remaining C++ exprs.
Argyrios Kyrtzidis [Sat, 10 Jul 2010 11:46:15 +0000 (11:46 +0000)]
Add PCH support for the remaining C++ exprs.

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

14 years agoFix CMake build
Peter Collingbourne [Fri, 9 Jul 2010 23:06:34 +0000 (23:06 +0000)]
Fix CMake build

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

14 years agoHack for dealing with commas until we support multiple alternative constraints, per...
John Thompson [Fri, 9 Jul 2010 22:49:34 +0000 (22:49 +0000)]
Hack for dealing with commas until we support multiple alternative constraints, per pr7338.

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

14 years agoBlockDeclRefExpr of a dependent type must
Fariborz Jahanian [Fri, 9 Jul 2010 22:21:32 +0000 (22:21 +0000)]
BlockDeclRefExpr of a dependent type must
be a dependent expression when its is built.

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

14 years agoInstantiation of byref variable in
Fariborz Jahanian [Fri, 9 Jul 2010 21:27:28 +0000 (21:27 +0000)]
Instantiation of byref variable in
block literal expression.

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

14 years agoSlightly improve the diagnostic when using a qualified function typedef to declare...
Sebastian Redl [Fri, 9 Jul 2010 21:26:08 +0000 (21:26 +0000)]
Slightly improve the diagnostic when using a qualified function typedef to declare nonmember or static member functions.

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

14 years agoReorganize how ClassTemplate[Partial]SpecializationDecls are read/written to avoid the
Argyrios Kyrtzidis [Fri, 9 Jul 2010 21:11:43 +0000 (21:11 +0000)]
Reorganize how ClassTemplate[Partial]SpecializationDecls are read/written to avoid the
possibility of adding an unitialized one into the folding set.

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

14 years agoisMemberSpecialization -> setMemberSpecialization.
Argyrios Kyrtzidis [Fri, 9 Jul 2010 21:11:35 +0000 (21:11 +0000)]
isMemberSpecialization -> setMemberSpecialization.

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

14 years agoWhen given the -chained-pch option and a previous PCH file, have the PCHWriter emit...
Sebastian Redl [Fri, 9 Jul 2010 21:00:24 +0000 (21:00 +0000)]
When given the -chained-pch option and a previous PCH file, have the PCHWriter emit a CHAINED_METADATA record instead of METADATA, and write a link to the previous file there.

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

14 years agoFix a crashing but trying to print a TemplateTemplateParmDecl
Craig Silverstein [Fri, 9 Jul 2010 20:25:10 +0000 (20:25 +0000)]
Fix a crashing but trying to print a TemplateTemplateParmDecl
for code like this:
   template<template<typename T> class U> class V {};

The problem is that the DeclPrinter assumed all TemplateDecls
have a getTemplatedClass(), but template template params don't
(so we got a NULL dereference).  The solution is to detect if
we're a template template param, and construct the template
class name ('class U') specially in this case.

OKed by dgregor and chandlerc

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

14 years agoIgnore -Wno-main, per PR7269.
Eli Friedman [Fri, 9 Jul 2010 20:03:13 +0000 (20:03 +0000)]
Ignore -Wno-main, per PR7269.

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

14 years agoRip out the floating point return type handling from the atomic builtin. It's
Chandler Carruth [Fri, 9 Jul 2010 19:19:40 +0000 (19:19 +0000)]
Rip out the floating point return type handling from the atomic builtin. It's
wrong, and we don't handle floating point value type arguments yet anyways.
Will add correct logic for both when I finish the patch.

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

14 years agoFix PR7600, and correctly convert the result of an atomic builtin to the
Chandler Carruth [Fri, 9 Jul 2010 18:59:35 +0000 (18:59 +0000)]
Fix PR7600, and correctly convert the result of an atomic builtin to the
expected value type. This is necessary as the builtin is internally represented
as only operating on integral types.

Also, add a FIXME to add support for floating point value types.

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

14 years agoInstantiation of block literal expressions. wip.
Fariborz Jahanian [Fri, 9 Jul 2010 18:44:02 +0000 (18:44 +0000)]
Instantiation of block literal expressions. wip.

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

14 years agoDocument my otherwise-inexplicable change
Douglas Gregor [Fri, 9 Jul 2010 18:39:07 +0000 (18:39 +0000)]
Document my otherwise-inexplicable change

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

14 years agoRefer to implicit "conversions" rather than implicit "casts", which
Douglas Gregor [Fri, 9 Jul 2010 18:18:35 +0000 (18:18 +0000)]
Refer to implicit "conversions" rather than implicit "casts", which
don't technically exist in the language. <rdar://problem/8085982>

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

14 years agoCorrectly initialize Reader to null.
Sebastian Redl [Fri, 9 Jul 2010 17:53:32 +0000 (17:53 +0000)]
Correctly initialize Reader to null.

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

14 years agoReally respect -chained-pch.
Sebastian Redl [Fri, 9 Jul 2010 17:40:12 +0000 (17:40 +0000)]
Really respect -chained-pch.

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

14 years agoIntroduce -f{no-}spell-checking options to enable/disable
Douglas Gregor [Fri, 9 Jul 2010 17:35:33 +0000 (17:35 +0000)]
Introduce -f{no-}spell-checking options to enable/disable
spell-checking. By default, spell-checking is enabled for Clang
(obviously) but disabled in CIndex for performance reasons.

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

14 years agoDocument -f{no-}color-diagnostics
Douglas Gregor [Fri, 9 Jul 2010 16:31:58 +0000 (16:31 +0000)]
Document -f{no-}color-diagnostics

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

14 years agoMove traverseunqualifiedtypeloc over to the 'main' typeloc tree.
Craig Silverstein [Fri, 9 Jul 2010 15:19:34 +0000 (15:19 +0000)]
Move traverseunqualifiedtypeloc over to the 'main' typeloc tree.
Note that this is a move -- we pretend that we were really looking
at the unqualified typeloc all along -- rather than a recursion, so
we don't follow the normal CRTP plan of going through
getDerived().TraverseTypeLoc.  If we did, we'd be traversing twice
for the same type (once as a QualifiedTypeLoc version of the type,
once as an UnqualifiedTypeLoc version of the type), which in effect
means we'd call VisitTypeLoc twice with the 'same' type.  This
solves that problem, at the cost of never seeing the qualified
version of the type (unless the client subclasses
TraverseQualifiedTypeLoc themselves).  It's not a perfect solution.
A perfect solution probably requires making QualifiedTypeLoc a
wrapper around TypeLoc -- like QualType is a wrapper around Type*
-- rather than being its own class in the type hierarchy.

Reviewed by wan.

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

14 years agoRevert 107953, remove comma ignoring from PPC constraints.
John Thompson [Fri, 9 Jul 2010 04:53:08 +0000 (04:53 +0000)]
Revert 107953, remove comma ignoring from PPC constraints.

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

14 years agoUpdating PPC target to ignore commas in asm contrains, as apparently that is what...
John Thompson [Fri, 9 Jul 2010 02:01:40 +0000 (02:01 +0000)]
Updating PPC target to ignore commas in asm contrains, as apparently that is what gcc does.

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

14 years agoAdd a frontend option -chained-pch and don't pass an active PCH reader to the PCH...
Sebastian Redl [Fri, 9 Jul 2010 00:00:58 +0000 (00:00 +0000)]
Add a frontend option -chained-pch and don't pass an active PCH reader to the PCH writer if it is not set, preventing creation of chained PCH files. Since the reader is so far unused, effectively no functionality change.

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

14 years agoCleanup in CStringChecker. Now properly bifurcates the state for zero/nonzero sizes.
Jordy Rose [Thu, 8 Jul 2010 23:57:29 +0000 (23:57 +0000)]
Cleanup in CStringChecker. Now properly bifurcates the state for zero/nonzero sizes.

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

14 years agoSupport code completion for parameter names in Objective-C method
Douglas Gregor [Thu, 8 Jul 2010 23:37:41 +0000 (23:37 +0000)]
Support code completion for parameter names in Objective-C method
declarations.

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

14 years agoIntroduce a new code-completion point prior to an identifier in the
Douglas Gregor [Thu, 8 Jul 2010 23:20:03 +0000 (23:20 +0000)]
Introduce a new code-completion point prior to an identifier in the
selector of an Objective-C method declaration, e.g., given

  - (int)first:(int)x second:(int)y;

this code completion point triggers at the location of "second". It
will provide completions that fill out the method declaration for any
known method, anywhere in the translation unit.

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

14 years agoWhen looking for an entity's Scope, don't consider scopes that can't contain declarat...
Sebastian Redl [Thu, 8 Jul 2010 23:07:34 +0000 (23:07 +0000)]
When looking for an entity's Scope, don't consider scopes that can't contain declarations. Fixes PR7594.

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

14 years agoSome preparatory work for chained PCH. No functionality change.
Sebastian Redl [Thu, 8 Jul 2010 22:01:51 +0000 (22:01 +0000)]
Some preparatory work for chained PCH. No functionality change.

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

14 years agoMakes RecursiveASTVisitor traverse the type of a temporary object
Zhanyong Wan [Thu, 8 Jul 2010 21:01:29 +0000 (21:01 +0000)]
Makes RecursiveASTVisitor traverse the type of a temporary object
created via T() where T is a class type.  Reviewed by chandlerc and
csilvers.

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

14 years agoDuring code completion, give the "nil" and "NULL" macros the same
Douglas Gregor [Thu, 8 Jul 2010 20:55:51 +0000 (20:55 +0000)]
During code completion, give the "nil" and "NULL" macros the same
priority as other constants. And, if we're in a place where we prefer
a pointer type, consider "nil" and "NULL" to be close matches.

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

14 years agoAllow C-style casts and reinterpret_casts between block pointers and
Douglas Gregor [Thu, 8 Jul 2010 20:27:32 +0000 (20:27 +0000)]
Allow C-style casts and reinterpret_casts between block pointers and
either integer values or other pointers. Fixes <rdar://problem/8134521>.

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

14 years agoPR7588: Fix the _mm_shufflehi_epi16 macro. (The issue was an oversight
Eli Friedman [Thu, 8 Jul 2010 20:09:45 +0000 (20:09 +0000)]
PR7588: Fix the _mm_shufflehi_epi16 macro.  (The issue was an oversight
involving operator precedence.)

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

14 years agoHandle forward declarations properly in debug info.
Devang Patel [Thu, 8 Jul 2010 19:56:29 +0000 (19:56 +0000)]
Handle forward declarations properly in debug info.
Patch by Alexander Kabaev.
PR 7595.

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

14 years agoAdd missing whitespace.
Ted Kremenek [Thu, 8 Jul 2010 19:43:08 +0000 (19:43 +0000)]
Add missing whitespace.

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

14 years agoWhen performing substitution of template arguments within the body of
Douglas Gregor [Thu, 8 Jul 2010 18:37:38 +0000 (18:37 +0000)]
When performing substitution of template arguments within the body of
a template, be sure to include the template arguments from the
injected-class-name. Fixes PR7587.

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