]> granicus.if.org Git - clang/log
clang
11 years agoWhen typo correction produces an overloaded result when looking up a member,
Nick Lewycky [Tue, 7 May 2013 22:14:37 +0000 (22:14 +0000)]
When typo correction produces an overloaded result when looking up a member,
return all the overloads instead of just picking the first possible declaration.
This removes an invalid note (and on occasion other invalid diagnostics) and
also makes clang's parsing recovery behave as if the text from its fixit were
applied.

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

11 years agoDon't crash in IRGen if a conditional with 'throw' in one of its branches is
Richard Smith [Tue, 7 May 2013 21:53:22 +0000 (21:53 +0000)]
Don't crash in IRGen if a conditional with 'throw' in one of its branches is
used as a branch condition.

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

11 years agoFix crash on invalid in template type diffing.
Richard Trieu [Tue, 7 May 2013 21:36:24 +0000 (21:36 +0000)]
Fix crash on invalid in template type diffing.

This is a fix for PR15895, where Clang will crash when trying to print a
template diff and the template uses an address of operator.  This resulted
from expecting a DeclRefExpr when the Expr could have also been
UnaryOperator->DeclRefExpr.

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

11 years ago[analyzer;alternate arrows] Fix inconsistencies in recorded location context when...
Ted Kremenek [Tue, 7 May 2013 21:12:06 +0000 (21:12 +0000)]
[analyzer;alternate arrows] Fix inconsistencies in recorded location context when handling interprocedural paths.

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

11 years ago[analyzer; alternate arrows] add back recording whether we visited the first edge.
Ted Kremenek [Tue, 7 May 2013 21:12:03 +0000 (21:12 +0000)]
[analyzer; alternate arrows] add back recording whether we visited the first edge.

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

11 years ago[analyzer; alternate arrows] remove pruning of loop diagnostics.
Ted Kremenek [Tue, 7 May 2013 21:12:00 +0000 (21:12 +0000)]
[analyzer; alternate arrows] remove pruning of loop diagnostics.

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

11 years ago[analyzer; alternate arrows] include logical '||' and '&&' as anchors for edges.
Ted Kremenek [Tue, 7 May 2013 21:11:57 +0000 (21:11 +0000)]
[analyzer; alternate arrows] include logical '||' and '&&' as anchors for edges.

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

11 years ago[analyzer; alternate arrows] include an edge from the "break" or "continue"
Ted Kremenek [Tue, 7 May 2013 21:11:54 +0000 (21:11 +0000)]
[analyzer; alternate arrows] include an edge from the "break" or "continue"

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

11 years ago[analyzer; alternate arrows] the extra edge to the closing '}' in a loop adds no...
Ted Kremenek [Tue, 7 May 2013 21:11:52 +0000 (21:11 +0000)]
[analyzer; alternate arrows] the extra edge to the closing '}' in a loop adds no value.

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

11 years ago[analyzer; alternate arrows] the initializer of a ForStmt isn't interesting either.
Ted Kremenek [Tue, 7 May 2013 21:11:49 +0000 (21:11 +0000)]
[analyzer; alternate arrows] the initializer of a ForStmt isn't interesting either.

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

11 years ago[libclang] Add a null check in CursorVisitor::visitPreprocessedEntities.
Argyrios Kyrtzidis [Tue, 7 May 2013 20:37:17 +0000 (20:37 +0000)]
[libclang] Add a null check in CursorVisitor::visitPreprocessedEntities.

rdar://13680583

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

11 years agoWe're in 3.4 land now.
Bill Wendling [Tue, 7 May 2013 20:31:37 +0000 (20:31 +0000)]
We're in 3.4 land now.

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

11 years agoTry to recognise hidden tag type names in potential declarations, in ObjC code as...
Argyrios Kyrtzidis [Tue, 7 May 2013 19:54:28 +0000 (19:54 +0000)]
Try to recognise hidden tag type names in potential declarations, in ObjC code as well.

rdar://13829073

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

11 years agoC++1y: Update __cplusplus to temporary value 201305L to allow detection of provisiona...
Richard Smith [Tue, 7 May 2013 19:32:56 +0000 (19:32 +0000)]
C++1y: Update __cplusplus to temporary value 201305L to allow detection of provisional C++1y support.
Add __has_feature and __has_extension checks for C++1y features (based on the provisional names from
the C++ features study group), and update documentation to match.

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

11 years ago[analyzer] Fix a crash triggered by printing a note on a default argument
Anna Zaks [Tue, 7 May 2013 17:42:42 +0000 (17:42 +0000)]
[analyzer] Fix a crash triggered by printing a note on a default argument

