Commit Graph

50073 Commits

Author SHA1 Message Date
Alp Toker 6d35eab5a6 Rename getTokenSimpleSpelling() to getPunctuatorSpelling()
That's what it does, what the documentation says it does and what callers
expect it to do.

llvm-svn: 198603
2014-01-06 12:54:07 +00:00
Alp Toker b9fa512954 Highlight the previous underlying enum type when diagnosing a mismatch
enum-scoped.cpp:93:6: error: enumeration redeclared with different underlying type 'short' (was 'int')
  enum Redeclare6 : short;
       ^
enum-scoped.cpp:92:6: note: previous declaration is here
  enum Redeclare6 : int;
       ^            ~~~

The redeclaration source range is still missing but this is a step forward,
potentially edging towards a FixIt.

llvm-svn: 198601
2014-01-06 11:31:18 +00:00
Alp Toker 8c44db50d6 Diagnose enum redeclarations properly
In all three checks, the note indicates a previous declaration and never a 'use'.

Before:

  enum-scoped.cpp:92:6: note: previous use is here
    enum Redeclare6 : int;
         ^

After:

  enum-scoped.cpp:92:6: note: previous declaration is here
    enum Redeclare6 : int;
         ^

llvm-svn: 198600
2014-01-06 11:31:06 +00:00
Alp Toker 6e97a69200 Use token kind instead of '%select{.|->}0' in diagnostic
llvm-svn: 198599
2014-01-06 11:30:41 +00:00
Alp Toker 637b347ed0 Apply some LLVM_READONLY / LLVM_READNONE on diagnostic functions
llvm-svn: 198598
2014-01-06 11:30:15 +00:00
Joey Gouly 16cb99dd15 [OpenCL] Produce an error if an address space is used on the return
type of a function.

llvm-svn: 198597
2014-01-06 11:26:18 +00:00
Aaron Ballman 0e468c02bc This helper method isn't needed, and it's unsafe for it to use StringRef in the first place. Replaced the unsafe code with the proper accessor.
llvm-svn: 198569
2014-01-05 21:08:29 +00:00
Daniel Jasper 1a148b4922 clang-format: Spacing inside enum braces.
Before (in Google style):
  enum ShortEnum {A, B, C};

After:
  enum ShortEnum { A, B, C };

llvm-svn: 198559
2014-01-05 13:23:23 +00:00
Daniel Jasper 9697281eec clang-format: Allow formatting short enums on a single line.
Before:
  enum ShortEnum {
    A,
    B,
    C
  };

After:
  enum ShortEnum { A, B, C };

This seems to be the predominant choice in LLVM/Clang as well as in
Google style.

llvm-svn: 198558
2014-01-05 12:38:10 +00:00
Alp Toker 8db6e7a972 Fix 'declartion' typos
llvm-svn: 198549
2014-01-05 06:38:57 +00:00
Alp Toker ab1b1dcea7 Pre-declare '::type_info' in MicrosoftMode only, not MicrosoftExt
It was previously enabled in both but should only have been part of the drop-in
quirks mode that is 'MicrosoftMode' given that it's only useful for
compatibility with the Microsoft headers/runtime.

llvm-svn: 198548
2014-01-05 06:38:18 +00:00
Alp Toker c090ae763a Tweak the parse recovery in r198540
Cover a hypothetical case when we might not have reached the final argument
declaration for some reason during recovery, and split out for readability.

llvm-svn: 198542
2014-01-05 04:17:27 +00:00
Alp Toker eec8101b9b Fix bungled parse recovery in K&R function declarations
void knrNoSemi(i) int i { }

Adherents of The C Programming Language unfortunate enough to miss a semicolon
as above would be met with a cascade of errors spanning the remainder of the
TU.

This patch introduces a beautiful parse error recovery, complete with helpful
FixIt to restore sanity.

Before (output redacted for brevity):

  error: 'error' diagnostics seen but not expected:
    File declarators.c Line 119: declaration does not declare a parameter
    File declarators.c Line 123: declaration does not declare a parameter
    File declarators.c Line 127: parameter named 'func_E12' is missing
    File declarators.c Line 127: expected ';' at end of declaration
    File declarators.c Line 133: parameter named 'func_E13' is missing
    File declarators.c Line 133: expected ';' at end of declaration
    File declarators.c Line 139: parameter named 'func_E14' is missing
    File declarators.c Line 139: expected ';' at end of declaration
    File declarators.c Line 145: parameter named 'func_E15' is missing
    File declarators.c Line 145: expected ';' at end of declaration
    File declarators.c Line 150: expected function body after function declarator
    File declarators.c Line 119: declaration of 'enum E11' will not be visible outside of this function
    File declarators.c Line 123: declaration of 'enum E12' will not be visible outside of this function
    File declarators.c Line 133: ISO C forbids forward references to 'enum' types
    File declarators.c Line 133: declaration of 'enum E13' will not be visible outside of this function
    File declarators.c Line 139: ISO C forbids forward references to 'enum' types
    File declarators.c Line 139: declaration of 'enum E14' will not be visible outside of this function
    File declarators.c Line 145: ISO C forbids forward references to 'enum' types
    File declarators.c Line 145: declaration of 'enum E15' will not be visible outside of this function
    ...

After:

  declarators.c:103:24: error: expected ';' at end of declaration
  void knrNoSemi(i) int i { }
                         ^
                         ;

Patch found in a sealed envelope dated 1978 with the message "Do not open until
January 2014"

llvm-svn: 198540
2014-01-05 03:27:57 +00:00
Alp Toker 094e521e3f Parse: Token consumption modernization and loop de-nesting
Cleanup only.

llvm-svn: 198539
2014-01-05 03:27:11 +00:00
Alp Toker 59226f7811 Revert "ToolingTest.cpp: Fix r158592, runToolOnCode.FindsNoTopLevelDeclOnEmptyCode on msvc. LangOpts.MicrosoftExt still appends "class type_info;"."
type_info has been made an implicitly predeclared type in r198497 and will no
longer appear as a user-declared type so we can remove this old hack.

This reverts commit r158595.

llvm-svn: 198502
2014-01-04 15:58:28 +00:00
Alp Toker e1fab52688 Move MS predefined type_info out of InitializePredefinedMacros
Instead of keeping it in amongst the macros, build the declaration at Sema init
the same way we do with other predeclared and builtin types.

