Commit Graph

47334 Commits

Author SHA1 Message Date
Rafael Espindola 493f045e75 Don't imply -flto with -O4.
We now saturate at -O3.

llvm-svn: 189149
2013-08-23 21:49:00 +00:00
Shuxin Yang 4b3c7ffc64 Driver::IsUsingLTO() no longer return true when seeing -emit-llvm.
One step toward differentiating following two commands:
   clang -O3 -flto a.c -c, and 
   clang -O3 -emit-llvm a.c

Thanks many awesome folks for clarifying things. 

llvm-svn: 189148
2013-08-23 21:34:57 +00:00
Rafael Espindola 890498236b Update now that llvm uses the same feature names as the driver.
llvm-svn: 189142
2013-08-23 20:21:37 +00:00
DeLesley Hutchins 73ec2ae91e Consumed analysis: change class name in test cases.
The name of a class used in the testing files was updated to actually
be descriptive.  Patch by chris.wailes@gmail.com.

llvm-svn: 189132
2013-08-23 18:40:39 +00:00
Hans Wennborg 8c981adcec Rename CMake variable; this fell out of r189127 somehow.
llvm-svn: 189129
2013-08-23 18:20:47 +00:00
Hans Wennborg f135e3534c CMake: Don't look for llvm-tblgen when building outside LLVM tree
Previously, the CMake build would look for llvm-tblgen to determine
if a directory is an LLVM build or install directory. Since we don't
want to include llvm-tblgen in the install, look for llvm-config instead,
and use that to find llvm-tblgen.

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

llvm-svn: 189127
2013-08-23 18:05:24 +00:00
Dmitri Gribenko 1e50cbf366 Comment parsing: fix a bug where a line with whitespace between two paragraphs
would cause us to concatenate these paragraphs into a single one.

The no-op whitespace churn in test/Index test happened because these tests
don't use the correct approach for testing and are more strict than required
for they are testing.

llvm-svn: 189126
2013-08-23 18:03:40 +00:00
Dmitri Gribenko 11f54e86bb Fix indentation
llvm-svn: 189119
2013-08-23 17:48:41 +00:00
Dmitri Gribenko db6adaba68 Use CharInfo.h routines in TextComment::isWhitespaceNoCache
llvm-svn: 189115
2013-08-23 17:45:43 +00:00
Jordan Rose 9217aa3b15 Revise -Wnewline-eof test per feedback from Dmitri.
llvm-svn: 189113
2013-08-23 16:12:49 +00:00
Robert Wilhelm 25284cc95b Use pop_back_val() instead of both back() and pop_back().
No functionality change intended.

llvm-svn: 189112
2013-08-23 16:11:15 +00:00
Jordan Rose 4c55d45b13 Respect -Wnewline-eof even in C++11 mode.
If the user has requested this warning, we should emit it, even if it's not
an extension in the current language mode. However, being an extension is
more important, so prefer the pedantic warning or the pedantic-compatibility
warning if those are enabled.

<rdar://problem/12922063>

llvm-svn: 189110
2013-08-23 15:42:01 +00:00
Daniel Jasper 0649d36172 clang-format: Fix indentation relative to unary expressions.
This should be done, only if we are still in the unary expression's
scope.

Before:
  bool aaaa = !aaaaaaaa(  // break
                   aaaaaaaaaaa);
  *aaaaaa = aaaaaaa( // break
       aaaaaaaaaaaaaaaa);

After:
  bool aaaa = !aaaaaaaa(  // break
                   aaaaaaaaaaa); // <- (unchanged)
  *aaaaaa = aaaaaaa( // break
      aaaaaaaaaaaaaaaa); // <- (no longer indented relative to "*")

llvm-svn: 189108
2013-08-23 15:14:03 +00:00
Daniel Jasper f438cb7619 clang-format: Fix corner case for string splitting ..
.. in conjunction with Style.AlwaysBreakBeforeMultilineStrings. Also,
simplify the implementation by handling newly split strings and already
split strings by the same code.

llvm-svn: 189102
2013-08-23 11:57:34 +00:00
Daniel Jasper f93551c8b1 clang-format: Handle trailing commas in column layout of braced list.
Before, this was causing errors.