Instead, use the location of the call to print the note.

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

11 years ago[analyzer; alternate arrows] The ForStmt increment is not a critical anchor for arrows.
Ted Kremenek [Tue, 7 May 2013 17:02:41 +0000 (17:02 +0000)]
[analyzer; alternate arrows] The ForStmt increment is not a critical anchor for arrows.

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

11 years agoTest commit
Serge Pavlov [Tue, 7 May 2013 16:56:03 +0000 (16:56 +0000)]
Test commit

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

11 years agoPrevent crashes from hasCanonicalType matcher
Edwin Vane [Tue, 7 May 2013 15:53:23 +0000 (15:53 +0000)]
Prevent crashes from hasCanonicalType matcher

Adding an QualType::isNull() check.

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

11 years agoConfig file support for clang-format, part 1.
Alexander Kornienko [Tue, 7 May 2013 15:32:14 +0000 (15:32 +0000)]
Config file support for clang-format, part 1.

Summary:
Added parseConfiguration method, which reads FormatStyle from YAML
string. This supports all FormatStyle fields and an additional BasedOnStyle
field, which can be used to specify base style.

Reviewers: djasper, klimek

Reviewed By: djasper

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

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

11 years agoCorrectly recognize dereference after 'delete'.
Daniel Jasper [Tue, 7 May 2013 14:17:18 +0000 (14:17 +0000)]
Correctly recognize dereference after 'delete'.

With certain styles:
Before: delete* x;
After:  delete *x;

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

11 years agoFurther fix to clang-format emacs integration.
Daniel Jasper [Tue, 7 May 2013 10:04:47 +0000 (10:04 +0000)]
Further fix to clang-format emacs integration.

This is just a slight improvement for the fix in r181299, which fixes
formatting the very last line of a file.

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

11 years agoFix clang-format emacs integration in last line.
Daniel Jasper [Tue, 7 May 2013 09:25:29 +0000 (09:25 +0000)]
Fix clang-format emacs integration in last line.

Emacs seems to have a line that is just past the last character of the
buffers content. This needs to be handled specially so that clang-format
is not called with an invalid -offset.

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

11 years ago[analyzer; alternate edges] simplify optimization rules to look at control-flow condi...
Ted Kremenek [Tue, 7 May 2013 07:30:07 +0000 (07:30 +0000)]
[analyzer; alternate edges] simplify optimization rules to look at control-flow conditions to prune edges.

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

11 years ago[analyzer; alternate arrows] use the terminator condition as the location for 'enteri...
Ted Kremenek [Tue, 7 May 2013 07:30:00 +0000 (07:30 +0000)]
[analyzer; alternate arrows] use the terminator condition as the location for 'entering loop body'

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

11 years agoWeaken an assertion in memcpyization to account for
John McCall [Tue, 7 May 2013 05:20:46 +0000 (05:20 +0000)]
Weaken an assertion in memcpyization to account for
unnamed bitfields.

Unnamed bitfields won't have an explicit copy operation
in the AST, which breaks the strong form of the invariant.

rdar://13816940

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

11 years agoC++1y constant expression evaluation: support for compound assignments on integers.
Richard Smith [Tue, 7 May 2013 04:50:00 +0000 (04:50 +0000)]
C++1y constant expression evaluation: support for compound assignments on integers.

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

11 years agoHave SourceManager::getLocForEndOfFile() point at the "EOF" location of the FileID.
Argyrios Kyrtzidis [Tue, 7 May 2013 04:29:22 +0000 (04:29 +0000)]
Have SourceManager::getLocForEndOfFile() point at the "EOF" location of the FileID.

This fixes a crash due to SourceManager::getLocForEndOfFile() returning an off-by-one location
when the the FileID is for an empty file.

rdar://13803893

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

11 years agoC++1y: an assignment operator is implicitly 'constexpr' if it would only call 'conste...
Richard Smith [Tue, 7 May 2013 03:19:20 +0000 (03:19 +0000)]
C++1y: an assignment operator is implicitly 'constexpr' if it would only call 'constexpr' assignment operators for a literal class type.

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

11 years agoC++ status:
Richard Smith [Tue, 7 May 2013 02:55:48 +0000 (02:55 +0000)]
C++ status:
 - fix paper links to point to isocpp.org, where most of the papers are already up
 - update "SVN" features to "Clang 3.3" to distinguish them from features which we
   complete after the branch
 - document use of -std=c++1y to enable c++1y support

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