In practice this means the declaration is marked implicit and therefore won't
show up as an unwanted user-declared type in tooling which has been a
frequently reported issue (though I haven't been able to cook up a test).

llvm-svn: 198497
2014-01-04 15:25:02 +00:00
Alp Toker ef6b007dc5 Only mark dump() function definitions 'used' in debug builds
This has the dual effect of (1) enabling more dead-stripping in release builds
and (2) ensuring that debug helper functions aren't stripped away in debug
builds, as they're intended to be called from the debugger.

Note that the attribute is applied to definitions rather than declarations in
headers going forward because it's now conditional on NDEBUG:

  /// \brief Mark debug helper function definitions like dump() that should not be
  /// stripped from debug builds.

Requires corresponding macro added in LLVM r198456.

llvm-svn: 198489
2014-01-04 13:47:14 +00:00
Argyrios Kyrtzidis d03fc4d4e1 Add an additional check in test/Sema/ext_vector_casts.c
llvm-svn: 198479
2014-01-04 06:27:45 +00:00
Ted Kremenek 776409286b [analyzer] Remove IdempotentOperations checker.
This checker has not been updated to work with interprocedural analysis,
and actually contains both logical correctness issues but also
memory bugs.  We can resuscitate it from version control once there
is focused interest in making it a real viable checker again.

llvm-svn: 198476
2014-01-04 05:52:11 +00:00
Argyrios Kyrtzidis eb68f6a9de [Sema] When checking if a bitcast is appropriate between vector types, take into
consideration the num-of-elements*width-of-element width.

Disallow casts when such width is not equal between the vector types otherwise
we may end up with an invalid LLVM bitcast.

rdar://15722308.

llvm-svn: 198474
2014-01-04 03:31:22 +00:00
Richard Trieu 658eb68e82 Ignore qualified templated functions for -Winfinite-recursion. This treats
functions like Foo<5>::run() the same way as run<5>() for this warning.

llvm-svn: 198470
2014-01-04 01:57:42 +00:00
Reid Kleckner 5f08094106 [ms-cxxabi] Improve vbtable name mangling accuracy
Summary:
This makes us more compatible with MSVC 2012+ and fixes PR17748 where we
would give two tables the same name.

Rather than doing a fresh depth-first traversal of the inheritance graph
for every record's vbtables, now we memoize vbtable paths for each
record.  By doing memoization, we end up considering virtual bases of
subobjects that come later in the depth-first traversal.  Where
previously we would have ignored a virtual base that we'd already seen,
we now consider it for name mangling purposes without emitting a
duplicate vbtable for it.

Reviewers: majnemer

CC: cfe-commits

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

llvm-svn: 198462
2014-01-03 23:42:00 +00:00
Adrian Prantl 96e70d9148 Debug info: Ensure that the last stop point in a function is still within
the lexical block formed by the compound statement that is the function
body.

rdar://problem/15010825

llvm-svn: 198461
2014-01-03 23:34:30 +00:00
Aaron Ballman 69714e78e0 Refactored Builtin::Context::isPrintfLike and isScanfLike into a helper function. The implementations are identical, except for the format arguments being searched for.
No functional changes intended.

llvm-svn: 198446
2014-01-03 20:10:54 +00:00
Argyrios Kyrtzidis 98045c1a23 Fix 80 col violation.
llvm-svn: 198444
2014-01-03 19:53:09 +00:00
Argyrios Kyrtzidis d8a35325a2 Pass the decl directly to the diagnostic, no need to call getDeclName().
llvm-svn: 198442
2014-01-03 19:39:23 +00:00
Aaron Ballman 68af21c975 Fixing a FIXME; the RetTy template parameter is always bool in practice, and so it has been removed. No functional changes intended.
llvm-svn: 198440
2014-01-03 19:26:43 +00:00
Rafael Espindola c418ae93a8 Update for llvm's DataLayout including mangling information.
llvm-svn: 198439
2014-01-03 19:22:05 +00:00
Aaron Ballman 1d17bde708 Marked the default constructor as an LLVM_DELETED_FUNCTION.
llvm-svn: 198435
2014-01-03 18:51:47 +00:00
Aaron Ballman 75ee4cc830 Removed one of the string versions of getQualifiedNameAsString, and switched over to using printQualifiedName where possible. No functional changes intended.
llvm-svn: 198433
2014-01-03 18:42:48 +00:00
Argyrios Kyrtzidis 2080d90f37 [objc] Refactor and improve functionality for the -Wunused-property-ivar warning.
- Remove the additions to ObjCMethodDecl & ObjCIVarDecl that were getting de/serialized and consolidate
  all functionality for the checking for this warning in Sema::DiagnoseUnusedBackingIvarInAccessor
- Don't check immediately after the method body is finished, check when the @implementation is finished.
  This is so we can see if the ivar was referenced by any other method, even if the method was defined after the accessor.
- Don't silence the warning if any method is called from the accessor silence it if the accessor delegates to another method via self.

rdar://15727325

llvm-svn: 198432
2014-01-03 18:32:18 +00:00
Rafael Espindola 29db13a753 Reformat the description strings. No functionality change.
llvm-svn: 198430
2014-01-03 18:13:17 +00:00
Aaron Ballman 7cb6741b3b We haven't cared about VS 2005 in a long time, and VS 2003 in even longer.
llvm-svn: 198429
2014-01-03 18:10:25 +00:00
Aaron Ballman b190f974c9 Fixed a FIXME; created a print method for Selectors that accepts a raw_ostream, and started using it in places it made sense.
No functional changes intended, just API cleanliness.

llvm-svn: 198428
2014-01-03 17:59:55 +00:00
Alexander Kornienko 6de39492da Make clang::ento::CreateAnalysisConsumer a part of a public interface of the static analyzer.
Summary:
This allows for a better alternative to the FrontendAction hack used in
clang-tidy in order to get static analyzer's ASTConsumer.

Reviewers: jordan_rose, krememek

Reviewed By: jordan_rose

CC: cfe-commits

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

llvm-svn: 198426
2014-01-03 17:23:10 +00:00
Aaron Ballman 2cfbc00506 Simplifying the mutual exclusion check now that the diagnostics engine knows how to handle Attr objects directly. Updates an associated test case due to the attribute name being properly quoted again.
llvm-svn: 198424
2014-01-03 16:23:46 +00:00
Joey Gouly b6eb314c3a [OpenCL] Add test case for previous commit.
llvm-svn: 198422
2014-01-03 15:11:57 +00:00
Aaron Ballman d1e6e141c1 Using the proper helper function instead of manually doing this work. No functional changes intended.
llvm-svn: 198421
2014-01-03 15:02:58 +00:00
Aaron Ballman b9bb201194 Removing some more unnecessary manual quotes from diagnostics.
llvm-svn: 198420
2014-01-03 14:54:10 +00:00
Aaron Ballman 691e2274f6 Removing an unneeded typecast. getScopeRep() already returns a NestedNameSpecifier.
llvm-svn: 198419
2014-01-03 14:48:20 +00:00
Aaron Ballman 1fb3955cee Removing some more unnecessary manual quotes from diagnostics.
llvm-svn: 198418
2014-01-03 14:23:03 +00:00
Joey Gouly 96b94e610b [OpenCL] Variables in the constant address space must be initialized.
llvm-svn: 198417
2014-01-03 14:16:55 +00:00
Aaron Ballman 5dff61d322 Removing some more unnecessary manual quotes from diagnostics.
llvm-svn: 198416
2014-01-03 14:06:37 +00:00
Aaron Ballman 4a97967b5f It turns out the problem was a bit more wide-spread. Removing a lot of unneeded typecasts. getScopeRep() already returns a NestedNameSpecifier.
No functional changes intended.

llvm-svn: 198414
2014-01-03 13:56:08 +00:00
Aaron Ballman 5fe6c805dc Removing an unneeded typecast. getScopeRep() already returns a NestedNameSpecifier.
llvm-svn: 198413
2014-01-03 13:45:46 +00:00
Aaron Ballman fee0cd45fe Removing some more unnecessary manual quotes from diagnostics. Updated the related test case to ensure correctness.
llvm-svn: 198412
2014-01-03 13:34:55 +00:00
Daniel Jasper 352dae199a clang-format: Recognize single-line macro usages inside macros.
Before:
  #define LIST(L)                                                     \
    L(FirstElement) L(SecondElement) L(ThirdElement) L(FourthElement) \
        L(FifthElement)

After:
  #define LIST(L)    \
    L(FirstElement)  \
    L(SecondElement) \
    L(ThirdElement)  \
    L(FourthElement) \
    L(FifthElement)

llvm-svn: 198407
2014-01-03 11:50:46 +00:00
Aaron Ballman 6d086d7dc1 Removing some more unnecessary manual quotes from diagnostics.
llvm-svn: 198395
2014-01-03 02:20:27 +00:00
Aaron Ballman 25dc1e1d19 Removing some more unnecessary manual quotes from attribute diagnostics.
llvm-svn: 198392
2014-01-03 02:14:08 +00:00
Aaron Ballman c0550740f0 Removing some more unnecessary manual quotes from attribute diagnostics.
llvm-svn: 198391
2014-01-03 02:07:43 +00:00
Ted Kremenek 9b12e72376 [analyzer] Don't track return value of NSNull +null for retain/release tracking.
Fixes <rdar://problem/12858915>.

llvm-svn: 198388
2014-01-03 01:19:28 +00:00
Aaron Ballman 1bda4596b6 Removing some more unnecessary manual quotes from attribute diagnostics.
llvm-svn: 198387
2014-01-03 01:09:27 +00:00
Reid Kleckner b0c246e25e Remove unused variable to fix clang warning
llvm-svn: 198382
2014-01-03 00:36:32 +00:00
Reid Kleckner b40a27dad8 [ms-cxxabi] Move VBTableBuilder from CodeGen over to AST/VTableBuilder.cpp
Summary:
No functionality change.

This code should live here long-term because we should be able to use it
to compute correct vftable names.

It turns out that the most natural way to implement the naming algorithm
is to use a caching layer similar to what we already have for virtual
table info in VTableContext.  Subsequent changes will take advantage of
this to fix PR17748, where we have a vbtable name collision.

Reviewers: majnemer

CC: cfe-commits

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

llvm-svn: 198380
2014-01-03 00:14:35 +00:00
Aaron Ballman 3d216a579c Removed an unnecessary %select from the alignas diagnostics. The attribute already knows how it was spelled.
llvm-svn: 198375
2014-01-02 23:39:11 +00:00
Aaron Ballman e2bb78a740 This diagnostic should not have had the manual quotation marks. Its only usage passed in an Attr object, which was already quoted when printing the diagnostic. However, there was no test case that caught this bug -- one has been added.
llvm-svn: 198373
2014-01-02 23:22:40 +00:00
Aaron Ballman 1da282ae2d Removing some more unnecessary manual quotes from attribute diagnostics. Updated the associated testcase because QualType pretty printing was an improvement.
llvm-svn: 198372
2014-01-02 23:15:58 +00:00
Aaron Ballman 9f6fec4419 Removing some more unnecessary manual quotes from attribute diagnostics.
llvm-svn: 198371
2014-01-02 23:02:01 +00:00
Aaron Ballman 34b3475cd3 Reworded the NSObject attribute diagnostics to be more consistent with other attribute diagnostics. Also updated the associated test case.
llvm-svn: 198368
2014-01-02 22:45:33 +00:00
Fariborz Jahanian 5b3105d2cb ObjectiveC. Remove false positive warning for missing property
backing ivar by not issuing this warning if ivar is referenced
somewhere and accessor makes method calls. // rdar://15727325

llvm-svn: 198367
2014-01-02 22:42:09 +00:00
Aaron Ballman 44ebc079b9 Removing some manual quotes from this diagnostic, since the AST diagnostics engine knows how to handle NamedDecl objects.
llvm-svn: 198365
2014-01-02 22:29:41 +00:00
Aaron Ballman 05e420abad Updated the wording of two attribute-related diagnostics so that they print the offending attribute name. Also updates the associated test cases.
llvm-svn: 198355
2014-01-02 21:26:14 +00:00
Douglas Gregor 6beabeed39 Objective-C ARC++: Prefer references to __strong/__weak over __unsafe_unretained.
Fixes <rdar://problem/15713945>.

llvm-svn: 198343
2014-01-02 19:42:02 +00:00
Douglas Gregor d1b760a670 CMake separate projects: finish output-directory changes.
Make sure clang-tblgen, clang++, and clang-cl get created in the Clang
binary build directory.

llvm-svn: 198331
2014-01-02 18:37:47 +00:00
Jordan Rose 4e754085ce [CMake] Add missing set_output_directory after Takumi's change in r198205.
In a standalone build, Clang binaries should end up in Clang's build folder,
not LLVM's.

Xcode still has a few issues finding auxiliary tools and libraries in the
build folders. I'll fix those next.

llvm-svn: 198328
2014-01-02 18:28:32 +00:00
Aaron Ballman 6d80b3c15d Using the quoted version of an attribute name for consistency with other attribute diagnostics.
llvm-svn: 198326
2014-01-02 18:10:17 +00:00
Fariborz Jahanian 1cc7ae1d08 ObjectiveC. Class methods must be ignored when looking for
property accessor's missing backing ivar. This eliminates
the bogus warning being issued. // rdar://15728901

llvm-svn: 198322
2014-01-02 17:24:32 +00:00
Roman Divacky 8dc15806d7 Add test for r198311.
llvm-svn: 198321
2014-01-02 17:18:03 +00:00
Douglas Gregor 092bad1a39 CMake: Unbreak separated LLVM/Clang project builds for Xcode.
The separate Xcode project generated for Clang is putting the clang
executables into the same location where the LLVM executables are
going. This is wrong, and breaks the Clang build because we try to
create clang++ and clang-cl symlinks in the wrong place and to the
wrong place.

As a stop-gap to get these builds working again, teach the symlink
generation to point into the LLVM executable directory instead.

llvm-svn: 198319
2014-01-02 17:11:02 +00:00
Roman Divacky feb5e63e5c Remove a tab that snuck in.
llvm-svn: 198312
2014-01-02 15:34:59 +00:00
Roman Divacky 47f4ff8778 In the FreeBSD assembler driver, inform the sparc assembler that we're producing
PIC code.

llvm-svn: 198311
2014-01-02 15:13:18 +00:00
Alexander Kornienko ce9161a557 Added an option to avoid splitting certain kinds of comments into lines.
Summary: Added CommentPragmas option for this.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits, klimek

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

llvm-svn: 198310
2014-01-02 15:13:14 +00:00
Alp Toker e83b9060cb Verify that clang TargetInfo descriptions match DataLayout strings from LLVM
The backend string is only verified when available as it's possible to run
clang IRGen for targets that haven't been built or don't exist in LLVM.

llvm-svn: 198309
2014-01-02 15:08:04 +00:00
Rafael Espindola 961728064e Remove the now unused 's' specifications.
llvm-svn: 198308
2014-01-02 14:06:59 +00:00
Rafael Espindola d8da90b008 Pass the aapcs and apcs features down to llvm.
No functionality change, but unblocks asserting that llvm's and clang's
datalayout strings are the same.

llvm-svn: 198306
2014-01-02 13:57:18 +00:00
Joey Gouly d4993032a9 [OpenCL] The kernel attribute can only be used on functions.
llvm-svn: 198300
2014-01-02 12:04:42 +00:00
NAKAMURA Takumi d40d387fb1 Update the copyright credits -- Happy new year 2014!
FIXME: Dragonegg may be updated at non-trivial changes.
llvm-svn: 198274
2014-01-01 08:27:31 +00:00
Alp Toker 3ca9c86825 Remove an unused diag left over from r198046
llvm-svn: 198272
2014-01-01 06:07:48 +00:00
Alp Toker 95e7ff2ed1 Eliminate UnaryTypeTraitExpr
Remove UnaryTypeTraitExpr and switch all remaining type trait related handling
over to TypeTraitExpr.

The UTT/BTT/TT enum prefix and evaluation code is retained pending further
cleanup.

This is part of the ongoing work to unify type traits following the removal of
BinaryTypeTraitExpr in r197273.

llvm-svn: 198271
2014-01-01 05:57:51 +00:00
Alp Toker 383d2c478c ExpectAndConsume: Diagnose errors automatically
1) Teach ExpectAndConsume() to emit expected and expected-after diagnostics
    using the generic diagnostic descriptions added in r197972, eliminating another
    set of trivial err_expected_* variations while maintaining existing behaviour.

 2) Lift SkipUntil() recovery out of ExpectAndConsume(). The Expect/Consume
    family of functions are primitive parser operations that now have the
    well-defined property of operating on single tokens. Factoring out recovery
    exposes opportunities for more consistent and tailored error recover at the
    call sites instead of just relying on a bottled SkipUntil formula.