Also exit early in breakProtrudingToken() (before the expensive call to
SourceManager::getSpellingColumnNumber()). This makes formatting huge
(100k+-item) braced lists possible.

llvm-svn: 189094
2013-08-23 10:05:49 +00:00
Robert Lytton bff06ce221 correct test RUN parameters
llvm-svn: 189093
2013-08-23 09:27:44 +00:00
Pavel Labath 02b64d46a0 [analyzer] Refactor conditional expression evaluating code
Summary:
Instead of digging through the ExplodedGraph, to figure out which edge brought
us here, I compute the value of conditional expression by looking at the
sub-expression values.

To do this, I needed to change the liveness algorithm a bit -- now, the full
conditional expression also depends on all atomic sub-expressions, not only the
outermost ones.

Reviewers: jordan_rose

CC: cfe-commits

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

llvm-svn: 189090
2013-08-23 07:19:22 +00:00
David Majnemer da45a0fa6f arc commit didn't add this because it wasn't in the patch...
llvm-svn: 189088
2013-08-23 05:42:19 +00:00
David Majnemer 61c39a1ccd Sema: Properly support Microsoft-mode template arguments
Summary:
There were two things known to be wrong with our implementation of MSVC
mode template arguments:

- We didn't properly handle __uuidof/CXXUuidofExpr and skipped all type
  checking completely.
- We didn't allow for MSVC's extension of allowing certain constant
  "foldable" expressions from showing up in template arguments.
  They allow various casts dereference and address-of operations.
  We can make it more general as we find further peculiarities but this
  is the known extent.

Reviewers: rsmith, doug.gregor, rjmccall

Reviewed By: doug.gregor

CC: cfe-commits, rnk

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

llvm-svn: 189087
2013-08-23 05:39:39 +00:00
Richard Smith d136f60b07 Reword a diagnostic to avoid a confusing implication that it might be talking
about a declaration within a return type.

llvm-svn: 189083
2013-08-23 02:16:48 +00:00
Richard Smith b2f61b4a05 Remove SequenceNumber from class/variable template partial specializations.
This was only used to ensure that the traversal order was the same as the
insertion order, but that guarantee was already being provided by the use
of a FoldingSetVector.

llvm-svn: 189075
2013-08-22 23:27:37 +00:00
Fariborz Jahanian 2e9c19cc35 ObjectiveC migrator: builtin ObjectiveC types are not
audited types.

llvm-svn: 189072
2013-08-22 22:27:36 +00:00
Fariborz Jahanian 4f64dd2baf ObjectiveC migrator: some refactoring to reduce
code size.

llvm-svn: 189070
2013-08-22 21:40:15 +00:00
Bill Wendling a74e82aad8 Check for absence of the flag.
llvm-svn: 189069
2013-08-22 21:30:21 +00:00
Bill Wendling 17d1b61480 Only add this attribute when it's set. If it's not there, the assumption is that it's off.
llvm-svn: 189064
2013-08-22 21:16:51 +00:00
DeLesley Hutchins c2ecf0d815 Update to consumed analysis.
Patch by chris.wailes@gmail.com.  The following functionality was added:

* The same functionality is now supported for both CXXOperatorCallExprs and CXXMemberCallExprs.
* Factored out some code in StmtVisitor.
* Removed variables from the state map when their destructors are encountered.
* Started adding documentation for the consumed analysis attributes.

llvm-svn: 189059
2013-08-22 20:44:47 +00:00
Peter Collingbourne 730f3c8574 DataFlowSanitizer: Add a design doc paragraph on checking ABI consistency.
Differential Revision: http://llvm-reviews.chandlerc.com/D1443

llvm-svn: 189055
2013-08-22 20:08:20 +00:00
Reid Kleckner 3738445cdd Add a separate llvm.global_ctors entry for linkonce_odr data initializers
Summary:
These typically come from static data members of class template
specializations.  This accomplishes two things:

1. May expose GlobalOpt optimizations for Itanium C++ ABI code.
2. Works toward fixing double initialization in the Microsoft C++ ABI.

CC: cfe-commits

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