11 years ago[analyzer; alternate arrows] provide a diagnostic for entering a loop for the first...
Ted Kremenek [Tue, 7 May 2013 01:18:10 +0000 (01:18 +0000)]
[analyzer; alternate arrows] provide a diagnostic for entering a loop for the first time.

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

11 years agoDebugInfo: Support imported modules (using directives) within lexical blocks.
David Blaikie [Mon, 6 May 2013 23:33:13 +0000 (23:33 +0000)]
DebugInfo: Support imported modules (using directives) within lexical blocks.

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

11 years ago[analyzer; alternate arrows] don't increment the path iterator when we just deleted...
Ted Kremenek [Mon, 6 May 2013 21:59:37 +0000 (21:59 +0000)]
[analyzer; alternate arrows] don't increment the path iterator when we just deleted the next iterator.

This is an optimization.  It is possible that by deleting the next
edge we will pattern match again at the current spot.

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

11 years agoGrab-bag of bit-field fixes:
John McCall [Mon, 6 May 2013 21:39:12 +0000 (21:39 +0000)]
Grab-bag of bit-field fixes:

  - References to ObjC bit-field ivars are bit-field lvalues;
    fixes rdar://13794269, which got me started down this.
  - Introduce Expr::refersToBitField, switch a couple users to
    it where semantically important, and comment the difference
    between this and the existing API.
  - Discourage Expr::getBitField by making it a bit longer and
    less general-sounding.
  - Lock down on const_casts of bit-field gl-values until we
    hear back from the committee as to whether they're allowed.

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

11 years agoAdd missing initialization for Sema::CurScope. This is important for AST consumers...
Richard Smith [Mon, 6 May 2013 21:35:35 +0000 (21:35 +0000)]
Add missing initialization for Sema::CurScope. This is important for AST consumers which don't create a Parser. Pointed out by Tom Honermann.

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

11 years agoMove PragmaCommentHandler to lib/Parse in preparation for calling Sema
Reid Kleckner [Mon, 6 May 2013 21:02:12 +0000 (21:02 +0000)]
Move PragmaCommentHandler to lib/Parse in preparation for calling Sema

Summary:
No functionality change.  The existing tests for this pragma only verify
that we can preprocess it.

Reviewers: rsmith

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

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

11 years agoModify ASTReaderListener to allow visiting the input files of an AST file.
Argyrios Kyrtzidis [Mon, 6 May 2013 19:23:40 +0000 (19:23 +0000)]
Modify ASTReaderListener to allow visiting the input files of an AST file.

We can pass such an input-file-visiting ASTReaderListener to ASTReader::readASTFileControlBlock.

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

11 years agoHave the RecursiveASTVisitor traverse the type source info of an objc class message.
Argyrios Kyrtzidis [Mon, 6 May 2013 19:08:57 +0000 (19:08 +0000)]
Have the RecursiveASTVisitor traverse the type source info of an objc class message.

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

11 years ago[analyzer] Remove now-unused bindCompoundLiteral helper function.
Jordan Rose [Mon, 6 May 2013 16:48:26 +0000 (16:48 +0000)]
[analyzer] Remove now-unused bindCompoundLiteral helper function.

The one user has been changed to use getLValue on the compound literal
expression and then use the normal bindLoc to assign a value. No need
to special case this in the StoreManager.

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

11 years ago[analyzer] Handle CXXTemporaryObjectExprs in compound literals.
Jordan Rose [Mon, 6 May 2013 16:48:20 +0000 (16:48 +0000)]
[analyzer] Handle CXXTemporaryObjectExprs in compound literals.

This occurs because in C++11 the compound literal syntax can trigger a
constructor call via list-initialization. That is, "Point{x, y}" and
"(Point){x, y}" end up being equivalent. If this occurs, the inner
CXXConstructExpr will have already handled the object construction; the
CompoundLiteralExpr just needs to propagate that value forwards.

<rdar://problem/13804098>

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

11 years agoFix representation of compound literals for C++ objects with destructors.
Jordan Rose [Mon, 6 May 2013 16:48:12 +0000 (16:48 +0000)]
Fix representation of compound literals for C++ objects with destructors.

Previously, this compound literal expression (a GNU extension in C++):

  (AggregateWithDtor){1, 2}