llvm-svn: 198270
2014-01-01 03:08:43 +00:00
Joey Gouly 4ba0f1e2d7 [OpenCL] Produce an error, instead of a warning, for sizeof(void) in OpenCL.
Patch by joey.gouly@arm.com

llvm-svn: 198264
2013-12-31 15:47:49 +00:00
Serge Pavlov 2e3ecb660a Recover from errors in enum definition
Previously any error in enum definition body stopped parsing it. With this
change parser tries to recover from errors.
The patch fixes PR10982.

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

llvm-svn: 198259
2013-12-31 06:26:03 +00:00
Alp Toker fceca50357 Silence g++ 4.9 build issue
lib/ASTMatchers/ASTMatchFinder.cpp:276:28: error: typedef 'traverse_can_only_be_instantiated_with_base_type' locally defined but not used [-Werror=unused-local-typedefs]
                            traverse_can_only_be_instantiated_with_base_type);

llvm-svn: 198256
2013-12-31 03:16:57 +00:00
Alp Toker 35d8703dbe Switch over more of the parser to err_expected
Includes a fix for a missing highlight range caused by a ',' typo in the PP
diagnostics.

llvm-svn: 198252
2013-12-30 23:29:50 +00:00
DeLesley Hutchins bb79c338ed Update DataRecursiveASTVisitor so that it visits attributes.
llvm-svn: 198249
2013-12-30 21:03:02 +00:00
Nick Lewycky 00b9b695c4 Fix two typos in comments. No functionality change.
llvm-svn: 198243
2013-12-30 20:16:30 +00:00
Reid Kleckner 9e3bc72b8d Remove linkage macro from the CXLanguageKind enum
Enums don't have linkage, so clang warns when this expands to dllimport.

llvm-svn: 198227
2013-12-30 17:48:49 +00:00
DeLesley Hutchins c4a82438a7 Update RecursiveASTVisitor so that it visits attributes. This is currently
important for thread safety attributes, which contain expressions that were
not being visited, and were thus invisible to various tools.  There are now
Visit*Attr methods that can be overridden for every attribute.

llvm-svn: 198224
2013-12-30 17:24:36 +00:00
Alexander Kornienko d6bd74742b Changed the test to avoid EXPECT_EQ(false, ...), which leads to
-Wconversion-null warning in GCC.

llvm-svn: 198214
2013-12-30 16:11:28 +00:00
NAKAMURA Takumi baa9f533fe [CMake][VS][XCode] Restruct the output directory layout more comfortable, ${BINARY_DIR}/${BUILD_MODE}/(bin|lib)
We have been seeing nasty directory layout with CMake multiconfig, such as,
  bin/Release/clang.exe
  lib/clang/3.x/...
  lib/Release/clang/3.x/.. (duplicated)

Move the layout similar to autoconf's;
  Release/bin/clang.exe
  Release/lib/clang/3.x/...

Checked on Visual Studio 10. Could you guys please confirm my change on XCode(and other multiconfig builders)?

