]> granicus.if.org Git - clang/log
clang
11 years agoFix missing source location in CXXTemporaryObjectExpr nodes.
Enea Zaffanella [Sat, 7 Sep 2013 05:49:53 +0000 (05:49 +0000)]
Fix missing source location in CXXTemporaryObjectExpr nodes.
For clarity, renamed (get/set)ParenRange as (get/set)ParenOrBraceRange
in CXXConstructExpr nodes.
Added testcase.

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

11 years agoObjectiveC migrator: When inferring a property,
Fariborz Jahanian [Fri, 6 Sep 2013 23:45:20 +0000 (23:45 +0000)]
ObjectiveC migrator: When inferring a property,
preserve getter's attribute. Also, do not attach
an inferred NS_RETURNS_INNER_POINTER to the inferred
property (it is illegal).

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

11 years agoReorder libm LIBBUILTIN definition groups
Hal Finkel [Fri, 6 Sep 2013 23:45:10 +0000 (23:45 +0000)]
Reorder libm LIBBUILTIN definition groups

The groups of libm LIBBUILTIN definitions are reordered to match the order of
the corresponding __builtin_* definitions (which occur earlier in the
Builtins.def file).

No functionality change intended.

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

11 years agoReorder libm LIBBUILTIN definitions
Hal Finkel [Fri, 6 Sep 2013 23:23:53 +0000 (23:23 +0000)]
Reorder libm LIBBUILTIN definitions

The libm LIBBUILTIN definitions are reordered to the canonical (and
alphabetical) double (''), float ('f'), long double ('l') ordering.

No functionality change intended.

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

11 years agoAdd the missing "n" to libm LIBBUILTIN definitions
Hal Finkel [Fri, 6 Sep 2013 23:23:32 +0000 (23:23 +0000)]
Add the missing "n" to libm LIBBUILTIN definitions

The libm math functions should be marked with the "n" (nothrow) flag so that
the corresponding IR function declarations are tagged with the nounwind
attribute (this has been true in C mode, but not in C++ mode).

The test case has been updated to run in C++ mode in addition to in C mode.

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

11 years agoRemove error-prone 'list initialization' flag from an implicit conversion
Richard Smith [Fri, 6 Sep 2013 22:30:28 +0000 (22:30 +0000)]
Remove error-prone 'list initialization' flag from an implicit conversion
sequence. All that matters here is whether we're doing the
std::initializer_list special case thing.

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

11 years agoclang-format: Fix regression introduced by r190038.
Daniel Jasper [Fri, 6 Sep 2013 21:46:41 +0000 (21:46 +0000)]
clang-format: Fix regression introduced by r190038.

Before:
  Constructor()
      : aaaaaaaaaaaaaaaaaaaa(a), bbbbbbbbbbbbbbbbbbbbbbbb(b) {
                                 }
After:
  Constructor()
      : aaaaaaaaaaaaaaaaaaaa(a), bbbbbbbbbbbbbbbbbbbbbbbb(b) {
  }

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

11 years agoclang-format: Format typed enums with nested names.
Daniel Jasper [Fri, 6 Sep 2013 21:32:35 +0000 (21:32 +0000)]
clang-format: Format typed enums with nested names.

The explicit type specified for an enum can actually have a nested name
specifier.

This fixes llvm.org/PR17125.

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

11 years agoclang-format: Don't confuse operator[] with lambdas.
Daniel Jasper [Fri, 6 Sep 2013 21:25:51 +0000 (21:25 +0000)]
clang-format: Don't confuse operator[] with lambdas.

Before:
  double &operator[](int i) { return 0; } int i;

After:
  double &operator[](int i) { return 0; }
  int i;

This fixes llvm.org/PR17134.

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

11 years agoPreserve exception specs in function decl merging.
Eli Friedman [Fri, 6 Sep 2013 21:09:09 +0000 (21:09 +0000)]
Preserve exception specs in function decl merging.

Exception specs are not part of the canonical type, but we shouldn't
drop them just because we merged a noreturn attribute.

Fixes PR17110.

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

11 years agoUnbreak the Clang -Werror build after r190183.
David Blaikie [Fri, 6 Sep 2013 20:58:25 +0000 (20:58 +0000)]
Unbreak the Clang -Werror build after r190183.

Best guess at the right answer here - no guarantees of fitness for any
particular purpose.

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

11 years agoclang-cl: ignore /RTC options (PR17129)
Hans Wennborg [Fri, 6 Sep 2013 20:26:25 +0000 (20:26 +0000)]
clang-cl: ignore /RTC options (PR17129)

I don't think Clang intends to implement this functionality.
ASan should be used instead. Since /RTC is often passed by default
from MSBuild, ignore the option to avoid bloating the output.

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

11 years agoAdd Intrin.h to the cmake files.
Eric Christopher [Fri, 6 Sep 2013 20:11:28 +0000 (20:11 +0000)]
Add Intrin.h to the cmake files.

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