llvm-svn: 189051
2013-08-22 20:07:45 +00:00
Reid Kleckner 90e119a0fc FileCheckify a grep test.
llvm-svn: 189042
2013-08-22 18:45:40 +00:00
Fariborz Jahanian 926fafb888 ObjectiveC migrator: Provide ARC annotations for
CF methods too.

llvm-svn: 189041
2013-08-22 18:35:27 +00:00
Samuel Benzaquen 8c9f6330e6 Refactor VariantMatcher to use an interface underneath.
Summary:
Refactor VariantMatcher to use an interface underneath.
It supports "Single" and "Polymorphic". Will support more in the future.

Reviewers: klimek

CC: cfe-commits, revane

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

llvm-svn: 189032
2013-08-22 16:38:33 +00:00
Jordan Rose 8ba180e25c Re-add clang-check to the Makefile build.
I was bound to screw this up somehow.

llvm-svn: 189029
2013-08-22 16:12:04 +00:00
Daniel Jasper 12f4f1192d Work around unused variable warning in release builds.
llvm-svn: 189028
2013-08-22 16:11:46 +00:00
Jordan Rose a1e4b12223 Fix dependencies now that the ARC migrator depends on the static analyzer.
Thanks for pointing this out, Stephen. I think this is right now -- I
attempted to try all four valid combinations with both the autoconf and
CMake builds.

See also LLVM changes to the configure script.

llvm-svn: 189027
2013-08-22 15:50:02 +00:00
David Blaikie d89b99d421 DebugInfo: emit the definition of types when construction vtables are required as these types may never end up emitting the full class data
This might be able to be optimized further by only doing this in the
absence of a key function, but it doesn't look like GCC is doing that so
I'm not rushing to do it just yet.

llvm-svn: 189022
2013-08-22 15:23:05 +00:00
Daniel Jasper 8de9ed05b7 clang-format: Add column layout formatting for braced lists
With this patch, braced lists (with more than 3 elements are formatted in a
column layout if possible). E.g.:

  static const uint16_t CallerSavedRegs64Bit[] = {
    X86::RAX, X86::RDX, X86::RCX, X86::RSI, X86::RDI,
    X86::R8,  X86::R9,  X86::R10, X86::R11, 0
  };

Required other changes:
- FormatTokens can now have a special role that contains extra data and can do
  special formattings. A comma separated list is currently the only
  implementation.
- Move penalty calculation entirely into ContinuationIndenter (there was a last
  piece still in UnwrappedLineFormatter).

Review: http://llvm-reviews.chandlerc.com/D1457
llvm-svn: 189018
2013-08-22 15:00:41 +00:00
David Blaikie cf2c8b33cd DebugInfo: Remove explicit declaration-emissiong handling now that we have a more principled approach (the 'requires complete type' callback)
No functionality change intended.

llvm-svn: 189013
2013-08-22 13:36:01 +00:00
Manuel Klimek 2fdbea2819 Revert "Implement a rudimentary form of generic lambdas."
This reverts commit 606f5d7a99b11957e057e4cd1f55f931f66a42c7.

llvm-svn: 189004
2013-08-22 12:12:24 +00:00
Manuel Klimek 1559dd8a1c Revert "Remove some unused variables identified by Juergen Ributzka *I need to turn on this warning in Visual C++ - sorry!*"
This reverts commit d01d0b63d87ac465f15ce1d6b56bf3faf4525769.

llvm-svn: 189003
2013-08-22 12:12:05 +00:00
David Majnemer ee7e86c08f Typo.
llvm-svn: 188996
2013-08-22 10:04:41 +00:00
Robert Wilhelm cafda82855 const'ify Sema::ActOnCXXTryBlock by
changing Parameter from MutableArrayRef to
ArrayRef.
No functionality change intended.

llvm-svn: 188994
2013-08-22 09:20:03 +00:00
Dmitri Gribenko 56fde96610 gnu-flags.c test: relax the check a bit
This tests warning flags, so no need to test for specific alignment which is
platform-dependent.