Note: Don't set variables CMAKE_*_OUTPUT_DIRECTORY any more, or a certain builder, for eaxample, msbuild.exe, would be confused.
llvm-svn: 198205
2013-12-30 06:48:30 +00:00
Nico Weber 194c009352 Port r198088 (set NO_DEAD_STRIP for clang) from make to cmake.
Also stop setting passing -dead_strip explicitly for libclang and instead
rely on this now happening by default. (And make it happen by default for
add_clang_library, which doesn't use the library cmake functions from llvm.)

llvm-svn: 198200
2013-12-30 03:43:30 +00:00
Jiangning Liu 94b0f0278e For AArch64 Neon, simplify scalar dup by lane0 for fp.
llvm-svn: 198195
2013-12-30 02:45:09 +00:00
Alp Toker ba5b4dc60c Fix and reword some typos
llvm-svn: 198191
2013-12-30 02:06:29 +00:00
Alp Toker 751d635a2a Cleanup: Switch the preprocessor to err_pp_expected_after
This is approaching consistency but the PP and Parse categories they still have
slightly different wording:

def err_pp_expected_after : Error<"missing %1 after %0">;
def err_expected_after   : Error<"expected %1 after %0">;

llvm-svn: 198189
2013-12-30 01:59:29 +00:00
Nico Weber c45921903f Don't use PrintFunctionNames.exports on Windows.
llvm-svn: 198187
2013-12-30 00:05:56 +00:00
Nico Weber e8ef46c851 Fix typo in comment.
llvm-svn: 198186
2013-12-29 23:15:01 +00:00
Nico Weber 216436c77a [cmake] Set in LLVM_EXPORTED_SYMBOL_FILE PrintFunctionNames/CMakeLists.txt.
The corresponding Makefile sets it too. Also tweak add_clang_library to support
LLVM_EXPORTED_SYMBOL_FILE for modules.

llvm-svn: 198185
2013-12-29 23:14:26 +00:00
Nico Weber 5f676dc53a Use LLVM_EXPORTED_SYMBOL_FILE in libclang's cmake build.
Now the exports file should have an effect on non-darwin too.

llvm-svn: 198176
2013-12-29 19:31:48 +00:00
Aaron Ballman 2ef6a435f4 Fixing a compile error that recently started happening for me in MSVC 2013. CFGTerminator has an explicit conversion to bool operator that we can make use of instead of using == 0.
llvm-svn: 198175
2013-12-29 18:59:54 +00:00
Alp Toker 8214bf5eef Briefly document diag-build.sh
It may be a quick and dirty script but it's still useful to have some
indication as to its purpose.

Text taken straight from Jordan's r158682 commit message.

llvm-svn: 198128
2013-12-28 21:59:11 +00:00
Alp Toker a724cff01b Rename isBuiltinCall() to getBuiltinCallee()
This better describes what the function does.

Cleanup only.

llvm-svn: 198127
2013-12-28 21:59:02 +00:00
Alp Toker 82862258e3 Tidy up CGCXXABI creation
'create' functions conventionally return a pointer, not a reference.

Also use an OwningPtr to get replace the delete of a reference member.

No functional change.

llvm-svn: 198126
2013-12-28 21:58:40 +00:00
Bob Wilson 9914a02114 Propagate "-arch x86_64h" setting to the linker. <rdar://problem/15711488>
This is a follow-up to r194907, which added a new -arch setting to make it
easier to specify AVX2 targets. The "-arch x86_64h" option needs to be passed
on to the linker, but it was getting canonicalized to x86_64 by the code
in getArchTypeForDarwinArchName.

llvm-svn: 198096
2013-12-28 05:26:14 +00:00
Chandler Carruth 2588aa7454 Silence a dubious GCC warning about a set but unused global. Indeed, the
purpose of this global is to be set and not used. =]

llvm-svn: 198094
2013-12-28 02:50:00 +00:00
Nico Weber 90a173750d Set NO_DEAD_STRIP for clang after llvm r198087.
llvm-svn: 198088
2013-12-27 22:39:28 +00:00
Reid Kleckner 52b10afb08 Move MS header search test inputs to Inputs/
llvm-svn: 198086
2013-12-27 20:41:49 +00:00
Reid Kleckner 31a9f74c1d Reduce indentation of some VFTableBuilder code.
No functionality change.

llvm-svn: 198085
2013-12-27 20:29:16 +00:00
Will Wilson ba2f146c87 Silence compile warning by removing unused SourceMgr member
llvm-svn: 198083
2013-12-27 20:02:27 +00:00
Will Wilson 0fafd34a6e Implement MSVC header search algorithm in MicrosoftMode.
Follows algorithm described here: http://msdn.microsoft.com/en-us/library/36k2cdd4.aspx

llvm-svn: 198082
2013-12-27 19:46:16 +00:00
Reid Kleckner 558cab2f49 Fix incorrect copy-pasted method decl that MSVC allowed.
llvm-svn: 198081
2013-12-27 19:45:53 +00:00
Reid Kleckner 604c8b45e4 [ms-cxxabi] Emit fewer trivial return adjusting thunks
Most importantly, this makes our vtable layout match MSVC's.  Previously
we would emit a return adjusting thunk whenever the return types
differed, even if the adjustment would have been trivial.

MSVC does emit some trivial return adjusting thunks, but only if there
was already an overridden method that required a return adjustment.

llvm-svn: 198080
2013-12-27 19:43:59 +00:00
Aaron Ballman e683bd7d7e In an effort to reduce the likelihood of text getting out of sync, reusing the text from some diagnostics explicitly. No functional changes intended.
llvm-svn: 198078
2013-12-27 19:08:57 +00:00
Aaron Ballman 2dfb03f362 Removed a string literal for a diagnostic, and updated the diagnostic to not manually quote. No functional changes intended.
llvm-svn: 198076
2013-12-27 16:30:46 +00:00
Kostya Serebryany ce2c726e99 Bury leaked pointers in a global array to silence a leak detector in --disable-free mode
Summary:
This is an alternative to http://llvm-reviews.chandlerc.com/D2475
suggested by Chandler.

Reviewers: chandlerc, rnk, dblaikie

CC: cfe-commits, earthdok

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

llvm-svn: 198073
2013-12-27 08:11:08 +00:00
Daniel Jasper 126153ab87 clang-format: Break default arguments less eagerly.
Before:
  void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaa =
                                              1);

After:
  void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
      int aaaaaaaaaaaaaaaaaaaaaaaaaaaa = 1);

llvm-svn: 198070
2013-12-27 06:39:56 +00:00
Nico Weber 0e6daefe8f Warn on mismatched parentheses in memcmp and friends.
Thisadds a new warning that warns on code like this:

  if (memcmp(a, b, sizeof(a) != 0))

The warning looks like:

test4.cc:5:30: warning: size argument in 'memcmp' call is a comparison [-Wmemsize-comparison]
  if (memcmp(a, b, sizeof(a) != 0))
                   ~~~~~~~~~~^~~~
test4.cc:5:7: note: did you mean to compare the result of 'memcmp' instead?
  if (memcmp(a, b, sizeof(a) != 0))
      ^                          ~
                            )
test4.cc:5:20: note: explicitly cast the argument to size_t to silence this warning
  if (memcmp(a, b, sizeof(a) != 0))
                   ^
                   (size_t)(     )
1 warning generated.

This found 2 bugs in chromium and has 0 false positives on both chromium and
llvm.

The idea of triggering this warning on a binop in the size argument is due to
rnk.

llvm-svn: 198063
2013-12-26 23:38:39 +00:00
Warren Hunt 63701d2533 [ms-abi] unix-line endings in lit test, no functional change
llvm-svn: 198060
2013-12-26 22:10:14 +00:00
Warren Hunt 50de3522e6 [ms-abi] Fixes improperly sized vfptrs with pragma pack
With pragma pack, the layout engine would produce vfptrs that were 
packed width rather than pointer width.  This patch addresses the issue 
and adds a test case.

llvm-svn: 198059
2013-12-26 22:09:12 +00:00
Aaron Ballman 3e424b5070 Teach the diagnostics engine about the Attr type to make reporting on semantic attributes easier (and not require hard-coded strings). This requires a getSpelling() function on the Attr class, which is table-driven. Updates a handful of cases where a hard-coded string was being used to test the functionality out. Updating associated test cases for the improved quoting.
llvm-svn: 198055
2013-12-26 18:30:57 +00:00
Aaron Ballman 88fe322053 Removed a string literal for an attribute name, which means the attribute name will be quoted in the diagnostic. Manually added some quotes to a diagnostic for consistency. Updated the test cases as appropriate.
llvm-svn: 198054
2013-12-26 17:30:44 +00:00
Aaron Ballman cedaaea691 This diagnostic did not accept arguments, and did not have any test coverage. Parameterized the diagnostic, and made it more consistent with other attribute diagnostic wordings. Added test coverage.
Since this warning was generalized, it was also given a sensible warning group flag and the corresponding test was updated to reflect this.