11 years agoDebug Info: Update testing case.
Manman Ren [Fri, 6 Sep 2013 18:46:30 +0000 (18:46 +0000)]
Debug Info: Update testing case.

DIBuilder now uses an identifier to reference DIType in containing type field of
a DICompositeType (in r190190).

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

11 years agoOpenMP: Data-sharing attributes analysis and clause 'shared' (fixed test threadprivat...
Alexey Bataev [Fri, 6 Sep 2013 18:03:48 +0000 (18:03 +0000)]
OpenMP: Data-sharing attributes analysis and clause 'shared' (fixed test threadprivate_messages.cpp)

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

11 years agoDon't remove trailing escaped newline from line comments.
Alexander Kornienko [Fri, 6 Sep 2013 17:24:54 +0000 (17:24 +0000)]
Don't remove trailing escaped newline from line comments.

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

11 years agoRemove unused method Job::AddCommand.
Hans Wennborg [Fri, 6 Sep 2013 16:48:57 +0000 (16:48 +0000)]
Remove unused method Job::AddCommand.

I was going to update the comment referring to PipedJob, which was removed
some time ago, but then it turned out that this method is not actually used
at all.

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

11 years ago[analyzer] SATestBuild: strip trailing newlines from command file.
Jordan Rose [Fri, 6 Sep 2013 16:12:41 +0000 (16:12 +0000)]
[analyzer] SATestBuild: strip trailing newlines from command file.

When running a make-based command, SATestBuild tries to append a -jN flag
with an appropriate N to run the build in parallel. However, it failed
to take into account that each line read includes a trailing newline
(unless it is the last line of a file without a trailing newline), which
resulted in the "-jN" appearing on a line on its own.

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

11 years agoFollow up on commit r190159. Also test the KFreeBSD i686 platform defines + minor...
Sylvestre Ledru [Fri, 6 Sep 2013 15:36:36 +0000 (15:36 +0000)]
Follow up on commit r190159. Also test the KFreeBSD i686 platform defines + minor cosmetics

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

11 years agoAdd a test for the KFreeBSD define (#define __FreeBSD_kernel__ 1). This was introduce...
Sylvestre Ledru [Fri, 6 Sep 2013 14:53:07 +0000 (14:53 +0000)]
Add a test for the KFreeBSD define (#define __FreeBSD_kernel__ 1). This was introduced in commit r190048

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

11 years agoOpenCL allows the (pre/post)-(increment/decrement) operator on integer vector types,
David Tweed [Fri, 6 Sep 2013 09:58:08 +0000 (09:58 +0000)]
OpenCL allows the (pre/post)-(increment/decrement) operator on integer vector types,
so allow that case and add appropriate tests.

Patch by Ruiling Song!

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

11 years agoclang-format: Fix regression introduced by r189353.
Daniel Jasper [Fri, 6 Sep 2013 08:54:24 +0000 (08:54 +0000)]
clang-format: Fix regression introduced by r189353.

Before:
  FirstToken->WhitespaceRange.getBegin()
      .getLocWithOffset(First->LastNewlineOffset);

After:
  FirstToken->WhitespaceRange.getBegin().getLocWithOffset(
      First->LastNewlineOffset);

Re-add logic to prevent breaking after an empty set of parentheses.
Basically it seems that calling a function without parameters is more
like navigating along the same object than it is a separate step of a
builder-type call.

We might need to extends this in future to allow "short" parameters that
e.g. are an index accessing a specific element.

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

11 years agoAvoid double edges when constructing CFGs
Pavel Labath [Fri, 6 Sep 2013 08:12:48 +0000 (08:12 +0000)]
Avoid double edges when constructing CFGs

Summary:
If a noreturn destructor is executed while returning a value from a function,
the resulting CFG has had two edges to the exit block. This crashed the analyzer,
because it expects that blocks with no terminators have only one outgoing edge.
I added code to avoid creating the second edge in this case.

PS: The crashes did not manifest themselves always, as usually the
NoReturnFunctionChecker would stop program evaluation before the analyzer hit
the assertion, but in the case of lifetime extended temporaries, the checker
failed to do that (which is a separate bug in itself).

Reviewers: jordan_rose

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1513

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

11 years agoclang-format: Fix regression introduced by r189337.
Daniel Jasper [Fri, 6 Sep 2013 08:08:14 +0000 (08:08 +0000)]
clang-format: Fix regression introduced by r189337.

Before:
  if (aaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaa(
          aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) == 5) ...

After:
  if (aaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaa(
          aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
      == 5) ...

Also precompute startsBinaryExpression() to improve performance.

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

11 years agoclang-format: Fix comment formatting bugs in nested blocks.
Daniel Jasper [Fri, 6 Sep 2013 07:54:20 +0000 (07:54 +0000)]
clang-format: Fix comment formatting bugs in nested blocks.

This fixes two issues:
1) The indent of a line comment was not adapted to the subsequent
   statement as it would be outside of a nested block.
2) A missing DryRun flag caused actualy breaks to be inserted in
   overly long comments while trying to come up with the best line
   breaking decisions.

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

11 years agoPR17046, PR17092: Debug Info assert-on-valid due to member loss when context creation...
David Blaikie [Fri, 6 Sep 2013 06:45:04 +0000 (06:45 +0000)]
PR17046, PR17092: Debug Info assert-on-valid due to member loss when context creation recreates the item the context is created for

By removing the possibility of strange partial definitions with no
members that older GCC's produced for the otherwise unreferenced outer
types of referenced inner types, we can simplify debug info generation
and correct this bug. Newer (4.8.1 and ToT) GCC's don't produce this
quirky debug info, and instead produce the full definition for the outer
type (except in the case where that type is dynamic and its vtable is
not emitted in this TU).

During the creation of the context for a type, we may revisit that type
(due to the need to visit template parameters, among other things) and
used to end up visiting it first there. Then when we would reach the
original code attempting to define that type, we would lose debug info
by overwriting its members.

By avoiding the possibility of latent "defined with no members" types,
we can be sure than whenever we already have a type in a cache (either a
definition or declaration), we can just return that. In the case of a
full definition, our work is done. In the case of a partial definition,
we must already be in the process of completing it. And in the case of a
declaration, the completed/vtable/etc callbacks can handle converting it
to a definition.

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

11 years agoAdd self-comparison warnings for fields.
Eli Friedman [Fri, 6 Sep 2013 03:13:09 +0000 (03:13 +0000)]
Add self-comparison warnings for fields.

This expands very slightly what -Wtautological-compare considers to be
tautological to include implicit accesses to C++ fields and ObjC ivars.
I don't want to turn this into a full expression-identity check, but
these additions seem pretty well-contained, and maintain the theme
of checking for "x == x".

<rdar://problem/14431127>

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

11 years agoConsumed Analysis: The 'consumable' attribute now takes a identifier specifying the...
David Blaikie [Fri, 6 Sep 2013 01:28:43 +0000 (01:28 +0000)]
Consumed Analysis: The 'consumable' attribute now takes a identifier specifying the default assumed state for objects of this class

This information is used for return states and pass-by-value parameter
states.

Patch by Chris Wailes.

Review by DeLesley Hutchins and Aaron Ballman.

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

11 years agoWhen creating an implicit conversion sequence for a reference of type T from an
Richard Smith [Fri, 6 Sep 2013 01:22:42 +0000 (01:22 +0000)]
When creating an implicit conversion sequence for a reference of type T from an
initializer list containing a single element of type T, be sure to mark the
sequence as a list conversion sequence so that it is known to be worse than an
implicit conversion sequence that initializes a std::initializer_list object.

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

11 years agoReduce stack usage of TreeTransform.
Eli Friedman [Fri, 6 Sep 2013 01:13:30 +0000 (01:13 +0000)]
Reduce stack usage of TreeTransform.

Without this patch, TreeTransform::TransformExpr uses a ridiculous amount of
stack space (around 5000 bytes).  Preventing inlining brings the stack usage
down to something sane.

On a testcase I have, on my computer, this allows changing -ftemplate-depth
from 210 to around 750 before we crash.  I'm not sure I should commit the
testcase, though: I don't want to cause test failures on platforms with less
stack space available.

<rdar://problem/14098189>.

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

11 years agoC++11 attributes after 'constructor-name (' unambiguously signal that we have a
Richard Smith [Fri, 6 Sep 2013 00:12:20 +0000 (00:12 +0000)]
C++11 attributes after 'constructor-name (' unambiguously signal that we have a
constructor.

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

11 years agoImprove error for "override" + non-virtual func.
Eli Friedman [Thu, 5 Sep 2013 23:51:03 +0000 (23:51 +0000)]
Improve error for "override" + non-virtual func.

Consider something like the following:

struct X {
  virtual void foo(float x);
};
struct Y : X {
  void foo(double x) override;
};

The error is almost certainly that Y::foo() has the wrong signature,
rather than incorrect usage of the override keyword.  This patch
adds an appropriate diagnostic for that case.

Fixes <rdar://problem/14785106>.

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

11 years agoAdd a bit more info to modules fatal error.
Eli Friedman [Thu, 5 Sep 2013 23:50:58 +0000 (23:50 +0000)]
Add a bit more info to modules fatal error.

Just a minor tweak to make it easier to track down the cause of fatal errors
with modules.

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

11 years agoObjectiveC migrator: tighten the rules for when
Fariborz Jahanian [Thu, 5 Sep 2013 23:04:33 +0000 (23:04 +0000)]
ObjectiveC migrator: tighten the rules for when
inferring NS_RETURNS_RETAINED, etc., return annotations.
Do not infer if these annotations are implicit
from the naming convention. Also add inference for
NS_CONSUMES_SELF annotation.

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

11 years agomanual: Fix RST reference to MS extension support
Reid Kleckner [Thu, 5 Sep 2013 21:29:35 +0000 (21:29 +0000)]
manual: Fix RST reference to MS extension support

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

11 years agoFix regression from r190016.
Eli Friedman [Thu, 5 Sep 2013 20:13:32 +0000 (20:13 +0000)]
Fix regression from r190016.

I don't have a reduced testcase yet.

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

11 years agoDebug Info: Update testing case.
Manman Ren [Thu, 5 Sep 2013 18:51:02 +0000 (18:51 +0000)]
Debug Info: Update testing case.

DIBuilder now uses an identifier to reference DIType in base type field of
ptr_to_member (in r190081).

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

11 years agoUnbreak build with libc++, whose std::list<T> requires T to be complete.
Douglas Gregor [Thu, 5 Sep 2013 18:28:53 +0000 (18:28 +0000)]
Unbreak build with libc++, whose std::list<T> requires T to be complete.

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

11 years agoMark lambda closure classes as being implicitly-generated.
James Dennett [Thu, 5 Sep 2013 17:46:21 +0000 (17:46 +0000)]
Mark lambda closure classes as being implicitly-generated.

Summary: Closure classes for C++ lambdas are always compiler-generated.  This one-line change calls setImplicit(true) on them at creation time, such that a default RecursiveASTVisitor (or any for which shouldVisitImplicitCode returns false) will skip them.

Reviewers: rsmith, dblaikie

Reviewed By: dblaikie

CC: klimek, revane, cfe-commits, jordan_rose
Differential Revision: http://llvm-reviews.chandlerc.com/D1593

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

11 years agoObjectiveC modern translator: fix up generated fast enumeration
Fariborz Jahanian [Thu, 5 Sep 2013 17:17:32 +0000 (17:17 +0000)]
ObjectiveC modern translator: fix up generated fast enumeration
code to work for bit 32bit and 64bit APIs.
// rdar://14913632

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

11 years agoclang-cl: Use .obj as extension for unnamed object files (PR17095)
Hans Wennborg [Thu, 5 Sep 2013 17:05:56 +0000 (17:05 +0000)]
clang-cl: Use .obj as extension for unnamed object files (PR17095)

We already use .obj as extension when the user provides a stem file
name (via /Fo), but were failing in the most basic case when the file
name is based on the input file.

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

11 years agoAdd ATTRIBUTE_UNUSED to silence unused-function warning in release
Daniel Jasper [Thu, 5 Sep 2013 16:05:56 +0000 (16:05 +0000)]
Add ATTRIBUTE_UNUSED to silence unused-function warning in release
builds.

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

11 years agoFixes PR 17106 (explicitly typed enums are formatted differently).
Manuel Klimek [Thu, 5 Sep 2013 15:34:55 +0000 (15:34 +0000)]
Fixes PR 17106 (explicitly typed enums are formatted differently).

Before:
 enum X : int { A, B, C };

After:
 enum X : int {
   A,
   B,
   C
 };

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

11 years agoHandle zero-width and double-width characters in string literals and comments.
Alexander Kornienko [Thu, 5 Sep 2013 14:08:34 +0000 (14:08 +0000)]
Handle zero-width and double-width characters in string literals and comments.

Summary:
Count column width instead of the number of code points. This also
includes correct handling of tabs inside string literals and comments (with an
exception of multiline string literals/comments, where tabs are present before
the first escaped newline).

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D1601

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

11 years agoFix the profile of the function (fix commit 190048)
Sylvestre Ledru [Thu, 5 Sep 2013 13:58:07 +0000 (13:58 +0000)]
Fix the profile of the function (fix commit 190048)

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

11 years agoFix bug #17104 - Target info for GNU/kFreeBSD were missing.
Sylvestre Ledru [Thu, 5 Sep 2013 13:47:07 +0000 (13:47 +0000)]
Fix bug #17104 - Target info for GNU/kFreeBSD were missing.
As a result, Clang doesn't define the pre-processor macros that are expected
on this platform.

Thanks to Robert Millan for the patch

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

11 years agoclang-format: Quickfix for braced init lists detected as lambdas.
Daniel Jasper [Thu, 5 Sep 2013 11:49:39 +0000 (11:49 +0000)]
clang-format: Quickfix for braced init lists detected as lambdas.

Before:
  constexpr char hello [] { "hello" };

After:
  constexpr char hello[]{ "hello" };

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

11 years agoAdd new methods for TargetInfo:
Stepan Dyatkovskiy [Thu, 5 Sep 2013 11:23:21 +0000 (11:23 +0000)]
Add new methods for TargetInfo:
     getRealTypeByWidth and getIntTypeByWidth
  for ASTContext names are almost same(invokes new methods from TargetInfo):
     getIntTypeForBitwidth and getRealTypeForBitwidth.

As first commit for PR16752 fix: 'mode' attribute for unusual targets doesn't work properly
Description:
Troubles could be happened due to some assumptions in handleModeAttr function (see SemaDeclAttr.cpp).
For example, it assumes that 32 bit integer is 'int', while it could be 16 bit only.
Instead of asking target: 'which type do you want to use for int32_t ?' it just hardcodes general opinion. That doesn't looks pretty correct.
Please consider the next solution:
1. In Basic/TargetInfo add getIntTypeByWidth and getRealTypeByWidth virtual methods. By default current behaviour could be implemented here.
2. Fix handleModeAttr according to new methods in TargetInfo.
This approach is implemented in the patch attached to this post.

Fixes:
1st Commit (Current): Add new methods for TargetInfo:
     getRealTypeByWidth and getIntTypeByWidth
  for ASTContext names are almost same(invokes new methods from TargetInfo):
     getIntTypeForBitwidth and getRealTypeForBitwidth

2nd Commit (Next): Fix SemaDeclAttr, handleModeAttr function.

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

11 years agoAddress post-commit review comments from r190038.
Daniel Jasper [Thu, 5 Sep 2013 10:48:50 +0000 (10:48 +0000)]
Address post-commit review comments from r190038.

Mostly additional comments :-).

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

11 years agoSupport suppressing unused arguments warnings as a core option so that
Chandler Carruth [Thu, 5 Sep 2013 10:09:03 +0000 (10:09 +0000)]
Support suppressing unused arguments warnings as a core option so that
it works in the CL flavor driver.

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

11 years agoclang-format: Fix parsing and indenting lambdas.
Daniel Jasper [Thu, 5 Sep 2013 10:04:31 +0000 (10:04 +0000)]
clang-format: Fix parsing and indenting lambdas.

Before:
  void f() {
    other(x.begin(), x.end(), //
                         [&](int, int) { return 1; });
  }

After:
  void f() {
    other(x.begin(), x.end(), //
          [&](int, int) { return 1; });
  }

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

11 years agoclang-format: Enable formatting of nested blocks.
Daniel Jasper [Thu, 5 Sep 2013 09:29:45 +0000 (09:29 +0000)]
clang-format: Enable formatting of nested blocks.

Among other things, this enables (better) formatting lambdas and
constructs like:
  MACRO({
          long_statement();
          long_statement_2();
        },
        {
          long_statement();
          long_statement_2();
        },
        { short_statement(); }, "");

This fixes llvm.org/PR15381.

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

11 years ago[analyzer] Restructure a test file
Pavel Labath [Thu, 5 Sep 2013 09:18:36 +0000 (09:18 +0000)]
[analyzer] Restructure a test file

Summary:
I've had a test failure here while experimenting and I've found that it's
impossible to find what is wrong with the previous structure of the file. So I
have grouped the expected output with the function that produces it, to make
searching for discrepancies more obvious.

Reviewers: jordan_rose

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1595

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

11 years agoMake error text if clang-format is not on the system PATH more helpful,
Manuel Klimek [Thu, 5 Sep 2013 08:31:48 +0000 (08:31 +0000)]
Make error text if clang-format is not on the system PATH more helpful,
as this is going to be a common mistake (installing LLVM defaults to not putting
the tools onto the PATH).

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

11 years agoFor "expected unqualified-id" errors after a double colon, and the double colon
Richard Trieu [Thu, 5 Sep 2013 02:31:33 +0000 (02:31 +0000)]
For "expected unqualified-id" errors after a double colon, and the double colon
is at the end of the line, point to the location after the double colon instead
of at the next token.  There is more context to be given this way.  In addition,
the next token can be several lines later.

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

11 years agoAdd specific warning flags for GNU ext in lexer.
Eli Friedman [Thu, 5 Sep 2013 00:02:30 +0000 (00:02 +0000)]
Add specific warning flags for GNU ext in lexer.

This patch adds the following flags covering existing warnings:

-Wgnu-zero-variadic-macro-arguments
-Wgnu-imaginary-constant
-Wgnu-binary-literal
-Wgnu-zero-line-directive

Patch by Peter Lewis.

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

11 years agoNote when a decl is used in AST files.
Eli Friedman [Thu, 5 Sep 2013 00:02:25 +0000 (00:02 +0000)]
Note when a decl is used in AST files.

When an AST file is built based on another AST file, it can use a decl from
the fist file, and therefore mark the "isUsed" bit.  We need to note this in
the AST file so that the bit is set correctly when the second AST file is
loaded.

This patch introduces the distinction between setIsUsed() and markUsed() so
that we don't call into the ASTMutationListener callback when it wouldn't
be appropriate.

Fixes PR16635.

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

11 years agoPR17103: Scoped enumerations with signed integer types have signed integer
Richard Smith [Wed, 4 Sep 2013 23:34:21 +0000 (23:34 +0000)]
PR17103: Scoped enumerations with signed integer types have signed integer
representation. Don't emit comparisons on them as 'icmp ult'!

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

11 years agoTweak implementation of -Wwrite-strings to better match the behavior of current GCCs:
Richard Smith [Wed, 4 Sep 2013 22:50:31 +0000 (22:50 +0000)]
Tweak implementation of -Wwrite-strings to better match the behavior of current GCCs:

 * In C, as before, if the "warning flag" is enabled, warnings are produced by
   forcing string literals to have const-qualified types (the produced warnings
   are *not* -Wwrite-strings warnings). However, more recent GCCs (at least 4.4
   onwards) now take -w into account here, so we now do the same.

 * In C++, this flag is entirely sane: it behaves just like any other warning
   flag. Stop triggering -fconst-strings here. This is a bit cleaner, but there's
   no real functionality change except in the case where -Xclang -fno-const-strings
   is also specified.

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

11 years agoObjectiveC migrator: start introducing NS_XXX annotations
Fariborz Jahanian [Wed, 4 Sep 2013 22:49:19 +0000 (22:49 +0000)]
ObjectiveC migrator: start introducing NS_XXX annotations
to Method/functions returning ObjC objects. wip.

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

11 years agoReapply r189013 (reverted in r189906) now that the underlying issue is fixed and...
David Blaikie [Wed, 4 Sep 2013 22:03:57 +0000 (22:03 +0000)]
Reapply r189013 (reverted in r189906) now that the underlying issue is fixed and tested (in r189996)

Debug info emission was tripping over an IRGen bug (fixed in r189996)
that was resulting in duplicate emission of static data members of class
templates in namespaces.

We could add more test coverage to debug info for this issue
specifically, but I think the underlying IRGen test is more targeted and
sufficient for the issue.

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

11 years agoDo not emit duplicate global initializers for template static data members inside...
David Blaikie [Wed, 4 Sep 2013 21:07:37 +0000 (21:07 +0000)]
Do not emit duplicate global initializers for template static data members inside namespaces

A quirk of AST representation leads to class template static data member
definitions being visited twice during Clang IRGen resulting in
duplicate (benign) initializers.

Discovered while investigating a possibly-related debug info bug tickled
by the duplicate emission of these members & their associated debug
info.

With thanks to Richard Smith for help investigating, understanding, and
helping with the fix.

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

11 years agoRemove the -fuse-gold-plugin driver option.
Rafael Espindola [Wed, 4 Sep 2013 19:37:35 +0000 (19:37 +0000)]
Remove the -fuse-gold-plugin driver option.

* It was redundant with -flto.
* It was confusing since -uAnythingElse is a different option.
* GCC uses -fuse-linker-plugin, so it was not even a compatibility option.

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

11 years agoObjectiveC migrator. Refactor last patch on
Fariborz Jahanian [Wed, 4 Sep 2013 16:43:57 +0000 (16:43 +0000)]
ObjectiveC migrator. Refactor last patch on
annotations. (was r189892).

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

11 years agoAdds a VSPackage project that builds a VS extension to run clang-format over a select...
Manuel Klimek [Wed, 4 Sep 2013 16:11:46 +0000 (16:11 +0000)]
Adds a VSPackage project that builds a VS extension to run clang-format over a selection / the line at the cursor.

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

11 years agoMore unused warning silencing.
Eric Christopher [Wed, 4 Sep 2013 15:58:55 +0000 (15:58 +0000)]
More unused warning silencing.

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

11 years agoA minor fix in the documentation.
Alexander Kornienko [Wed, 4 Sep 2013 15:14:18 +0000 (15:14 +0000)]
A minor fix in the documentation.

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

11 years agoAdded documentation for clang-format style options.
Alexander Kornienko [Wed, 4 Sep 2013 15:09:13 +0000 (15:09 +0000)]
Added documentation for clang-format style options.

Summary:
The main contents is in the ClangFormatStyleOptions.rst, which can be
updated from the Format.h by the dump_format_style.py script.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1597

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

11 years agoASTDumper: fix dump of CXXCatchStmt
Pavel Labath [Wed, 4 Sep 2013 14:35:00 +0000 (14:35 +0000)]
ASTDumper: fix dump of CXXCatchStmt

Summary: I added the display of the VarDecl contained in the statement.

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1596

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

11 years agoCleaned doxygen comments.
Alexander Kornienko [Wed, 4 Sep 2013 14:09:59 +0000 (14:09 +0000)]
Cleaned doxygen comments.

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

11 years agoHandle 'Cpp03' and 'Cpp11' strings in LanguageStandard serialization for
Alexander Kornienko [Wed, 4 Sep 2013 14:09:13 +0000 (14:09 +0000)]
Handle 'Cpp03' and 'Cpp11' strings in LanguageStandard serialization for
consistency of serialized form with the actual enum member names without
a prefix.

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

11 years agoRemove code duplication in unwrapped line parser.
Manuel Klimek [Wed, 4 Sep 2013 13:34:14 +0000 (13:34 +0000)]
Remove code duplication in unwrapped line parser.

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

11 years agoImplement parsing of blocks (^{ ... }) in the unwrapped line parser.
Manuel Klimek [Wed, 4 Sep 2013 13:25:30 +0000 (13:25 +0000)]
Implement parsing of blocks (^{ ... }) in the unwrapped line parser.

This patch makes sure we produce the right number of unwrapped lines,
a follow-up patch will make the whitespace formatting consistent.

Before:
 void f() {
   int i = {[operation setCompletionBlock : ^{ [self onOperationDone];
 }]
 }
 ;
 }

After:
 void f() {
   int i = {[operation setCompletionBlock : ^{
     [self onOperationDone];
   }] };
 }

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

11 years agoMore lambda formatting tests; update test comments.
Manuel Klimek [Wed, 4 Sep 2013 10:06:46 +0000 (10:06 +0000)]
More lambda formatting tests; update test comments.

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

11 years agoclang/test/Driver/working-directory.c: Exclude msys bash rather than tweaking express...
NAKAMURA Takumi [Wed, 4 Sep 2013 09:37:12 +0000 (09:37 +0000)]
clang/test/Driver/working-directory.c: Exclude msys bash rather than tweaking expressions.

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

11 years agoInplement aarch64 neon instructions in AdvSIMD(shift). About 24 shift instructions:
Hao Liu [Wed, 4 Sep 2013 09:29:13 +0000 (09:29 +0000)]
Inplement aarch64 neon instructions in AdvSIMD(shift). About 24 shift instructions:
      sshr,ushr,ssra,usra,srshr,urshr,srsra,ursra,sri,shl,sli,sqshlu,sqshl,uqshl,shrn,sqrshr$
 and 4 convert instructions:
      scvtf,ucvtf,fcvtzs,fcvtzu

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

11 years agoFix layout of lambda captures.
Manuel Klimek [Wed, 4 Sep 2013 08:20:47 +0000 (08:20 +0000)]
Fix layout of lambda captures.

Before:
 int c = [ &, &a, a]{
   [ =, c, &d]{
     return b++;
   }();
 }();

After:
 int c = [&, &a, a] {
   [=, c, &d] {
     return b++;
   }();
 }();

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

11 years agoAttempt to silence some defined but not used warnings.
Eric Christopher [Wed, 4 Sep 2013 06:06:06 +0000 (06:06 +0000)]
Attempt to silence some defined but not used warnings.

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

11 years agoDisable llvm optimizations, but keep -O1 to test available_externally.
Rafael Espindola [Wed, 4 Sep 2013 04:59:11 +0000 (04:59 +0000)]
Disable llvm optimizations, but keep -O1 to test available_externally.

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

11 years agoDisable llvm optimizations, but keep -O1 to test available_externally.
Rafael Espindola [Wed, 4 Sep 2013 04:55:03 +0000 (04:55 +0000)]
Disable llvm optimizations, but keep -O1 to test available_externally.

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

11 years agoUse %clang_cc1.
Rafael Espindola [Wed, 4 Sep 2013 04:51:39 +0000 (04:51 +0000)]
Use %clang_cc1.

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

11 years agoClear LookupResult object if invalid candidate is found.
Serge Pavlov [Wed, 4 Sep 2013 04:50:29 +0000 (04:50 +0000)]
Clear LookupResult object if invalid candidate is found.
If source code is invalid, error recovery can lead to name lookup in a set containing invalid declaration. The lookup is stopped once found such declaration, but LookupResult object could remain in inconsistent state. Its destructor triggered a check, which caused assert violation.
This patch fixes PR16964 and PR12791.

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

11 years agoDon't pass -O0 to clang_cc1, it is the default.
Rafael Espindola [Wed, 4 Sep 2013 04:12:25 +0000 (04:12 +0000)]
Don't pass -O0 to clang_cc1, it is the default.

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

11 years agoclang-cl: Use "clang cl.exe" when disambiguating the diagnostic prefix.
Reid Kleckner [Wed, 4 Sep 2013 03:10:36 +0000 (03:10 +0000)]
clang-cl: Use "clang cl.exe" when disambiguating the diagnostic prefix.

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

11 years agoDocumentation fix: remove advice to use cast/dyn_cast on TypeLocs, updating
James Dennett [Wed, 4 Sep 2013 02:47:23 +0000 (02:47 +0000)]
Documentation fix: remove advice to use cast/dyn_cast on TypeLocs, updating
it to refer to castAs/getAs.

The original change to remove the (broken) cast/dyn_cast support from TypeLoc
was in r175462.  (Thanks to David Blaikie for the reference.)

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

11 years agoRevert "DebugInfo: Remove explicit declaration-emissiong handling now that we have...
David Blaikie [Wed, 4 Sep 2013 02:12:12 +0000 (02:12 +0000)]
Revert "DebugInfo: Remove explicit declaration-emissiong handling now that we have a more principled approach (the 'requires complete type' callback)"

This reverts commit r189013.

This is causing a segfault crash in a test case I have. Reverting while
I investigate the issue.

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

11 years agoclang-cl: Avoid confusing diagnostics when clang-cl is called just cl.exe
Reid Kleckner [Wed, 4 Sep 2013 01:37:22 +0000 (01:37 +0000)]
clang-cl: Avoid confusing diagnostics when clang-cl is called just cl.exe

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

11 years agoOrder initializers of static data members of explicit specializations
Reid Kleckner [Wed, 4 Sep 2013 00:54:24 +0000 (00:54 +0000)]
Order initializers of static data members of explicit specializations

I tried to implement this properly in r189051, but I didn't have enough
test coverage.  Richard kindly provided more test cases than I could
possibly imagine and now we should have the correct condition.

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

11 years agoAdd a diagnostic group for the "ignoring (static|inline) keyword on
Peter Collingbourne [Wed, 4 Sep 2013 00:10:25 +0000 (00:10 +0000)]
Add a diagnostic group for the "ignoring (static|inline) keyword on
explicit template instantiation" warning.

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

11 years agoObjectiveC migrator: Cannot use bridging annotations for
Fariborz Jahanian [Wed, 4 Sep 2013 00:10:06 +0000 (00:10 +0000)]
ObjectiveC migrator: Cannot use bridging annotations for
ObjectiveC methods. Apply specific annotations for them
instead as determined by the static analyzer.

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

11 years agoFix the test on -Asserts build.
Rafael Espindola [Tue, 3 Sep 2013 23:52:53 +0000 (23:52 +0000)]
Fix the test on -Asserts build.

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

11 years agoUse -O0 in this test too.
Rafael Espindola [Tue, 3 Sep 2013 23:31:28 +0000 (23:31 +0000)]
Use -O0 in this test too.

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

11 years agoclang-cl: Make -W a core option so we can adjust clang warnings.
Reid Kleckner [Tue, 3 Sep 2013 23:18:43 +0000 (23:18 +0000)]
clang-cl: Make -W a core option so we can adjust clang warnings.

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

11 years agoDon't run optimizations in a clang test.
Rafael Espindola [Tue, 3 Sep 2013 23:14:03 +0000 (23:14 +0000)]
Don't run optimizations in a clang test.

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

11 years agoParser: support Microsoft syntax for 'typename typedef'
David Majnemer [Tue, 3 Sep 2013 22:36:22 +0000 (22:36 +0000)]
Parser: support Microsoft syntax for 'typename typedef'

Summary:
Transform the token sequence for:
typename typedef T U;

to:
typename T typedef U;

Raise a diagnostic when this happens but only if we succeeded handling
the typename.

Reviewers: rsmith, rnk

Reviewed By: rsmith

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1433

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

11 years agoConsumed analysis: update to comments in test cases.
DeLesley Hutchins [Tue, 3 Sep 2013 22:35:53 +0000 (22:35 +0000)]
Consumed analysis: update to comments in test cases.
Patch by chris.wailes@gmail.com.

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

11 years agoEmit uuid globals as linkonce_odr
Reid Kleckner [Tue, 3 Sep 2013 21:49:32 +0000 (21:49 +0000)]
Emit uuid globals as linkonce_odr

Patch by Nico Rieck!

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

11 years agoReference extension is weird/surprising and unnecessary, let's not do that.
David Blaikie [Tue, 3 Sep 2013 21:40:15 +0000 (21:40 +0000)]
Reference extension is weird/surprising and unnecessary, let's not do that.

Found by Chris Wailes

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

11 years agoSimplify. This function bails out a few lines above if !Found.empty().
Richard Smith [Tue, 3 Sep 2013 21:22:41 +0000 (21:22 +0000)]
Simplify. This function bails out a few lines above if !Found.empty().

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

11 years agoDon't emit an available_externally vtable pointing to linkonce_odr funcs.
Rafael Espindola [Tue, 3 Sep 2013 21:05:13 +0000 (21:05 +0000)]
Don't emit an available_externally vtable pointing to linkonce_odr funcs.

This fixes pr13124.

From the discussion at
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-June/022606.html
we know that we cannot make funcions in a weak_odr vtable also weak_odr. They
should remain linkonce_odr.

The side effect is that we cannot emit a available_externally vtable unless we
also emit a copy of the function. This also has an issue: If codegen is going
to output a function, sema has to mark it used. Given llvm.org/pr9114, it looks
like sema cannot be more aggressive at marking functions used because
of vtables.

This leaves us with a few unpleasant options:

* Marking functions in vtables used if possible. This sounds a bit sloppy, so
  we should avoid it.
* Producing available_externally vtables only when all the functions in it are
  already used or weak_odr. This would cover cases like

--------------------
struct foo {
  virtual ~foo();
};
struct bar : public foo {
  virtual void zed();
};
void f() {
  foo *x(new bar);
  delete x;
}
void g(bar *x) {
  x->~bar(); // force the destructor to be used
}
--------------------------

and

----------------------------------
template<typename T>
struct bar {
  virtual ~bar();
};
template<typename T>
bar<T>::~bar() {
}

// make the destructor weak_odr instead of linkonce_odr
extern template class bar<int>;

void f() {
  bar<int> *x(new bar<int>);
  delete x;
}
----------------------------

These look like corner cases, so it is unclear if it is worth it.

* And finally: Just nuke this optimization. That is what this patch implements.

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