llvm-svn: 188993
2013-08-22 08:13:43 +00:00
David Majnemer a39da8e236 Analysis: Make %I in printf more reasonable, add more tests
llvm-svn: 188992
2013-08-22 07:53:21 +00:00
Craig Topper a31a882f87 Constify more uses of ASTContext&. No functional change.
llvm-svn: 188991
2013-08-22 07:09:37 +00:00
Craig Topper c571c810bf Constify some more ASTContext& uses.
llvm-svn: 188989
2013-08-22 06:02:26 +00:00
Craig Topper e6960e2db5 Constify the ASTContext& passed to Stmt creation functions. Also constify the context in couple other functions that are called from creation functions.
llvm-svn: 188986
2013-08-22 05:28:54 +00:00
Craig Topper ce7167c84a Constify the ASTContext& passed to Expr creation functions. Also constify the context in couple other functions that are called from creation functions.
llvm-svn: 188985
2013-08-22 04:58:56 +00:00
Craig Topper 258a86802a Add test cases for avx512 feature flags. Fix typo in avx512pf options.
llvm-svn: 188984
2013-08-22 04:32:55 +00:00
Faisal Vali dbca225589 Remove some unused variables identified by Juergen Ributzka *I need to turn on this warning in Visual C++ - sorry!*
llvm-svn: 188979
2013-08-22 02:13:38 +00:00
Faisal Vali fd5277c063 Implement a rudimentary form of generic lambdas.
Specifically, the following features are not included in this commit:
  - any sort of capturing within generic lambdas 
  - nested lambdas
  - conversion operator for captureless lambdas
  - ensuring all visitors are generic lambda aware


As an example of what compiles:

template <class F1, class F2>
struct overload : F1, F2 {
    using F1::operator();
    using F2::operator();
    overload(F1 f1, F2 f2) : F1(f1), F2(f2) { }
  };

  auto Recursive = [](auto Self, auto h, auto ... rest) {
    return 1 + Self(Self, rest...);
  };
  auto Base = [](auto Self, auto h) {
      return 1;
  };
  overload<decltype(Base), decltype(Recursive)> O(Base, Recursive);
  int num_params =  O(O, 5, 3, "abc", 3.14, 'a');

Please see attached tests for more examples.

Some implementation notes:

  - Add a new Declarator context => LambdaExprParameterContext to 
    clang::Declarator to allow the use of 'auto' in declaring generic
    lambda parameters
    
  - Augment AutoType's constructor (similar to how variadic 
    template-type-parameters ala TemplateTypeParmDecl are implemented) to 
    accept an IsParameterPack to encode a generic lambda parameter pack.
  
  - Add various helpers to CXXRecordDecl to facilitate identifying
    and querying a closure class
  
  - LambdaScopeInfo (which maintains the current lambda's Sema state)
    was augmented to house the current depth of the template being
    parsed (id est the Parser calls Sema::RecordParsingTemplateParameterDepth)
    so that Sema::ActOnLambdaAutoParameter may use it to create the 
    appropriate list of corresponding TemplateTypeParmDecl for each
    auto parameter identified within the generic lambda (also stored
    within the current LambdaScopeInfo).  Additionally, 
    a TemplateParameterList data-member was added to hold the invented
    TemplateParameterList AST node which will be much more useful
    once we teach TreeTransform how to transform generic lambdas.
    
  - SemaLambda.h was added to hold some common lambda utility
    functions (this file is likely to grow ...)
    
  - Teach Sema::ActOnStartOfFunctionDef to check whether it
    is being called to instantiate a generic lambda's call
    operator, and if so, push an appropriately prepared
    LambdaScopeInfo object on the stack.
    
  - Teach Sema::ActOnStartOfLambdaDefinition to set the
    return type of a lambda without a trailing return type
    to 'auto' in C++1y mode, and teach the return type
    deduction machinery in SemaStmt.cpp to process either
    C++11 and C++14 lambda's correctly depending on the flag.    

  - various tests were added - but much more will be needed.

A greatful thanks to all reviewers including Eli Friedman,  
James Dennett and the ever illuminating Richard Smith.  And 
yet I am certain that I have allowed unidentified bugs to creep in; 
bugs, that I will do my best to slay, once identified!

Thanks!

llvm-svn: 188977
2013-08-22 01:49:11 +00:00