llvm-svn: 198053
2013-12-26 17:07:49 +00:00
Aaron Ballman 213cf41a58 s/getter_setter/accessor No functional changes intended.
Thanks to Alp Toker for the naming suggestion!

llvm-svn: 198052
2013-12-26 16:35:04 +00:00
Aaron Ballman faed0fa3d7 Simplifying some diagnostics so that they don't need to work with StringRefs. No functional changes intended.
llvm-svn: 198051
2013-12-26 16:30:30 +00:00
Aaron Ballman 190bad459c Getting rid of a string literal in favor of the generalized diagnostic.
llvm-svn: 198050
2013-12-26 16:13:50 +00:00
Aaron Ballman 9e35bfe3f1 Parameterizing some MS property-related diagnostics. No functional changes intended.
llvm-svn: 198049
2013-12-26 15:46:38 +00:00
Aaron Ballman 6828945dd2 No need for the manual quotes and extra getName() call. No functional changes intended.
llvm-svn: 198047
2013-12-26 15:06:01 +00:00
Aaron Ballman 553e68118f Removing some unneeded code, and a diagnostic that was obsoleted. The type has already been determined to be a ValueDecl by virtue of the attribute subjects.
Added some test case coverage as well.

llvm-svn: 198046
2013-12-26 14:54:11 +00:00
Alp Toker 5294e6e094 Don't reserve __builtin_types_compatible_p as a C++ keyword
Even g++ considers this a valid C++ identifier and it should only have been
visible in C mode.

Also drop the associated low-value diagnostic.

