Commit Graph

42309 Commits

Author SHA1 Message Date
Chandler Carruth 44eb4f66f4 Re-sort #include lines using the llvm/utils/sort_includes.py script.
Removes a duplicate #include as well as cleaning up some sort order
regressions since I last ran the script over Clang.

llvm-svn: 171364
2013-01-02 10:28:36 +00:00
Daniel Jasper 22bcf8a8eb Understand * and & in ternary expressions.
Before: "int a = b ? *c : * d;"
After: "int a = b ? *c : *d;
llvm-svn: 171358
2013-01-02 08:57:10 +00:00
Daniel Jasper d1926a3758 Don't break after pointer or reference specifier.
This fixes llvm.org/PR14717.
Buggy format:
TypeSpecDecl *
    TypeSpecDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
                         IdentifierInfo *II, Type *T) {

Now changed to:
TypeSpecDecl *TypeSpecDecl::Create(ASTContext &C, DeclContext *DC,
                                   SourceLocation L, IdentifierInfo *II,
                                   Type *T) {

llvm-svn: 171357
2013-01-02 08:44:14 +00:00
Rafael Espindola 6525f96f01 Convert an if that never happens to an assert.
llvm-svn: 171354
2013-01-02 04:19:07 +00:00
Benjamin Kramer 7a14bc0f4c Simplify vector splat code. No functionality change.
llvm-svn: 171350
2013-01-01 20:08:10 +00:00
NAKAMURA Takumi 43632a26a5 Update the copyright coredits -- Happy new year 2013!
llvm-svn: 171342
2013-01-01 10:00:19 +00:00
Rafael Espindola aadd30ec52 Silence some warnings and allow passing down some feature flags to the linker.
Patch by Brad Smith.

llvm-svn: 171329
2012-12-31 22:41:36 +00:00
Nico Weber 965368743e Fix minor copy-pasto. No functionality change.
llvm-svn: 171274
2012-12-31 02:59:14 +00:00
Nico Weber a7c7e60764 Remove some remnants of OwningExprResult / OwningStmtResult.
These got deleted late 2010 during the Actions/Sema unification.
No functionality change.

llvm-svn: 171269
2012-12-31 00:28:03 +00:00
Nico Weber a48b6c2bba Simplify. No functionality change.
llvm-svn: 171268
2012-12-30 23:36:56 +00:00
Rafael Espindola ea7537f2a2 Don't warn on unused member functions that are extern because of a typedef.
llvm-svn: 171267
2012-12-30 21:42:26 +00:00
Dmitri Gribenko 58d64e2bb1 Formatter: parse and format inline namespaces like regular namespaces
This changes formatting from:

inline namespace X {
  class A {
  };
}

to:

inline namespace X {
class A {
};
}

llvm-svn: 171266
2012-12-30 21:27:25 +00:00
Will Dietz 3676d56b71 [ubsan] Recover by default, use -fno-sanitize-recover to disable.
llvm-svn: 171264
2012-12-30 20:53:28 +00:00
Rafael Espindola a5c892058c Use hasCLanguageLinkage when warning about non C return types.
llvm-svn: 171263
2012-12-30 20:40:41 +00:00
Dmitri Gribenko 10af67a9c3 Comment lexing: replace manual comparison with StringRef::find_first_of
This gives an about 1.8% improvement on Clang bootstrap with -Wdocumentation

llvm-svn: 171262
2012-12-30 19:45:46 +00:00
Rafael Espindola 5cab029e4b Don't get confused if a extern "C" builtin function is redeclared without
the extern "C".

llvm-svn: 171260
2012-12-30 17:23:09 +00:00
Bill Wendling 5e85be4326 Remove the Function::getFnAttributes method in favor of using the AttributeSet
directly.

This is in preparation for removing the use of the 'Attribute' class as a
collection of attributes. That will shift to the AttributeSet class instead.

llvm-svn: 171254
2012-12-30 10:32:17 +00:00
Rafael Espindola 9463dce9bf Don't warn for undefined but used decls that are external because of a typedef.
This fixes pr14736. It is fairly ugly, but I don't think we can do much better
as we have to wait at least until the end of the typedef to know if the
function will have external linkage or not.

llvm-svn: 171240
2012-12-29 23:43:00 +00:00
Nico Weber 9dff378a12 ArrayRefize CXXTryStmt.
llvm-svn: 171239
2012-12-29 20:13:03 +00:00
Nico Weber a2a0eb940a ArrayRefize a CompoundStmt constructor.
llvm-svn: 171238
2012-12-29 20:03:39 +00:00
Chandler Carruth 19e8beaad6 Fix a typo that caused a few standard library implementations of sort to
get the wrong answer. Wasn't caught by my implementation sadly...

llvm-svn: 171222
2012-12-29 13:00:47 +00:00
Chandler Carruth 5193dfca24 Try to re-structure the GCCVersion comparison routine to make it easier
to read and tell that it is a SWO -- we now descend through the
components and return a result at the first inequal component.

Also comment it a bit better and make it a total ordering by sorting on
the text of the suffix if necessary.

None of this should really be a visible change.

llvm-svn: 171219
2012-12-29 12:01:08 +00:00
Erik Verbruggen 3f27d4e05a Removed duplicate logic.
llvm-svn: 171218
2012-12-29 11:27:03 +00:00
Rafael Espindola db7325e56e Minor cleanup.
DS parameter  has a default (null) value anyway, so there's no need for an
if/else here.
Patch by Nikola Smiljanić.

llvm-svn: 171210
2012-12-29 01:09:46 +00:00
Rafael Espindola 576127d90e Reject overloading of two static extern C functions.
This patch moves hasCLanguageLinkage to be VarDecl and FunctionDecl methods
so that they can be used from SemaOverload.cpp and then fixes the logic
in Sema::IsOverload.

llvm-svn: 171193
2012-12-28 14:21:58 +00:00
Richard Smith 9e575dafad Replace magic numbers in CheckICE with an enum.
llvm-svn: 171192
2012-12-28 13:25:52 +00:00
Richard Smith 74fc72143a PR14729: Fix typo in CheckICE for BinaryConditionalOperators.
llvm-svn: 171191
2012-12-28 12:53:55 +00:00
Richard Smith de1a487402 Improve diagnostic wording for when an implicitly-deleted special member
function is selected by overload resolution.

llvm-svn: 171190
2012-12-28 12:23:24 +00:00
Alexey Samsonov c6515b6a41 Add proper support for -fsanitize-blacklist= flag for TSan and MSan. Clang part.
llvm-svn: 171184
2012-12-28 09:31:34 +00:00
David Blaikie bf18725d11 Change this to an IR test instead of an assembly test (as per comment in r171134).
This makes the test not dependent on LLVM & won't vary/break based on LLVM
codegen related changes. Appropriately testing at the Clang level what was
fixed at the Clang level originally (in r124210).

llvm-svn: 171175
2012-12-28 01:16:31 +00:00
Richard Smith d8f265a5b8 Simplify typeid 'potentially evaluated' check.
llvm-svn: 171162
2012-12-27 15:26:27 +00:00
Rafael Espindola cffa95d73f Implement dcl.link paragraph 5.
The language linkage of redeclarations must match. GCC was already reporting
an error for this.

llvm-svn: 171139
2012-12-27 03:56:20 +00:00
Eric Christopher a487035ca9 Update test for backend change.
TODO: This test should be moved to the backend.
llvm-svn: 171134
2012-12-27 02:20:24 +00:00
Rafael Espindola 1779760cb4 Fix a regression from the previous commit.
Template instantiation can set the canonical decl to used after subsequent
decls have been chained, so we have to check that too.

llvm-svn: 171088
2012-12-26 04:38:44 +00:00
Rafael Espindola dfa5f9b511 Use the most recent redecl to decide if it is needed.
This fixes pr14691, which I think is a regression from r168519.

llvm-svn: 171077
2012-12-26 00:13:29 +00:00
Richard Smith 940a6d73ce Produce an actual error before attempting to attach notes to it when bailing out
due to FORCE_CLANG_DIAGNOSTICS_CRASH=1. Also add a test for that env var.

llvm-svn: 171074
2012-12-25 21:56:27 +00:00
Erik Verbruggen 11a2eccc8b Fix for PR12222.
Changed getLocStart() and getLocEnd() to be required for Stmts, and make
getSourceRange() optional. The default implementation for getSourceRange()
is build the range by calling getLocStart() and getLocEnd().

llvm-svn: 171067
2012-12-25 14:51:39 +00:00
Guy Benyei f0a014bbb7 Add intel_ocl_bicc calling convention as a function attribute to clang. The calling convention is already implemented in LLVM.
llvm-svn: 171056
2012-12-25 08:53:55 +00:00
Rafael Espindola 54606d57a2 Add 171048 back but invalidate the cache of all redeclarations when setting
the body of a functions. The problem was that hasBody looks at the entire chain
and causes problems to -fvisibility-inlines-hidden if the cache was not
invalidated.

Original message:

Cache visibility of decls.

This unifies the linkage and visibility caching. I first implemented this when
working on pr13844, but the previous fixes removed the performance advantage of
this one.
This is still a step in the right direction for making linkage and visibility
cheap to use.

llvm-svn: 171053
2012-12-25 07:31:49 +00:00
NAKAMURA Takumi eb63feb5bd Revert r171048, "Cache visibility of decls."
It broke stage2.

llvm-svn: 171050
2012-12-25 04:47:44 +00:00
Rafael Espindola f92a59f0cb Cache visibility of decls.
This unifies the linkage and visibility caching. I first implemented this when
working on pr13844, but the previous fixes removed the performance advantage of
this one.

This is still a step in the right direction for making linkage and visibility
cheap to use.

llvm-svn: 171048
2012-12-25 00:39:58 +00:00
Nick Lewycky a5d914196c Simplify RUN lines. No functionality change.
llvm-svn: 171045
2012-12-24 21:45:14 +00:00
Daniel Jasper 8fbd96855c Let clang-format format itself.
Apply all formatting changes that clang-format would apply to its own source
code. All choices seem to improve readability (or at least not make it worse).
No functional changes.

llvm-svn: 171039
2012-12-24 16:51:15 +00:00
Daniel Jasper 6d822720f0 Penalize tokens with a lower parenthesis level than the start of the line.
This prevents formattings like this (assuming "parameter" doesn't fit the line):
  bool f = someFunction() && someFunctionWithParam(
      parameter) && someOtherFunction();

Here, "parameter" - the start of line 2 - has a parenthesis level of 2, but
there are subsequent tokens ("&&" and "someOtherFunction") with a lower level.
This is bad for readability as "parameter" hides "someOtherFunction". With this
patch, this changes to:
  bool f = someFunction() &&
           someFunctionWithParam(parameter) &&
           someOtherFunction();

llvm-svn: 171038
2012-12-24 16:43:00 +00:00
Daniel Jasper 2eda23e78a Align RHS after assignments and return statements.
This changes:
  int Result = a +  // force break
      b;
  return Result +  // force break
      5;

To:
  int Result = a +  // force break
               b;
  return Result +  // force break
         5;

llvm-svn: 171032
2012-12-24 13:43:52 +00:00
Daniel Jasper 537a29638d Fix formatting over overloaded operators.
This fixes llvm.org/pr14686.

We used to add too many spaces for different versions of overloaded operator
function declarations/definitions. This patch changes, e.g.

  operator *() {}
  operator >() {}
  operator () () {}

to

  operator*() {}
  operator>() {}
  operator()() {}

llvm-svn: 171028
2012-12-24 10:56:04 +00:00
Evgeniy Stepanov ad8ab3d9ea Support -fsanitize-memory-track-origins.
llvm-svn: 171020
2012-12-24 08:42:34 +00:00
NAKAMURA Takumi cc80b551bf CGClass.cpp: [PR14335] Remove comma-separated \param, for now. [-Wdocumentation]
/// \param argBegin,argEnd the arguments to evaluate and pass to the constructor

llvm-svn: 171015
2012-12-24 02:03:30 +00:00
NAKAMURA Takumi 5fe61c6952 clang/AST/VTTBuilder.h: Prune one description in three methods, VTTBuilder::AddVTablePointer(), VTTBuilder::LayoutSecondaryVirtualPointers(), and VTTBuilder::LayoutSecondaryVirtualPointers(). [-Wdocumentation]
/// \param AddressPoints - If the vtable is a construction vtable, this has the address points for it.

llvm-svn: 171014
2012-12-24 01:49:04 +00:00
NAKAMURA Takumi 320c1f8806 CGDecl.cpp: Prune three descriptions in two methods, CodeGenFunction::pushIrregularPartialArrayCleanup() and CodeGenFunction::pushRegularPartialArrayCleanup(). [-Wdocumentation]
/// \param array - a value of type elementType*
/// \param destructionKind - the kind of destruction required
/// \param initializedElementCount - a value of type size_t* holding the number of successfully-constructed elements

llvm-svn: 171013
2012-12-24 01:48:59 +00:00