resulted in this AST:

 `-CXXBindTemporaryExpr [...] 'struct Point' (CXXTemporary [...])
   `-CompoundLiteralExpr [...] 'struct AggregateWithDtor'
     `-CXXBindTemporaryExpr [...] 'struct AggregateWithDtor' (CXXTemporary [...])
       `-InitListExpr [...] 'struct AggregateWithDtor'
         |-IntegerLiteral [...] 'int' 1
         `-IntegerLiteral [...] 'int' 2

Note the two CXXBindTemporaryExprs. The InitListExpr is really part of the
CompoundLiteralExpr, not an object in its own right. By introducing a new
entity initialization kind in Sema specifically for compound literals, we
avoid the treatment of the inner InitListExpr as a temporary.

 `-CXXBindTemporaryExpr [...] 'struct Point' (CXXTemporary [...])
   `-CompoundLiteralExpr [...] 'struct AggregateWithDtor'
     `-InitListExpr [...] 'struct AggregateWithDtor'
       |-IntegerLiteral [...] 'int' 1
       `-IntegerLiteral [...] 'int' 2

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

11 years agoAdd SystemZ support
Ulrich Weigand [Mon, 6 May 2013 16:26:41 +0000 (16:26 +0000)]
Add SystemZ support

This patch then adds all the usual platform-specific pieces for SystemZ:
driver support, basic target info, register names and constraints,
ABI info and vararg support.  It also adds new tests to verify pre-defined
macros and inline asm, and updates a test for the minimum alignment change.

This version of the patch incorporates feedback from reviews by
Eric Christopher and John McCall.  Thanks to all reviewers!

Patch by Richard Sandiford.

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

11 years agoAllow targets to define minimum alignment for global variables
Ulrich Weigand [Mon, 6 May 2013 16:23:57 +0000 (16:23 +0000)]
Allow targets to define minimum alignment for global variables

This patch adds a new common code feature that allows platform code to
request minimum alignment of global symbols.  The background for this is
that on SystemZ, the most efficient way to load addresses of global symbol
is the LOAD ADDRESS RELATIVE LONG (LARL) instruction.  This instruction
provides PC-relative addressing, but only to *even* addresses.  For this
reason, existing compilers will guarantee that global symbols are always
aligned to at least 2.  [ Since symbols would otherwise already use a
default alignment based on their type, this will usually only affect global
objects of character type or character arrays. ]  GCC also allows creating
symbols without that extra alignment by using explicit "aligned" attributes
(which then need to be used on both definition and each use of the symbol).

To enable support for this with Clang, this patch adds a
TargetInfo::MinGlobalAlign variable that provides a global minimum for the
alignment of every global object (unless overridden via explicit alignment
attribute), and adds code to respect this setting.  Within this patch, no
platform actually sets the value to anything but the default 1, resulting
in no change in behaviour on any existing target.

This version of the patch incorporates feedback from reviews by
Eric Christopher and John McCall.  Thanks to all reviewers!

Patch by Richard Sandiford.

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

11 years agoR600: Update GPU variants in -mcpu option
Tom Stellard [Mon, 6 May 2013 16:12:05 +0000 (16:12 +0000)]
R600: Update GPU variants in -mcpu option

We've added the RS880 variant in the LLVM backend to represent an R600
GPU with no vertex cache, so we need to update the GPU mappings for
-mcpu.

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

11 years agoRemove forward slashes from check; should unbreak Windows buildbots.
Douglas Gregor [Mon, 6 May 2013 15:42:15 +0000 (15:42 +0000)]
Remove forward slashes from check; should unbreak Windows buildbots.

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

11 years agoAdd llvm_unreachable at end of fully covered switch
Hans Wennborg [Mon, 6 May 2013 15:13:34 +0000 (15:13 +0000)]
Add llvm_unreachable at end of fully covered switch

To pacify GCC warning about control reaching end of non-void function.

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

11 years agoAdded Mozilla style, cleaned get*Style methods.
Alexander Kornienko [Mon, 6 May 2013 14:11:27 +0000 (14:11 +0000)]
Added Mozilla style, cleaned get*Style methods.

Summary: Patch based on a patch by Ehsan Akhgari.

Reviewers: djasper

Reviewed By: djasper

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

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

11 years agoDon't break comments after includes.
Daniel Jasper [Mon, 6 May 2013 10:24:51 +0000 (10:24 +0000)]
Don't break comments after includes.

LLVM/Clang basically don't use such comments and for Google-style,
include-lines are explicitly exempt from the column limit. Also, for
most cases, where the column limit is violated, the "better" solution
would be to move the comment to before the include, which clang-format
cannot do (yet).

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

11 years agoChange indentation when breaking after a type.
Daniel Jasper [Mon, 6 May 2013 08:27:33 +0000 (08:27 +0000)]
Change indentation when breaking after a type.

clang-format did not indent any declarations/definitions when breaking
after the type. With this change, it indents for all declarations but
does not indent for function definitions, i.e.:

Before:
const SomeLongTypeName&
some_long_variable_name;
typedef SomeLongTypeName
SomeLongTypeAlias;
const SomeLongReturnType*
SomeLongFunctionName();
const SomeLongReturnType*
SomeLongFunctionName() { ... }

After:
const SomeLongTypeName&
    some_long_variable_name;
typedef SomeLongTypeName
    SomeLongTypeAlias;
const SomeLongReturnType*
    SomeLongFunctionName();
const SomeLongReturnType*
SomeLongFunctionName() { ... }

While it might seem inconsistent to indent function declarations, but
not definitions, there are two reasons for that:
- Function declarations are very similar to declarations of function
type variables, so there is another side to consistency to consider.
- There can be many function declarations on subsequent lines and not
indenting can make them harder to identify. Function definitions
are already separated by their body and not indenting
makes the function name slighly easier to find.

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

11 years agoRequire the containing type to be complete when we see
John McCall [Mon, 6 May 2013 07:40:34 +0000 (07:40 +0000)]
Require the containing type to be complete when we see
__alignof__ of a field.

This problem can only happen in C++11.

Also do some petty optimizations.

rdar://13784901

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

11 years agoC++1y: support range-based for loops in constant expressions.
Richard Smith [Mon, 6 May 2013 06:51:17 +0000 (06:51 +0000)]
C++1y: support range-based for loops in constant expressions.

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

11 years agoBreak the class-inheritance ":" to the new line.
Daniel Jasper [Mon, 6 May 2013 06:45:09 +0000 (06:45 +0000)]
Break the class-inheritance ":" to the new line.

This seems to be more common in LLVM, Google and Chromium.

Before:
class AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA :
    public BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
    public CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC {
};

After:
class AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    : public BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
      public CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC {
};

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

11 years agoDon't put a space before ellipsis.
Daniel Jasper [Mon, 6 May 2013 06:35:44 +0000 (06:35 +0000)]
Don't put a space before ellipsis.

Before: template <class ... Ts> void Foo(Ts ... ts) { Foo(ts ...); }
After:  template <class... Ts> void Foo(Ts... ts) { Foo(ts...); }

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

11 years agoC++1y: support 'for', 'while', and 'do ... while' in constant expressions.
Richard Smith [Mon, 6 May 2013 05:56:11 +0000 (05:56 +0000)]
C++1y: support 'for', 'while', and 'do ... while' in constant expressions.

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

11 years agoFix assert if __extension__ or _Generic is used when initializing a char array from...
Richard Smith [Mon, 6 May 2013 00:35:47 +0000 (00:35 +0000)]
Fix assert if __extension__ or _Generic is used when initializing a char array from a string literal.

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

11 years agoC++1y: support for increment and decrement in constant expression evaluation.
Richard Smith [Sun, 5 May 2013 23:31:59 +0000 (23:31 +0000)]
C++1y: support for increment and decrement in constant expression evaluation.

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

11 years agoFactor out duplication between lvalue-to-rvalue conversions and variable
Richard Smith [Sun, 5 May 2013 21:17:10 +0000 (21:17 +0000)]
Factor out duplication between lvalue-to-rvalue conversions and variable
assignments in constant expressions. No significant functionality changes
(slight improvement to potential constant expression checking).

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

11 years agoReplace 'MultiExprArg()' with 'None'
Dmitri Gribenko [Sun, 5 May 2013 20:40:26 +0000 (20:40 +0000)]
Replace 'MultiExprArg()' with 'None'

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

11 years agoMake all 'is in extern "C"' tests use the lexical context.
Rafael Espindola [Sun, 5 May 2013 20:15:21 +0000 (20:15 +0000)]
Make all 'is in extern "C"' tests use the lexical context.

I was not able to find a case (other than the fix in r181163) where this
makes a difference, but it is a more obviously correct API to have.

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

11 years agoArrayRef'ize Sema::CheckObjCMethodCall
Dmitri Gribenko [Sun, 5 May 2013 19:42:09 +0000 (19:42 +0000)]
ArrayRef'ize Sema::CheckObjCMethodCall

Patch by Robert Wilhelm.

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

11 years agoUse lexical contexts when checking for conflicting language linkages.
Rafael Espindola [Sun, 5 May 2013 18:24:05 +0000 (18:24 +0000)]
Use lexical contexts when checking for conflicting language linkages.

This fixes pr14958. I will audit other calls to isExternCContext to see
if there are any similar bugs left.

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

11 years agoHandle parens properly when initializing a char array from a string literal.
Richard Smith [Sun, 5 May 2013 16:40:13 +0000 (16:40 +0000)]
Handle parens properly when initializing a char array from a string literal.

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

11 years agoArrayRef'ization of some methods in SemaOverload. Patch by Robert Wilhelm!
Richard Smith [Sun, 5 May 2013 15:51:06 +0000 (15:51 +0000)]
ArrayRef'ization of some methods in SemaOverload. Patch by Robert Wilhelm!

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

11 years agoUse remove_if to erase parts of a vector. Avoids O(n^2) worst cases.
Benjamin Kramer [Sun, 5 May 2013 12:39:28 +0000 (12:39 +0000)]
Use remove_if to erase parts of a vector. Avoids O(n^2) worst cases.

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

11 years agoArrayRef<T>() -> None cleanup
Dmitri Gribenko [Sun, 5 May 2013 01:03:47 +0000 (01:03 +0000)]
ArrayRef<T>() -> None cleanup

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

11 years agoReplace ArrayRef<T>() with None, now that we have an implicit ArrayRef constructor...
Dmitri Gribenko [Sun, 5 May 2013 00:41:58 +0000 (00:41 +0000)]
Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef constructor from None

Patch by Robert Wilhelm.

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

11 years agoProperly parsing __declspec(safebuffers), though there is no semantic hookup. For...
Aaron Ballman [Sat, 4 May 2013 16:58:37 +0000 (16:58 +0000)]
Properly parsing __declspec(safebuffers), though there is no semantic hookup.  For more information about safebuffers, see MSDN: http://msdn.microsoft.com/en-us/library/dd778695(v=vs.110).aspx

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

11 years agoReverting r181004 since it has broken test/Sema/wchar.c.
Aaron Ballman [Sat, 4 May 2013 16:56:22 +0000 (16:56 +0000)]
Reverting r181004 since it has broken test/Sema/wchar.c.

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

11 years agoMoved pretty printer test for thread local storage in its own file
Enea Zaffanella [Sat, 4 May 2013 11:26:59 +0000 (11:26 +0000)]
Moved pretty printer test for thread local storage in its own file
and specified the triple.

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

11 years agoLex: Fix quadratic behavior when unescaping _Pragma strings.
Benjamin Kramer [Sat, 4 May 2013 10:37:20 +0000 (10:37 +0000)]
Lex: Fix quadratic behavior when unescaping _Pragma strings.

No functionality change.

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

11 years agoIn VarDecl nodes, store the thread storage class specifier as written.
Enea Zaffanella [Sat, 4 May 2013 08:27:07 +0000 (08:27 +0000)]
In VarDecl nodes, store the thread storage class specifier as written.

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

11 years agoAArch64: teach Clang about __clear_cache intrinsic
Tim Northover [Sat, 4 May 2013 07:15:13 +0000 (07:15 +0000)]
AArch64: teach Clang about __clear_cache intrinsic

libgcc provides a __clear_cache intrinsic on AArch64, much like it
does on 32-bit ARM.

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

11 years agoTweaks to C++ status: add a link to Faisal's generic lambdas implementation,
Richard Smith [Sat, 4 May 2013 07:12:37 +0000 (07:12 +0000)]
Tweaks to C++ status: add a link to Faisal's generic lambdas implementation,
and mark "clarifying memory allocation" as done, since it turns out that our
optimizations here (such as they are) already conform to the new rules.

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

11 years agoMore colours for C++ status page, and mark relaxed constexpr as partially complete.
Richard Smith [Sat, 4 May 2013 07:02:10 +0000 (07:02 +0000)]
More colours for C++ status page, and mark relaxed constexpr as partially complete.

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

11 years agoImplement most of N3638 (return type deduction for normal functions).
Richard Smith [Sat, 4 May 2013 07:00:32 +0000 (07:00 +0000)]
Implement most of N3638 (return type deduction for normal functions).
Missing (somewhat ironically) is support for the new deduction rules
in lambda functions, plus PCH support for return type patching.

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

11 years agoDon't build a call expression referring to a function which we're not allowed
Richard Smith [Sat, 4 May 2013 06:44:46 +0000 (06:44 +0000)]
Don't build a call expression referring to a function which we're not allowed
to use. This makes very little difference right now (other than suppressing
follow-on errors in some cases), but will matter more once we support deduced
return types (we don't want expressions with undeduced return types in the
AST).

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

11 years agoSay 'decltype(auto)' not 'auto' as appropriate in mismatched-deduction diagnostic.
Richard Smith [Sat, 4 May 2013 04:19:27 +0000 (04:19 +0000)]
Say 'decltype(auto)' not 'auto' as appropriate in mismatched-deduction diagnostic.

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

11 years agoImplement template support for CapturedStmt
Wei Pan [Sat, 4 May 2013 03:59:06 +0000 (03:59 +0000)]
Implement template support for CapturedStmt

- Sema tests added and CodeGen tests are pending

Differential Revision: http://llvm-reviews.chandlerc.com/D728

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

11 years agoAdded a function to check whether a Decl is in
Sean Callanan [Sat, 4 May 2013 02:04:27 +0000 (02:04 +0000)]
Added a function to check whether a Decl is in
the list of Decls for a given DeclContext.  This
is useful for LLDB's implementation of
FindExternalLexicalDecls.

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

11 years agoSimplify slightly.
Richard Smith [Sat, 4 May 2013 01:51:08 +0000 (01:51 +0000)]
Simplify slightly.

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

11 years agoSeparate out and special-case the diagnostic for 'auto' in a
Richard Smith [Sat, 4 May 2013 01:26:46 +0000 (01:26 +0000)]
Separate out and special-case the diagnostic for 'auto' in a
conversion-type-id, in preparation for this becoming valid in c++1y mode.
No functionality change; small diagnostic improvement.

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

11 years ago[analyzer;alternate edges] start experimenting with control flow "barriers" to preven...
Ted Kremenek [Sat, 4 May 2013 01:13:22 +0000 (01:13 +0000)]
[analyzer;alternate edges] start experimenting with control flow "barriers" to prevent an edge being optimized away.

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

11 years ago[analyzer;alternate edges] ignore parentheses when determining edge levels.
Ted Kremenek [Sat, 4 May 2013 01:13:12 +0000 (01:13 +0000)]
[analyzer;alternate edges] ignore parentheses when determining edge levels.

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

11 years ago[analyzer; alternate edges] - eliminate unnecessary edges where between parents and...
Ted Kremenek [Sat, 4 May 2013 01:13:08 +0000 (01:13 +0000)]
[analyzer; alternate edges] - eliminate unnecessary edges where between parents and subexpressions.

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

11 years ago[analyzer; alternate edges] - merge control edges where we descend to a subexpression...
Ted Kremenek [Sat, 4 May 2013 01:13:05 +0000 (01:13 +0000)]
[analyzer; alternate edges] - merge control edges where we descend to a subexpression and pop back out.

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

11 years ago[analyzer; alternate edges] prune edges whose end/begin locations have the same state...
Ted Kremenek [Sat, 4 May 2013 01:13:01 +0000 (01:13 +0000)]
[analyzer; alternate edges] prune edges whose end/begin locations have the same statement parents.

This change required some minor changes to LocationContextMap to have it map
from PathPieces to LocationContexts instead of PathDiagnosticCallPieces to
LocationContexts.  These changes are in the other diagnostic
generation logic as well, but are functionally equivalent.

Interestingly, this optimize requires delaying "cleanUpLocation()" until
later; possibly after all edges have been optimized.  This is because
we need PathDiagnosticLocations to refer to the semantic entity (e.g. a statement)
as long as possible.  Raw source locations tell us nothing about
the semantic relationship between two locations in a path.

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

11 years ago[analyzer;alternate edges] - add in events (loop iterations, etc)
Ted Kremenek [Sat, 4 May 2013 01:12:55 +0000 (01:12 +0000)]
[analyzer;alternate edges] - add in events (loop iterations, etc)

These were being dropped due a transcription mistake from the original
algorithm.

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

11 years ago[doc parsing]: Make warning about unknown command
Fariborz Jahanian [Sat, 4 May 2013 00:47:28 +0000 (00:47 +0000)]
[doc parsing]: Make warning about unknown command
tags off by default for now. Move diagnostic code
to DiagnosticCommentKinds.td. // rdar://12381408

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

11 years agoArrayRef'ize MultiLevelTemplateArgumentList::ArgList. Patch by Faisal Vali!
Richard Smith [Fri, 3 May 2013 23:46:09 +0000 (23:46 +0000)]
ArrayRef'ize MultiLevelTemplateArgumentList::ArgList. Patch by Faisal Vali!

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

11 years ago<rdar://problem/13806270> A template argument list is a constant-evaluated context.
Douglas Gregor [Fri, 3 May 2013 23:44:54 +0000 (23:44 +0000)]
<rdar://problem/13806270> A template argument list is a constant-evaluated context.

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

11 years agoRevert r177218.
Argyrios Kyrtzidis [Fri, 3 May 2013 23:20:27 +0000 (23:20 +0000)]
Revert r177218.

Per discussion in cfe-commits, asserting may be a better way than introducing a special test flag.

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

11 years ago[Doc parsing] Provide diagnostics for unknown documentation
Fariborz Jahanian [Fri, 3 May 2013 23:15:20 +0000 (23:15 +0000)]
[Doc parsing] Provide diagnostics for unknown documentation
commands. // rdar://12381408

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

11 years agoRemove DiagnosticConsumer::clone(), a bad idea that is now unused.
Douglas Gregor [Fri, 3 May 2013 23:07:45 +0000 (23:07 +0000)]
Remove DiagnosticConsumer::clone(), a bad idea that is now unused.

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

11 years agoWhen building a module, forward diagnostics to the outer diagnostic consumer.
Douglas Gregor [Fri, 3 May 2013 22:58:43 +0000 (22:58 +0000)]
When building a module, forward diagnostics to the outer diagnostic consumer.

Previously, we would clone the current diagnostic consumer to produce
a new diagnostic consumer to use when building a module. The problem
here is that we end up losing diagnostics for important diagnostic
consumers, such as serialized diagnostics (where we'd end up with two
diagnostic consumers writing the same output file). With forwarding,
the diagnostics from all of the different modules being built get
forwarded to the one serialized-diagnostic consumer and are emitted in
a sane way.

Fixes <rdar://problem/13663996>.

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

11 years ago[Preprocessor] For the MacroExpands preprocessor callback, also pass the MacroArgs...
Argyrios Kyrtzidis [Fri, 3 May 2013 22:31:32 +0000 (22:31 +0000)]
[Preprocessor] For the MacroExpands preprocessor callback, also pass the MacroArgs object that provides information about
the argument tokens for a function macro.

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

11 years agoRename ObjCImplementationDecl::getSuperLoc() -> getSuperClassLoc() for consistency...
Argyrios Kyrtzidis [Fri, 3 May 2013 22:31:26 +0000 (22:31 +0000)]
Rename ObjCImplementationDecl::getSuperLoc() -> getSuperClassLoc() for consistency with ObjCInterfaceDecl::getSuperClassLoc()

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

11 years agoTest commit
Wei Pan [Fri, 3 May 2013 21:07:45 +0000 (21:07 +0000)]
Test commit

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

11 years agoReapply r180982 with repaired logic and an additional testcase.
Adrian Prantl [Fri, 3 May 2013 20:11:48 +0000 (20:11 +0000)]
Reapply r180982 with repaired logic and an additional testcase.

Un-break the gdb buildbot.
- Use the debug location of the return expression for the cleanup code
  if the return expression is trivially evaluatable, regardless of the
  number of stop points in the function.
- Ensure that any EH code in the cleanup still gets the line number of
  the closing } of the lexical scope.
- Added a testcase with EH in the cleanup.

rdar://problem/13442648

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

11 years agoSerialization for captured statements
Ben Langmuir [Fri, 3 May 2013 19:20:19 +0000 (19:20 +0000)]
Serialization for captured statements

Add serialization for captured statements and captured decls.  Also add
a const_capture_iterator to CapturedStmt.

Test contributed by Wei Pan

Differential Revision: http://llvm-reviews.chandlerc.com/D727

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

11 years agoPR15906: The body of a lambda is not an evaluated subexpression; don't visit it when...
Richard Smith [Fri, 3 May 2013 19:16:22 +0000 (19:16 +0000)]
PR15906: The body of a lambda is not an evaluated subexpression; don't visit it when visiting such subexpressions.

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

11 years agoMove CapturedStmt parameters to CapturedDecl
Ben Langmuir [Fri, 3 May 2013 19:00:33 +0000 (19:00 +0000)]
Move CapturedStmt parameters to CapturedDecl

Move the creation of CapturedStmt parameters out of CodeGen and into
Sema, making it easier to customize the outlined function. The
ImplicitParamDecls are stored in the CapturedDecl using an
ASTContext-allocated array.

Differential Revision: http://llvm-reviews.chandlerc.com/D722

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