llvm-svn: 197995
2013-12-25 01:47:02 +00:00
Jiangning Liu 38799b1471 Add some missing test cases for ACLE intrinsics of AArch64 NEON.
llvm-svn: 197994
2013-12-25 01:23:43 +00:00
Nico Weber 428a93b8ab Add a FIXME to a failing test.
(See discussion in the bug for why this isn't XFAILed.)

llvm-svn: 197991
2013-12-24 20:48:13 +00:00
Daniel Jasper 234379fbf6 clang-format: (WebKit) Disallow 1-line constructors with initializers.
Before:
  Constructor() : a(a) {}

After:
  Constructor()
      : a(a)
  {
  }

This style guide is pretty precise about this.

llvm-svn: 197980
2013-12-24 13:31:25 +00:00
Alp Toker ec543279db Support and use token kinds as diagnostic arguments
Introduce proper facilities to render token spellings using the diagnostic
formatter.

Replaces most of the hard-coded diagnostic messages related to expected tokens,
which all shared the same semantics but had to be multiply defined due to
variations in token order or quote marks.

The associated parser changes are largely mechanical but they expose
commonality in whole chunks of the parser that can now be factored away.

This commit uses C++11 typed enums along with a speculative legacy fallback
until the transition is complete.

Requires corresponding changes in LLVM r197895.

llvm-svn: 197972
2013-12-24 09:48:30 +00:00
Alp Toker 61d41af46b Document the Message parameter of getCustomDiagID()
A lot of callers have been using this facility incorrectly.

llvm-svn: 197920
2013-12-23 21:00:35 +00:00
Adrian Prantl 5028dc0fca remove dead code.
llvm-svn: 197916
2013-12-23 19:10:57 +00:00
Alp Toker 5c494cbe98 Fix another misuse of getCustomDiagID()
There's no need to escape strings and generate new DiagIDs for each message.

llvm-svn: 197915
2013-12-23 17:59:59 +00:00
NAKAMURA Takumi d32e3ef349 clang/Analysis/FlowSensitive/DataflowSolver.h: <functional> should be just a STL header.
llvm-svn: 197912
2013-12-23 16:34:51 +00:00
Aaron Ballman 0390908588 Consolidating some mode attribute diagnostics. No functional changes intended.
llvm-svn: 197911
2013-12-23 15:23:11 +00:00
Daniel Jasper 9a26e77311 clang-format: Fix invalid write discovered by ASAN.
Introduced in r197900.

llvm-svn: 197906
2013-12-23 11:25:40 +00:00
Alp Toker b09e5af914 Add a missing pipe in the test from r197896
Spotted by Edward

llvm-svn: 197903
2013-12-23 08:50:43 +00:00
Alp Toker a8b02c2e46 TextDiagnosticBuffer: Fix copy-paste mistake in r197856
The TextDiagnosticBuffer is meant to scrub SourceLocations as the input/output
SourceManagers may be different.

To be safe this commit restores the original behaviour though in practice
all current users seem to share a single SM.

Would be nice to replace TextDiagnosticBuffer now that more capable interfaces
like CaptureDiagnosticConsumer / StoredDiagnosticConsumer exist.

llvm-svn: 197902
2013-12-23 07:47:48 +00:00
Daniel Jasper b88b25feec clang-format: Fix various problems in formatting ObjC blocks.
Among other things, this fixes llvm.org/PR15269.

llvm-svn: 197900
2013-12-23 07:29:06 +00:00
Hao Liu f96fd37888 [AArch64]The compare to zero intrinsics should be implemented by 'icmp/fcmp' and 'sext' not 'zext'. Modify the implementation by replacing zext with sext.
llvm-svn: 197898
2013-12-23 02:44:00 +00:00
Alp Toker 054f33c801 Make some f_Group definitions anonymous and test an alternative spelling
These names weren't referred to anywhere in the source so don't need a written
name.

Depends on the TableGen fix for anonymous records in LLVM r197869.

llvm-svn: 197896
2013-12-22 22:38:57 +00:00
Aaron Ballman 888e935978 Removing the alloc_size attribute. The attribute was semantically handled, but silently ignored. Most of this feature was already reverted in June 2012 (r159016), this just cleans up the pieces left over.
llvm-svn: 197866
2013-12-21 17:15:13 +00:00
Aaron Ballman bf7b1ee385 The const and nothrow attributes can be handled by the simple attribute handler. This removes a silent dropping of the attributes when they are duplicated on a Decl.
llvm-svn: 197864
2013-12-21 16:49:29 +00:00
Alp Toker bc043f27f4 Fix getCustomDiagID() usage in CodeGen and TextDiagnosticBuffer
DiagIDs are a cached resource generally only constructed from compile-time
constant or stable format strings.

Escaping arbitrary messages and constructing DiagIDs from them didn't make
sense.

llvm-svn: 197856
2013-12-21 05:20:03 +00:00
Alp Toker 9477f9e52f Fix getCustomDiagID() usage in example code
This was setting a bad example. DiagIDs are a limited resource and the message
argument is evaluated as a format string.

llvm-svn: 197855
2013-12-21 05:19:58 +00:00
Richard Trieu 2f024f432d Add -Winfinite-recursion to Clang
This new warning detects when a function will recursively call itself on every
code path though that function.  This catches simple recursive cases such as:

void foo() {
  foo();
}

As well as more complex functions like:

void bar() {
  if (test()) {
    bar();
    return;
  } else {
    bar();
  }
  return;
}

This warning uses the CFG.  As with other CFG-based warnings, this is off
by default.  Due to false positives, this warning is also disabled for
templated functions.

llvm-svn: 197853
2013-12-21 02:33:43 +00:00
NAKAMURA Takumi 38b8c938e8 [CMake] clang/lib/Headers: Install just-generated ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h, instead of copied arm_neon.h.
llvm-svn: 197852
2013-12-21 01:56:00 +00:00
Alp Toker a5d645976f Assert that tag decls are never marked (in)valid after definition is complete
Sema relies on this assumption.

Follow-up to r197848.

llvm-svn: 197850
2013-12-21 01:10:54 +00:00
Richard Trieu 0732beb21f Use this one little trick to prevent optimizers from removing an
intentional stack overflow.

llvm-svn: 197849
2013-12-21 01:04:02 +00:00
Nico Weber 7607fce112 Don't mark record decls invalid when one of its methods is invalid, PR18284.
Without this patch, record decls with invalid out-of-line method delcs would
sometimes be marked invalid, but not always.  With this patch, they are
consistently never marked invalid.

(The code to do this was added in
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20100809/033154.html
, but the test from that revision is still passing.)

As far as I can tell, this was the only place where a class was marked invalid
after its definition was complete.

llvm-svn: 197848
2013-12-21 00:49:51 +00:00
Reid Kleckner b60a3d5bc1 Eliminate the ItaniumVTableContext object from CodeGenVTables
Now CodeGenVTables has only one VTableContext object, which is either
Itanium or Microsoft.

Fixes a FIXME with no functionality change intended.

Ideally we could avoid the downcasts by pushing the things that
reference the Itanium vtable context into ItaniumCXXABI.cpp, but we're
not there yet.

llvm-svn: 197845
2013-12-20 23:58:52 +00:00
David Blaikie 3275dc4586 DebugInfo: Do not include implicit members (implicit special members, template instantiations, etc) in the list of members of a structure.
These members will still be lazily added to the relevant DWARF DIEs in
LLVM but when enumerating the members they will not appear. This allows
DWARF type units to be more consistent - the type unit will never
contain these special members (so all instances of the type should have
the same DIEs without some having some special members and others having
others) and the special members will be added to the skeletal
declaration that appears in the relevant compile_unit.

llvm-svn: 197844
2013-12-20 23:19:47 +00:00
Alp Toker 556b3d69c0 Remove obsolete preamble FIXME
The MD5 is checked since r197755 which is as good as comparing buffer contents
in this context.

llvm-svn: 197842
2013-12-20 22:27:20 +00:00
Rafael Espindola d5e81e59b5 Override the datalayout in a module with -triple.
This matches llc's behavior.

Before this patch clang would create a TargetInfo base on -triple but a llvm
CodeGen based on the triple in the module.

llvm-svn: 197837
2013-12-20 22:01:25 +00:00
Reid Kleckner d2d1cc5156 Compare canonical return types when generating MS C++ ABI vtable thunks
This was part of the cause for PR17655.  We were generating thunks when
we shouldn't have.  I suspect that if we tweak the test case for PR17655
to actually require thunks, we can reproduce the same crash.

llvm-svn: 197836
2013-12-20 21:44:05 +00:00
Alp Toker f4e2238119 Move the TargetMachine instance into EmitAssemblyHelper
Cleanup in preparation for enhanced DataLayout checking.

llvm-svn: 197832
2013-12-20 20:26:53 +00:00
Hans Wennborg e0053474b9 clang-cl: Support /P and /E (preprocess to file or stdout)
llvm-svn: 197827
2013-12-20 18:40:46 +00:00
Adrian Prantl 4efc805402 Remove an outdated statement about debugging optimized code.
llvm-svn: 197820
2013-12-20 17:39:42 +00:00
Adrian Prantl f418b10972 Document the -fno-limit-debug-info switch in the man page.
llvm-svn: 197819
2013-12-20 17:39:35 +00:00
Daniel Jasper 92669ee45c Enable layering check in unavailable modules.
If a header file belonging to a certain module is not found on the
filesystem, that header gets marked as unavailable. Now, the layering
warning (-fmodules-decluse) should still warn about headers of this
module being wrongfully included. Currently, headers belonging to those
modules are just treated as not belonging to modules at all which means
they can be included freely from everywhere.

To implement this (somewhat) cleanly, I have moved most of the layering
checks into the ModuleMap. This will also help with showing FixIts
later.

llvm-svn: 197805
2013-12-20 12:09:36 +00:00
Daniel Jasper 04b6a081fc clang-format: Better support for multi-line wide string literals.
Before:
  SomeFunction(L"A" L"B");

After:
  SomeFunction(L"A"
               L"B");

llvm-svn: 197785
2013-12-20 06:22:01 +00:00
Argyrios Kyrtzidis 78f80710de [analyzer] Use DataRecursiveASTVisitor for the AnalysisConsumer.
llvm-svn: 197767
2013-12-20 02:02:58 +00:00
Argyrios Kyrtzidis 561fe54a1a Move tools/libclang/RecursiveASTVisitor.h -> include/clang/AST/DataRecursiveASTVisitor.h
This is to make it available so the static analyzer can use it.

llvm-svn: 197766
2013-12-20 02:02:54 +00:00
Argyrios Kyrtzidis b0188f246a [libclang/python] Add CompilationDatabase.getAllCompileCommands to the python bindings.
Patch by Laszlo Nagy!

llvm-svn: 197765
2013-12-20 01:34:00 +00:00
Jordan Rose 99e80c14b3 Serialize source range info for TypeTraitExpr.
This caused some crazy crashes involving std::unordered_map being
deserialized from a PCH file and then template instantiation requiring
an explicit instantiation location; unfortunately I don't really know
how to come up with a minimal test case.

llvm-svn: 197764
2013-12-20 01:26:47 +00:00
Dmitri Gribenko 3ec8ee72c5 Correctly compute the size in bytes of PreambleFileHash.MD5
llvm-svn: 197762
2013-12-20 01:07:30 +00:00
Dmitri Gribenko 514102d24f Add a test I forgot to svn add in r197755
llvm-svn: 197756
2013-12-20 00:21:47 +00:00
Dmitri Gribenko 4765252dcb ASTUnit::getMainBufferWithPrecompiledPreamble: use MD5 hash of the remapped
files to tell if they were changed since the last time we have computed the
preamble

We used to check only the buffer size, so if the new remapped buffer has the
same size as the previous one, we would think that the buffer did not change,
and we did not rebuild the preambule, which sometimes caused us to crash.

llvm-svn: 197755
2013-12-20 00:16:25 +00:00
Dmitri Gribenko 40798d30fb Simplify code
llvm-svn: 197748
2013-12-19 23:25:59 +00:00
Jordan Rose 821f102985 [analyzer] Fix test in previous commit to account for compiler warning.
--analyze passes -w, but -cc1 -analyze doesn't. Oops!

llvm-svn: 197741
2013-12-19 23:05:40 +00:00
Ted Kremenek 1654511884 Wordsmith "maybe" into "may be" in diagnostic, and move warning under flag.
llvm-svn: 197736
2013-12-19 22:47:11 +00:00
Jordan Rose 7ae3362458 [analyzer] Always use 'bool' as the SValBuilder condition type in C++.
We have assertions for this, but a few edge cases had snuck through where
we were still unconditionally using 'int'.

<rdar://problem/15703011>

llvm-svn: 197733
2013-12-19 22:32:39 +00:00
Ted Kremenek ec690e960e Remove dead code identified by Aaron Ballman.
llvm-svn: 197730
2013-12-19 22:23:12 +00:00
Aaron Ballman 37c5f5da32 After discussing with John McCall, removing the ns_bridged attribute as it is unused.
llvm-svn: 197729
2013-12-19 22:12:51 +00:00
Daniel Jasper 5a611397a2 clang-format: Add special case for leading comments in braced lists.
A comment following the "{" of a braced list seems to almost always
refer to the first element of the list and thus should be aligned
to it.

Before (with Cpp11 braced list style):
  SomeFunction({  // Comment 1
                   "first entry",
                   // Comment 2
                   "second entry"});
After:
  SomeFunction({// Comment 1
                "first entry",
                // Comment 2
                "second entry"});

llvm-svn: 197725
2013-12-19 21:41:37 +00:00
Aaron Ballman aa47d24a47 Reverting r197715 -- it appears that MSVC is happy with the code, but clang is not.
llvm-svn: 197716
2013-12-19 19:39:25 +00:00
Aaron Ballman ced10529fe No longer leaking Argument objects after calling createArgument. However, since an OwningPtr cannot live in a std::vector yet, there are some manual deletions that have a FIXME attached to them. These will go away once C++11 support is allowed.
llvm-svn: 197715
2013-12-19 19:33:35 +00:00
Jordan Rose af9f87522f [CMake] Tweak r197697 to handle CMake finding the wrong llvm-config/tblgen.
- If llvm-config fails, output an error to the user rather than allowing
  errors to cascade.
- Always get llvm-tblgen from llvm-config's bindir.

Turns out my PATH points to a really old version of LLVM; both of these
fell out of trying to make this experience nicer.

llvm-svn: 197714
2013-12-19 18:39:05 +00:00
Aaron Ballman d618025910 Type attribute do not get an AST node by default, so these statements can be removed (it's inherited automatically from TypeAttr).
llvm-svn: 197710
2013-12-19 18:16:00 +00:00
Aaron Ballman e615393356 Removing the SourceLocation unused attribute argument type.
llvm-svn: 197707
2013-12-19 18:10:57 +00:00
Fariborz Jahanian 4b7946a28a ObjectiveC. Sema test for property, methods
'section' attribute. // rdar://15450637

llvm-svn: 197704
2013-12-19 17:22:23 +00:00
NAKAMURA Takumi ef4657e6f1 check-clang: Suppress LLVM_LIT in add_lit_testsuite, for now.
llvm-svn: 197702
2013-12-19 17:10:30 +00:00
Rafael Espindola 9ec8d08eb1 Small simplification: p0 is the same as p.
llvm-svn: 197700
2013-12-19 16:54:10 +00:00
Daniel Jasper 19a541eff0 clang-format: Increase penalty for breaking comments.
Unexpectedly, it seems that people commonly know what they were doing
when writing a comment.

Also, being more conservative about comment breaking has the advantage
of giving more flexibility. If a linebreak within the comment can
improve formatting, the author can add it (after which clang-format
won't undo it). There is no way to override clang-format's behavior if
it breaks a comment.

llvm-svn: 197698
2013-12-19 16:45:34 +00:00
NAKAMURA Takumi e6d79ec0eb [CMake][Standalone] Rewrite standalone build based on llvm-config. CLANG_PATH_TO_LLVM_*(s) are deprecated.
Checked on VS10(multiconfig) and some singleconfig builders.

* Assumptions

  - You should specify llvm-config as LLVM_CONFIG.
    CMake could find one in $PATH by default.

  - ENABLE_ASSERTIONS obeys LLVM's.

* Use cases

  a) With LLVM build tree

    Assume llvm-config is in your build tree.
    Everything should work as ever.

  b) With *installed* LLVM

    Assume distributions. The source tree can be optional.

    b1) The source tree is provided on the location `llvm-config --src-root`

      - Test utils, FileCheck &c., are imported and built in the new tree.
      - Gtest is built in the tree if gtest library is not found.
      - Lit is used in $(SRCROOT)/utils/lit/lit.py.

    b2) The source tree is not provided

      - clang and utilities can be built.
      - All tests, unittests and check-clang are invalidated and not built.

llvm-svn: 197697
2013-12-19 16:44:32 +00:00
Will Wilson 9ef61a7ca7 Fix comment typo.
llvm-svn: 197695
2013-12-19 16:24:17 +00:00
Daniel Jasper 004177ee29 clang-format: Slightly adapt decision of when to break before <<.
Before:
  Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa) << aaaaaaaaaaaaaaaaaaaaaaaaa(
                                              aaaaaaaaaaaaa);

After:
  Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa)
      << aaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaa);

llvm-svn: 197690
2013-12-19 16:06:40 +00:00
NAKAMURA Takumi ed79c96f89 [CMake] check-clang: Include ClangUnitTests if it can be built. Check existence of gtest.h then.
llvm-svn: 197688
2013-12-19 16:05:44 +00:00
NAKAMURA Takumi 5de6b43898 [CMake] check-clang: Append items to CLANG_TEST_DEPS rather than set. CLANG_TEST_DEPS can be set in parent scope.
llvm-svn: 197687
2013-12-19 16:05:39 +00:00
NAKAMURA Takumi 5db0c689b2 [CMake] check-clang: Deprecate --path, according to r197576.
llvm-svn: 197686
2013-12-19 16:05:34 +00:00
Aaron Ballman ee58e6d6d2 Switching getAttrs calls over to using a specific_attr_iterator. No functional changes intended.
llvm-svn: 197681
2013-12-19 15:35:31 +00:00
Aaron Ballman cf3b4836bd Switched code from using hasAttr followed by getAttr to simply call getAttr directly and check the resulting value.
No functional changes intended.

llvm-svn: 197678
2013-12-19 13:36:16 +00:00
Aaron Ballman 2084f8fb49 Switched code from using hasAttr followed by getAttr to simply call getAttr directly.
No functional changes intended.

llvm-svn: 197676
2013-12-19 13:20:36 +00:00
Aaron Ballman 36a18ffef1 Hosting a call to getAttr so that we don't call it multiple times for the same attribute. Also removes a hasAttr that's not required. No functional changes intended.
llvm-svn: 197675
2013-12-19 13:16:35 +00:00
Daniel Jasper db7933ab99 Fix usage description of clang-format-diff.py.
llvm-svn: 197668
2013-12-19 10:21:37 +00:00
Matt Arsenault 8ba4882c4b Update SI datalayout for 32-bit private pointers
llvm-svn: 197660
2013-12-19 05:33:14 +00:00
Aaron Ballman c4327996ca Switched code from using hasAttr followed by getAttr to simply call getAttr directly and check the resulting value.
No functional changes intended.

llvm-svn: 197652
2013-12-19 03:09:10 +00:00
Rafael Espindola dc265edb3b On spacv8 f128 is only aligned to 64 bits.
LLVM already got this right.

Found on "Figure 3-1: Scalar Types" on http://sparc.com/standards/psABI3rd.pdf.

llvm-svn: 197651
2013-12-19 03:03:04 +00:00
Aaron Ballman e8d9f8dd01 Switched code from using hasAttr followed by getAttr to simply call getAttr directly and check the resulting value.
No functional changes intended.

llvm-svn: 197650
2013-12-19 03:02:49 +00:00
Aaron Ballman b06f2ef33c Switched code from using hasAttr followed by getAttr to simply call getAttr directly and check the resulting value. Also fixes some minor formatting issues surrounding the getAttr code.
No functional changes intended.

llvm-svn: 197649
2013-12-19 02:58:51 +00:00
Aaron Ballman 9ead1243a5 Replacing calls to getAttr with calls to hasAttr for clarity. No functional change intended -- this only replaces Boolean uses of getAttr.
llvm-svn: 197648
2013-12-19 02:39:40 +00:00
Dmitri Gribenko b353ee1808 PCH: fix a crash caused by a circular deserialization dependency
We started by trying to deserialize decltype(func-param) in a trailing return
type, which causes the function parameter decl to be deserialized, which pulls
in the function decl, which pulls the function type, which pulls the same
decltype() in the return type, and then we crashed.

llvm-svn: 197644
2013-12-19 02:05:20 +00:00
Dmitri Gribenko 092ab4a9fe Simplify CXXMethodDecl::isVirtual() for __interface case
llvm-svn: 197643
2013-12-19 01:58:52 +00:00
Adrian Prantl 0866acd3a3 Debug info: (Bugfix) emit CRV qualifiers for pointers to member functions.
rdar://problem/15678916.

llvm-svn: 197641
2013-12-19 01:38:47 +00:00
Warren Hunt f037bd1e7c [ms-abi] Update Alignment for VtorDisps
The alignment impact of the virtual bases apperas to be applied in 
order, rather than up front.  This patch adds the new behavior and 
provides a test case.

llvm-svn: 197639
2013-12-19 00:43:59 +00:00
Aaron Ballman 66039937e8 Added a comment about the launch_bounds attribute's AST node being required. Since there were no test cases for the attribute, some have been added. This promptly demonstrated a bug with the semantic handling, which is also fixed.
llvm-svn: 197637
2013-12-19 00:41:31 +00:00
Aaron Ballman 8edb5c2081 Refactor the Microsoft inheritance attribute handling so that it no longer has special treatment. Also fixes a minor bug where the attributes were being parsed as though they were GNU-style attributes when they were in fact keyword attributes.
llvm-svn: 197629
2013-12-18 23:44:18 +00:00
Rafael Espindola 1c09b264e3 Fix the DataLayout string produced by clang for NaCl.
Reviewed by Derek Schuff.

llvm-svn: 197628
2013-12-18 23:41:04 +00:00
Ted Kremenek b79ee57080 Implemented delayed processing of 'unavailable' checking, just like with 'deprecated'.
Fixes <rdar://problem/15584219> and <rdar://problem/12241361>.

This change looks large, but all it does is reuse and consolidate
the delayed diagnostic logic for deprecation warnings with unavailability
warnings.  By doing so, it showed various inconsistencies between the
diagnostics, which were close, but not consistent.  It also revealed
some missing "note:"'s in the deprecated diagnostics that were showing
up in the unavailable diagnostics, etc.

This change also changes the wording of the core deprecation diagnostics.
Instead of saying "function has been explicitly marked deprecated"
we now saw "'X' has been been explicitly marked deprecated".  It
turns out providing a bit more context is useful, and often we
got the actual term wrong or it was not very precise
 (e.g., "function" instead of "destructor").  By just saying the name
of the thing that is deprecated/deleted/unavailable we define
this issue away.  This diagnostic can likely be further wordsmithed
to be shorter.

llvm-svn: 197627
2013-12-18 23:30:06 +00:00
Reid Kleckner e7106c9e0b Use getAsCXXRecordDecl to shorten some gets and casts
llvm-svn: 197626
2013-12-18 23:17:05 +00:00
Fariborz Jahanian cb8c7da266 ObjectiveC. support "section" attribute on properties
and methods. rdar://15450637

llvm-svn: 197625
2013-12-18 23:09:57 +00:00
Douglas Gregor d1e3ceb5ec Require the type of a by-copy capture to be complete before creating its field.
The problem here is more serious than the fix implies. Adding a field
to a class updates the triviality bits for the class (among other
things). Failing to require a complete type before adding the field
meant that these updates don't happen in the well-formed case where
the capture is an uninstantiated class template specialization,
leading the lambda itself to be treated as having a trivial copy
constructor when it shouldn't. Fixes <rdar://problem/15560464>.

llvm-svn: 197623
2013-12-18 23:02:36 +00:00
Rafael Espindola ea03a1ff1c Add a test for mipsel-nacl too.
llvm-svn: 197617
2013-12-18 22:40:42 +00:00
Alp Toker 1d8362cd19 Enhance OpenMP parser tests from r197553 / r197598
Move some of the verifier directives away from the end of the pragma line.

This ensures that the diagnostics relate to the trailing token being tested and
not the verifier comments which are themselves part of the token stream.

llvm-svn: 197616
2013-12-18 22:34:19 +00:00
Adrian Prantl 0630eb7094 Debug info: Implement (rvalue) reference qualifiers for C++11 non-static
member functions. Paired commit with LLVM.

rdar://problem/15356637

llvm-svn: 197612
2013-12-18 21:48:18 +00:00
Douglas Gregor 6878214bc9 Allow Objective-C pointer conversions following an explicit user conversion.
Finishes the work started in r194224, and fixes <rdar://problem/15494681>.

llvm-svn: 197609
2013-12-18 21:46:16 +00:00
Alp Toker 679bf0141b clang-format-diff.py: fix -regex/-iregex matching
While debating the finer points of file extension matching, we somehow missed
the bigger problem that the current code will match anything starting with the
default or user-specified pattern (e.g. lit.site.cfg.in).

Fix this by doing what find(1) does, implicitly wrapping the pattern with ^$.

llvm-svn: 197608
2013-12-18 21:34:07 +00:00
Fariborz Jahanian 283bf89506 Objective-C. After providing a fix-it for a
cstring, converted to NSString, produce the
matching AST for it. This also required some
refactoring of the previous code. // rdar://14106083

llvm-svn: 197605
2013-12-18 21:04:43 +00:00
Rafael Espindola afa854c15e Make setABIAPCS and setABIAAPCS easier to reason about.
These functions now always set the same variables in the same order and they
don't overlap with thep constructor.

llvm-svn: 197604
2013-12-18 20:24:51 +00:00
Rafael Espindola d6c2b720ae Split setABI in two helpers. No functionality change.
llvm-svn: 197603
2013-12-18 19:47:32 +00:00
Alp Toker b14a4709f5 Fix OpenMP recovery with trailing tokens following the pragma
The recovery was failing due to a missing case in SkipUntil().

Also add back tests from r197553 that were reverted in the previous commit.

llvm-svn: 197598
2013-12-18 19:10:54 +00:00
Alp Toker d751fa7868 Revert "[OPENMP] Fix for parsing OpenMP directives with extra braces, brackets and parens"
These parser changes were redundant. The same or better recovery can be
achieved with a one-line fix to SkipUntil() due to land in the next commit.

This reverts commit r197553.

llvm-svn: 197597
2013-12-18 19:10:49 +00:00
Artyom Skrobov 67e6d506d8 Adding a win32-targeted test into Tooling/multi-jobs.cpp, to make sure it doesn't get broken again
(prompted by NAKAMURA Takumi)

llvm-svn: 197596
2013-12-18 18:55:36 +00:00
NAKAMURA Takumi 59379524c8 check-clang: Fixup r197576, to replace CMAKE_CFG_INTDIR on clang_tools_dir.
llvm-svn: 197593
2013-12-18 18:25:13 +00:00
Pekka Jaaskelainen 43c39d5f1f OpenCL: Do not force 64 bit floats for (embedded) targets with only 32bit floats.
llvm-svn: 197592
2013-12-18 18:15:03 +00:00
Fariborz Jahanian 8ef938972a ObjectiveC. Fixes the sentence in a diagnostic.
// rdar://15397430

llvm-svn: 197586
2013-12-18 16:51:06 +00:00
Rafael Espindola 666a2ab64e clang-format parts of the file.
I am about to send a patch for review touching these and clang-formating first
makes the patch much easier to read.

llvm-svn: 197585
2013-12-18 16:38:48 +00:00
Aaron Ballman 0362a6d466 Implement the MSABI and SysVABI calling conventions for Objective-C method declarations. This appears to be an omission from r189644.
llvm-svn: 197584
2013-12-18 16:23:37 +00:00
Aaron Ballman b4ca40bd4d Adding some comments about AST node requirements for attributes which create AST nodes but never actually make use of them. No functional changes.
llvm-svn: 197582
2013-12-18 15:59:41 +00:00
Rafael Espindola af789a05b2 Whitespace cleanup.
llvm-svn: 197580
2013-12-18 15:52:38 +00:00
Alp Toker f22856a415 Remove OpenCL-specific type keywords and specifiers
This commit kills off custom type specifier and keyword handling of OpenCL C
data types.

Although the OpenCL spec describes them as keywords, we can handle them more
elegantly as predefined types. This should provide better error correction and
code completion as well as simplifying the implementation.

The primary intention is however to simplify the C/C++ parser and save some
packed bits on AST structures that had been extended in r170432 just for
OpenCL.

llvm-svn: 197578
2013-12-18 15:29:05 +00:00
Rafael Espindola 0ea96eba43 Add -f64:32:64 to the darwin ppc32 DataLayout.
A f64 inside a struct can be 32 bit aligned on darwin.

llvm-svn: 197577
2013-12-18 15:16:50 +00:00
NAKAMURA Takumi 462ba80fda check-clang: Introduce clang_tools_dir in lit.site.cfg, for clang separated from llvm.
llvm-svn: 197576
2013-12-18 15:08:56 +00:00
NAKAMURA Takumi 96357e6af7 clang/test/CMakeLists.txt: Prune CLANG_SOURCE_DIR and CLANG_BINARY_DIR. They are set at top.
llvm-svn: 197575
2013-12-18 15:08:49 +00:00
Daniel Jasper 969643594e clang-format: Fix indentation corner case.
Before:
  aaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
                 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
  aaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
                   .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();

After:
  aaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
                 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
                 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
  aaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
                   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
                   .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();

Probably still not ideal, but should be a step into the right direction.

llvm-svn: 197557
2013-12-18 10:44:36 +00:00
Alexey Bataev cb164ab273 [OPENMP] Fix for parsing OpenMP directives with extra braces, brackets and parens
llvm-svn: 197553
2013-12-18 08:46:25 +00:00
Daniel Jasper 3460b2546c clang-format: Fix ObjC method expr in binary expressions.
Before:
  bool a = ([aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaa || [aaaaaaaa aaaaa] ==
                                                         aaaaaaaaaaaaaaaaaaaa);

After:
  bool a = ([aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaa ||
            [aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaaaaa);

This fixes llvm.org/PR18271.

llvm-svn: 197552
2013-12-18 07:08:51 +00:00
Rafael Espindola 754207bc5c Use arm-nacl-gnueabi instead of arm-nacl to match the previous tests.
llvm-svn: 197550
2013-12-18 04:53:17 +00:00
Rafael Espindola 667c576169 Split this test into one per supporter nacl arch.
Right now clang produces the same DataLayout for all of them, but it could, for
example, add 'n' specifications when the end architecture is given.

No functionality change, this should just make future changes easier to read.

llvm-svn: 197549
2013-12-18 04:35:56 +00:00
Rafael Espindola 4960968509 Print the 'p' specification before the 'i' specification.
No functionality change.

llvm-svn: 197548
2013-12-18 04:14:53 +00:00
Hans Wennborg deff70309f Fix comment-code function name mismatch
llvm-svn: 197544
2013-12-18 01:39:59 +00:00
Alp Toker c49406d18c clang-format-diff.py: add the OpenCL file extension
It's handled correctly as a C-family language.

llvm-svn: 197542
2013-12-18 00:58:58 +00:00
Fariborz Jahanian 1b30b593ba ObjectiveC. typo fix in my last patch,
per Jordan's review. 

llvm-svn: 197540
2013-12-18 00:52:54 +00:00
Rafael Espindola c2e60f52ae Add a 's' specifications to AArch64.
This has no functionality change as clang adds explicit alignment info for
byval arguments. The only difference is that now the clang produced
DataLayout string for AArch64 is identical to the LLVM produced one.

llvm-svn: 197538
2013-12-17 23:30:58 +00:00
Alp Toker 8fbec67731 Move some more test-and-consumes over to TryConsumeToken()
llvm-svn: 197537
2013-12-17 23:29:36 +00:00
Fariborz Jahanian 7e350d23b2 Objctive-C. warn if dealloc is being overridden in
a category implementation. // rdar://15397430

llvm-svn: 197534
2013-12-17 22:44:28 +00:00
Dmitri Gribenko e8bc31f0ab Documentation comment parsing: when checking if we have typedef to something
that we consider a function for the purposes of checking \param and \returns,
look through reference types.

llvm-svn: 197530
2013-12-17 22:22:14 +00:00
Dmitri Gribenko fa68a57cf7 Documentation comment parsing: allow \param and \returns on std::function,
boost::function and similar function-like objects

llvm-svn: 197528
2013-12-17 22:06:11 +00:00