Commit Graph

16202 Commits

Author SHA1 Message Date
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
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
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 b9bb201194 Removing some more unnecessary manual quotes from diagnostics.
llvm-svn: 198420
2014-01-03 14:54:10 +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 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
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
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 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
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
Joey Gouly d4993032a9 [OpenCL] The kernel attribute can only be used on functions.
llvm-svn: 198300
2014-01-02 12:04:42 +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
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
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
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
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
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
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
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 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 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
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
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
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
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
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
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
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
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
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
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
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
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
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
Dmitri Gribenko 092ab4a9fe Simplify CXXMethodDecl::isVirtual() for __interface case
llvm-svn: 197643
2013-12-19 01:58:52 +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
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
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
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
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
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
Fariborz Jahanian 8ef938972a ObjectiveC. Fixes the sentence in a diagnostic.
// rdar://15397430

llvm-svn: 197586
2013-12-18 16:51:06 +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
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
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
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
Aaron Ballman f2db7626f0 None of these attributes currently make use of an AST node, so setting ASTNode = 0 to reduce complexity. No functional change intended.
llvm-svn: 197525
2013-12-17 21:35:24 +00:00
Fariborz Jahanian bd714e9bb1 Objective-C. Make diagnostics and fix-its consistent
when diagnosing casting of a cstring literal to
NSString in default and -fobjc-arc mode. 
// rdar://14106083

llvm-svn: 197515
2013-12-17 19:33:43 +00:00
Alp Toker de50ff3c4b Bring order to the OpenCL keywords
Avoid the gratuitous repurposing of C++ keyword 'private' by using a keyword
alias.

Also attempt to document the OpenCL keywords based on scraps of information
found online.

The purpose of this commit is to reduce impact on the C++ parser.

llvm-svn: 197511
2013-12-17 18:17:46 +00:00
Alp Toker a3ebe6ee2b Refactor and micro-optimize ConsumeToken()
1) Introduce TryConsumeToken() to handle the common test-and-consume pattern.
   This brings about readability improvements in the parser and optimizes to avoid
   redundant checks in the common case.

2) Eliminate the ConsumeCodeCompletionTok special case from ConsumeToken(). This
   was used by only one caller which has been switched over to the more
   appropriate ConsumeCodeCompletionToken() function.

llvm-svn: 197497
2013-12-17 14:12:37 +00:00
Alp Toker 53358e43bc Simplify RevertibleTypeTraits as a form of contextual keyword
Now that we emit diagnostics for keyword-as-identifier hacks (-Wkeyword-compat)
we can go ahead and simplify some of the old revertible keyword support.

This commit adds a TryIdentKeywordUpgrade() function to mirror the recently
added TryKeywordIdentFallback() and uses it to replace the hard-coded list of
REVERTIBLE_TYPE_TRAITs.

llvm-svn: 197496
2013-12-17 14:12:30 +00:00
Daniel Jasper 8fb00b0f79 Update comment of changed parameter of ModuleMap constructor.
llvm-svn: 197495
2013-12-17 13:21:13 +00:00
Richard Barton 5828d7b936 LIBRARY_PATH environment variable should only be supported on a native compiler.
llvm-svn: 197490
2013-12-17 11:11:25 +00:00
Daniel Jasper 0761a8a085 Modules: Don't warn upon missing headers while reading the module map.
Instead, mark the module as unavailable so that clang errors as soon as
someone tries to build this module.

This works towards the long-term goal of not stat'ing the header files at all
while reading the module map and instead read them only when the module is
being built (there is a corresponding FIXME in parseHeaderDecl()).  However, it
seems non-trivial to get there and this unblock us and moves us into the right
direction.

Also changed the implementation to reuse the same DiagnosticsEngine.

llvm-svn: 197485
2013-12-17 10:31:37 +00:00
Alp Toker 2dea15b53c ASTContext: Refactor implicit record creation
Tidy up built-in record creation to reduce code duplication.

Continuation of r197336.

llvm-svn: 197452
2013-12-17 01:22:38 +00:00
Fariborz Jahanian 381edf5759 ObjectiveC. Further improvements of use
of objc_bridge_related attribute; eliminate
unnecessary diagnostics which is issued elsewhere,
fixit now produces a valid AST tree per convention.
This results in some simplification in handling of
this attribute as well. // rdar://15499111

llvm-svn: 197436
2013-12-16 22:54:37 +00:00
Kaelyn Uhrain 5dfc94b160 Revert "Maybe add new warning for shadowing simple tag types"
This reverts commit 2b43f500cfea10a8c59c986dcfc24fd08eecc77d.

This was accidentally committed because I failed to notice my client
wasn't clean prior to submitting a fix for a crasher.

llvm-svn: 197410
2013-12-16 19:25:47 +00:00
Kaelyn Uhrain a1c32d53fb Maybe add new warning for shadowing simple tag types
llvm-svn: 197408
2013-12-16 19:19:13 +00:00
Daniel Jasper 34dc4811a2 Revert "Modules: Make missing headers in a module.map a warning not an error."
This was committed accidentally.

llvm-svn: 197389
2013-12-16 14:57:22 +00:00
Daniel Jasper 5c6ee49fa0 Modules: Make missing headers in a module.map a warning not an error.
Instead, mark the module as unavailable so that clang errors as soon as
someone tries to build this module.

A better long-term strategy might be to not stat the header files at all
while reading the module map and instead read them only when the module
is being built (there is a corresponding FIXME in parseHeaderDecl()).
However, it seems non-trivial to get there and this would be a temporary
solution to unblock us.

Also changed the implementation to reuse the same DiagnosticsEngine as
otherwise warnings can't be enabled or disabled with command-line flags.

llvm-svn: 197388
2013-12-16 14:53:57 +00:00
Benjamin Kramer 0c5636db39 Remove unused diagnostic.
llvm-svn: 197345
2013-12-15 14:51:00 +00:00
Aaron Ballman 64e6986e39 Allow target-specific attributes to share a spelling between different attributes via the ParseKind field. Attributes will be given a common parsed attribute identifier (the AttributeList::AT_* enum), but retain distinct Attr subclasses.
This new functionality is used to implement the ARM and MSP430 interrupt attribute.

Patch reviewed by Richard Smith over IRC.

llvm-svn: 197343
2013-12-15 13:05:48 +00:00
Alp Toker 56b5cc91af ASTContext: Declare builtin types implicitly
__builtin_va_list and friends have been showing up where they shouldn't for way
to long, making unwanted appearences in -ast-print, tooling and source level
visitors and even the hello world tutorial on the clang website.

This commit factors down the implicit typedef and record creation facilities to
ensure they're marked implicit.

Also fixes a unit test that was testing incorrect behaviour, and removes old
hacks in the DeclPrinter that tried to skip implicit declarations manually.

llvm-svn: 197336
2013-12-15 10:36:26 +00:00
Alp Toker 6ed7251683 Revert "Don't require -re suffix on -verify directives with regexes."
This patch was submitted to the list for review and didn't receive a LGTM.

(In fact one explicit objection and one query were raised.)

This reverts commit r197295.

llvm-svn: 197299
2013-12-14 01:07:05 +00:00
Hans Wennborg 9b395ef284 Don't require -re suffix on -verify directives with regexes.
Differential Revision: http://llvm-reviews.chandlerc.com/D2392

llvm-svn: 197295
2013-12-14 00:46:53 +00:00
Alp Toker 88f64e6aeb Remove an unused parameter and include after r197273
llvm-svn: 197274
2013-12-13 21:19:30 +00:00
Alp Toker cbb9034e2a Eliminate BinaryTypeTraitExpr
There's nothing special about type traits accepting two arguments.

This commit eliminates BinaryTypeTraitExpr and switches all related handling
over to TypeTraitExpr.

Also fixes a CodeGen failure with variadic type traits appearing in a
non-constant expression.

The BTT/TT prefix and evaluation code is retained as-is for now but will soon
be further cleaned up.

This is part of the ongoing work to unify type traits.

llvm-svn: 197273
2013-12-13 20:49:58 +00:00
Rafael Espindola 1658de9a2a Every target sets DescriptionString. Assert that.
llvm-svn: 197268
2013-12-13 19:56:31 +00:00
Fariborz Jahanian 059021a369 Objective-C. Do not issue warning when 'readonly'
property declaration has a memory management
attribute (retain, copy, etc.). Sich properties
are usually overridden to become 'readwrite'
via a class extension (which require the memory
management attribute specified). In the absence of class
extension override, memory management attribute is
needed to produce correct Code Gen. for the
property getter in any case and this warning becomes
confusing to user. // rdar://15641300

llvm-svn: 197251
2013-12-13 18:19:59 +00:00
Joey Gouly 2cd9db1cef [OpenCL] Produce an error when the work group and vec type hint attributes
are used on non-kernel functions.

Reviewed by Aaron over IRC!

llvm-svn: 197243
2013-12-13 16:15:28 +00:00
Ted Kremenek 285ee85b17 Make 'CheckProtocolMethodDefs' a static function.
llvm-svn: 197208
2013-12-13 06:26:10 +00:00
Ted Kremenek 2ccf19e1ab Change 'method X in protocol not implemented' warning to include the name of the protocol.
This removes an extra "note:", which wasn't really all that more useful
and overall reduces the diagnostic spew for this case.

llvm-svn: 197207
2013-12-13 05:58:51 +00:00
Ted Kremenek f87decdb67 Make 'WarnUndefinedMethod' a static function.
llvm-svn: 197206
2013-12-13 05:58:44 +00:00
Argyrios Kyrtzidis d664a34de8 [objc] If we don't know for sure what the designated initializers of the superclass are,
assume that a [super init..] inside a designated initializer also refers to a designated one
and do not warn.

llvm-svn: 197202
2013-12-13 03:48:17 +00:00
Ted Kremenek 6d69ac8b8a Enhance "auto synthesis will not synthesize property in protocol" to include property and protocol name.
Implements <rdar://problem/15617839>.

llvm-svn: 197187
2013-12-12 23:40:14 +00:00
Alp Toker 40f9b1cd69 Unify type trait parsing
Type trait parsing is all over the place at the moment with unary, binary and
n-ary C++11 type traits that were developed independently at different points
in clang's history.

There's no good reason to handle them separately -- there are three parsers,
three AST nodes and lots of duplicated handling code with slightly different
implementations and diags for each kind.

This commit unifies parsing of type traits and sets the stage for further
consolidation.

No change in behaviour other than more consistent error recovery.

llvm-svn: 197179
2013-12-12 21:23:03 +00:00
Argyrios Kyrtzidis 9955dbca2f [Modules] Don't parse any module map if modules are disabled.
Fixes rdar://15644663.

llvm-svn: 197165
2013-12-12 16:08:33 +00:00
Alexander Kornienko b5e774eb2c Filter-out irrelevant command-line options in CommonOptionsParser.
Summary:
Leave only -help, -version and options from the specified category.
Updated clang-check and clang-tidy. As clang-tidy is in a separate repository,
here's the diff:

  Index: tools/extra/clang-tidy/tool/ClangTidyMain.cpp
  ===================================================================
  --- tools/extra/clang-tidy/tool/ClangTidyMain.cpp       (revision 197024)
  +++ tools/extra/clang-tidy/tool/ClangTidyMain.cpp       (working copy)
  @@ -39,7 +39,7 @@
   // FIXME: Add option to list name/description of all checks.
   
   int main(int argc, const char **argv) {
  -  CommonOptionsParser OptionsParser(argc, argv);
  +  CommonOptionsParser OptionsParser(argc, argv, ClangTidyCategory);
   
     SmallVector<clang::tidy::ClangTidyError, 16> Errors;
     clang::tidy::runClangTidy(Checks, OptionsParser.getCompilations(),

Reviewers: djasper, klimek

Reviewed By: djasper

CC: cfe-commits, revane, klimek

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

llvm-svn: 197139
2013-12-12 09:59:42 +00:00
Alexander Kornienko 3a33f0292b Implemented GNU-style formatting for compound statements.
Summary:
Added BraceBreakingStyle::BS_GNU. I'm not sure about the correctness of
static initializer formatting, but compound statements should be fine.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 197138
2013-12-12 09:49:52 +00:00
Aaron Ballman 0fa079f332 Switching to using hasGlobalStorage instead of !hasLocalStorage for better clarity.
llvm-svn: 197110
2013-12-12 02:03:50 +00:00
Aaron Ballman 75a1729c4b Added a Subjects clause to the section attribute and made its diagnostics more consistent with other attributes.
llvm-svn: 197104
2013-12-12 01:34:39 +00:00
Richard Smith c934e4fd2c PR18217: Rewrite JumpDiagnostics' handling of temporaries, to correctly handle
declarations that might lifetime-extend multiple temporaries. In passing, fix a
crasher (PR18217) if an initializer was dependent and exactly the wrong shape,
and remove a bogus function (Expr::findMaterializedTemporary) now its last use
is gone.

llvm-svn: 197103
2013-12-12 01:27:02 +00:00
Ted Kremenek 8844660641 Add new PrintingPolicy entry to trim number of newlines. Useful for the CFG printer.
The change isn't completely comprehensive.  This can be filled in
lazily as needed.  There is one consumer right now.

llvm-svn: 197093
2013-12-11 23:44:02 +00:00
Hans Wennborg cda4b6dd00 Change semantics of regex expectations in the diagnostic verifier
Previously, a line like

  // expected-error-re {{foo}}

treats the entirety of foo as a regex. This is inconvenient when matching type
names containing regex characters. For example, to match
"void *(class test8::A::*)(void)" inside such a regex, one would have to type
"void \*\(class test8::A::\*\)\(void\)".

This patch changes the semantics of expected-error-re to only treat the parts
of the directive wrapped in double curly braces as regexes. This avoids the
escaping problem and leads to nicer patterns for those cases; see e.g. the
change to test/Sema/format-strings-scanf.c.

(The balanced search for closing }} of a directive also makes us handle the
full directive in test\SemaCXX\constexpr-printing.cpp:41 and :53.)

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

llvm-svn: 197092
2013-12-11 23:40:50 +00:00
Renato Golin 859fbf492c Revert r197043, not a good comment
llvm-svn: 197077
2013-12-11 21:44:56 +00:00
Renato Golin 50e39e0fef Add comment about PragmaIntroducerKind
llvm-svn: 197043
2013-12-11 14:45:53 +00:00
David Tweed e1468322eb Add front-end infrastructure now address space casts are in LLVM IR.
With the introduction of explicit address space casts into LLVM, there's
a need to provide a new cast kind the front-end can create for C/OpenCL/CUDA
and code to produce address space casts from those kinds when appropriate.

Patch by Michele Scandale!

llvm-svn: 197036
2013-12-11 13:39:46 +00:00
Daniel Jasper 4eaf0a6ca4 Modules: Let -fmodules-decluse ignore headers that aren't in a module
Includes might always pull in arbitrary header or data files outside of
modules. Among others, this includes builtin includes, which do not have
a module (story) yet.

Also cleanup implementation of ModuleMap::findModuleForHeader() to be
non-recursive.

llvm-svn: 197034
2013-12-11 12:13:00 +00:00
Fariborz Jahanian 54f87385c0 ObjectiveC. Fixes a bug where an 'unused property ivar'
warning is coming out incorrectly too early
becuase of unrelated scope pop. // rdar://15630719

llvm-svn: 196989
2013-12-11 00:53:48 +00:00
Fariborz Jahanian ddd28dc061 Objective-C. Minor change to a diagnostic.
// rdar://15499111

llvm-svn: 196977
2013-12-10 22:22:45 +00:00
Ted Kremenek f41cf7f10f Rename attribute 'objc_suppress_protocol_methods' to 'objc_protocol_requires_explicit_implementation'.
That's a mouthful, and not necessarily the final name.  This also
reflects a semantic change where this attribute is now on the
protocol itself instead of a class.  This attribute will require
that a protocol, when adopted by a class, is explicitly implemented
by the class itself (instead of walking the super class chain).

Note that this attribute is not "done".  This should be considered
a WIP.

llvm-svn: 196955
2013-12-10 19:43:48 +00:00
Ted Kremenek d980da2290 Enhance attribute machinery to include ObjCProtocols as "subjects" in attribute declarations.
llvm-svn: 196954
2013-12-10 19:43:42 +00:00
Fariborz Jahanian 7c04a55545 Improve on an objc_bridge_related diagnostic.
// rdar://15499111

llvm-svn: 196950
2013-12-10 19:22:41 +00:00
David Peixotto fe078843a0 Make the -via-file-asm an InternalDebugOpt
We do not need to expose this flag to the user. This commit makes
the flag an interal debug option that will only display its help
when printing with --help-hidden.

llvm-svn: 196946
2013-12-10 18:49:55 +00:00
Argyrios Kyrtzidis d5ba86be0d [Driver] Rename '-objcmt-white-list-dir-path' option to '-objcmt-whitelist-dir-path' and add an alias for now.
llvm-svn: 196944
2013-12-10 18:36:53 +00:00
Argyrios Kyrtzidis 4f2ecc6177 [objcmt] Add a modernization option to infer and suggest designated initializers.
rdar://15509284

llvm-svn: 196943
2013-12-10 18:36:49 +00:00
Jordan Rose 60bd88d341 [analyzer] Extend IdenticalExprChecker to check ternary operator results.
Warn if both result expressions of a ternary operator (? :) are the same.
Because only one of them will be executed, this warning will fire even if
the expressions have side effects.

Patch by Anders Rönnholm and Per Viberg!

llvm-svn: 196937
2013-12-10 18:18:06 +00:00
Fariborz Jahanian db76577f43 Objective-C. Provide fixit's for objc_bride_related
attributed CF to ObjC type conversions.
// rdar://15499111

llvm-svn: 196935
2013-12-10 17:08:13 +00:00
Alexander Kornienko 763ec2ba45 Remove IndentBlocks, which sneaked winto the previous commit
llvm-svn: 196929
2013-12-10 15:46:42 +00:00
Alexander Kornienko fe7a57fa78 Early attempts to format in GNU style.
Summary:
This still misses a few important features, so there's no mention of
this style in the help message, but a few style rules are implemented.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 196928
2013-12-10 15:42:15 +00:00
Daniel Sanders c309be2f1f [mips][msa] Correct sld and sldi builtins.
Summary: The result register of these instructions is also the first operand.

Reviewers: jacksprat, dsanders

Reviewed By: dsanders

Differential Revision: http://llvm-reviews.chandlerc.com/D2362
Differential Revision: http://llvm-reviews.chandlerc.com/D2363

llvm-svn: 196910
2013-12-10 11:37:00 +00:00
Alexander Kornienko c1637f167c Allow predefined styles to define different options for different languages.
Summary:
Allow predefined styles to define different options for different
languages so that one can run:
  clang-format -style=google file1.cpp file2.js

or use a single .clang-format file with "BasedOnStyle: Google" for both c++ and
JS files.

Added Google style for JavaScript with "BreakBeforeTernaryOperators" set to
false.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 196909
2013-12-10 11:28:13 +00:00
Alexander Kornienko fdca83d487 Support GNU style rule to put a space before opening parenthesis.
Summary:
The rule from the GNU style states:
"We find it easier to read a program when it has spaces before the open-parentheses and after the commas."

http://www.gnu.org/prep/standards/standards.html#index-spaces-before-open_002dparen

This patch makes clang-format adds an option to put spaces before almost all open parentheses, except the cases, where different behavior is dictated by the style rules or language syntax:
  * preprocessor:
    ** function-like macro definitions can't have a space between the macro name and the parenthesis;
    ** `#if defined(...)` can have a space, but it seems, that it's more frequently used without a space in GCC, for example;
  * never add spaces after unary operators;
  * adding spaces between two opening parentheses is controlled with the `SpacesInParentheses` option;
  * never add spaces between `[` and `(` (there's no option yet).

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 196901
2013-12-10 10:18:34 +00:00
Richard Smith ab44d5badf Implement DR1460: fix handling of default initializers in unions; don't allow
more than one such initializer in a union, make mem-initializers override
default initializers for other union members, handle anonymous unions with
anonymous struct members better. Fix a couple of semi-related bugs exposed by
the tests for same.

llvm-svn: 196892
2013-12-10 08:25:00 +00:00
Kevin Qin fb79d7f843 [AArch64 NEON] Support poly128_t and implement relevant intrinsic.
llvm-svn: 196888
2013-12-10 06:49:01 +00:00
Rafael Espindola 66747221e8 Take into consideration calling convention when processing specializations.
This fixes pr18141.

llvm-svn: 196855
2013-12-10 00:59:31 +00:00
Reid Kleckner 7e6f36e29f Fix return of empty range in MSAsmStmt::children
llvm-svn: 196839
2013-12-09 23:34:56 +00:00
Fariborz Jahanian 67379e25c6 Objective-C: Improve on various diagnostics related to
use of objc_bridge_related attribute. // rdar://15499111

llvm-svn: 196828
2013-12-09 22:04:26 +00:00
Alp Toker f026635423 Remove old -fdiagnostics-show-name option
This had no effect since the feature was removed in r150612.

I actually miss this option, maybe we can bring it back some day.

llvm-svn: 196782
2013-12-09 14:34:53 +00:00
Alp Toker cfea74944a Make the -Wkeyword-compat diag message more accurate
Changed from:

  keyword '__is_empty' will be treated as an identifier for the remainder of the translation unit

To:

  keyword '__is_empty' will be made available as an identifier for the remainder of the translation unit

This is a more accurate description of clang's keyword compatibility feature,
given that some of the keywords are turned into context-sensitive keywords
(e.g. REVERTIBLE_TYPE_TRAIT) rather than being fully disabled.

llvm-svn: 196776
2013-12-09 12:41:02 +00:00
David Majnemer 2a81645de5 [-cxx-abi microsoft] Mangle large integral constants correctly
Testing has revealed that large integral constants (i.e. > INT64_MAX)
are always mangled as-if they are negative, even in places where it
would not make sense for them to be negative (like non-type template
parameters of type unsigned long long).

To address this, we change the way we model number mangling: always
mangle as-if our number is an int64_t.  This should result in correct
results when we have large unsigned numbers.

N.B.  Bizarrely, things that are 32-bit displacements like vbptr offsets
are mangled as-if they are unsigned 32-bit numbers.  This is a pretty
egregious waste of space, it would be a 4x savings if we could mangle it
like a signed 32-bit number.  Instead, we explicitly cast these
displacements to uint32_t and let the mangler proceed.

llvm-svn: 196771
2013-12-09 10:44:32 +00:00
Alp Toker cffb4869d4 Eliminate the last remaining header NDEBUG
VerifyDiagnosticConsumer is long-lived so the two additional members shouldn't
have any impact on release builds.

The clang headers are now free of NDEBUG conditionals. Let's keep it that way!

Note that they're not yet structurally stable, pending a few fixes in the LLVM
core headers.

llvm-svn: 196739
2013-12-09 00:12:56 +00:00
Faisal Vali ab3d646a9d [REFACTOR] Refactored some of the generic-lambda capturing code.
Employed the following refactorings:
  - Renamed some functions
  - Introduced explaining variables
  - Cleaned up & added comments
  - Used Optional<unsigned> for return value instead of an out parameter
  - Added assertions
  - Constified a few member functions
  
No functionality change.
All regressions pass.  

llvm-svn: 196662
2013-12-07 20:22:44 +00:00
Alp Toker c108676822 Eliminate the last trivial NDEBUG uses in clang headers
assert(sanity()) reads so much better than preprocessor conditional blocks.

llvm-svn: 196657
2013-12-07 13:51:35 +00:00
Alp Toker 3ffab05f54 CommentLexer: eliminate an NDEBUG from the headers
Code in headers shouldn't be conditional on the build configuration.

llvm-svn: 196656
2013-12-07 13:51:26 +00:00
John Thompson 87f9fef5a5 Changed ConditionValue argument to PPCallbacks If and Elif callbacks to be a 3-state enum.
llvm-svn: 196648
2013-12-07 08:41:15 +00:00
Argyrios Kyrtzidis e818681c88 Add a SubsetSubject in Attr.td to automate checking of where the objc_designated_initializer
attribute is acceptable.

llvm-svn: 196644
2013-12-07 06:08:04 +00:00
Fariborz Jahanian 1f0b3bfd75 ObjectiveC. Continuing implementation of objc_bridge_related
attribute in sema and issuing a variety of diagnostics lazily 
for misuse of this attribute (and what to do) when converting 
from CF types to ObjectiveC types (and vice versa).
// rdar://15499111

llvm-svn: 196629
2013-12-07 00:34:23 +00:00
Warren Hunt 4aafaee7df Fixing assertion failure introduced in 196602.
Also includes a minor refactor with no functional change.

llvm-svn: 196627
2013-12-07 00:15:04 +00:00
David Peixotto 3e325d7490 Add option to use temporary file for assembling with clang
This commit adds the flag '-via-file-asm' to the clang driver. The
purpose of this flag is to have a way to test that clang can consume
the assembly code that it outputs. When passed this flag, clang will
generate a temporary file that contains the assembly output from the
compile step. This assembly file will then be consumed by either the
integrated assembler or the external assembler. To test that the
integrated assembler can consume its own output compile with:

  $ clang -integrated-assembler -via-file-asm

Without the '-via-file-asm' flag, clang would directly create the
object file when using the integrated assembler. With the flag it
will first create the temporary assembly file and then read that
file and assemble it with the integrated assembler.

The flow is similar to -save-temps, except that it only effects
the assembly input and the temporary file is not saved.

llvm-svn: 196606
2013-12-06 20:27:33 +00:00
Warren Hunt 049f673dae [MS-ABI] Fix alias-avoidance padding between bases
Adds padding between bases or virtual bases in an attempt to avoid 
aliasing of zero-sized sub-objects.  The approach used by the ABI adds 
two more bits of state.  Detailed comments are in the code.  Test cases 
included.

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

llvm-svn: 196602
2013-12-06 19:54:25 +00:00
Aaron Ballman ba0aea16e1 Turning the __w64 attribute into an ignored attribute to match other Microsoft extensions we do not currently support. Note that __w64 has been deprecated in MSVC since 2008.
llvm-svn: 196592
2013-12-06 18:56:03 +00:00
Argyrios Kyrtzidis 0e282ef868 [libclang] Rename CXSkippedRanges to CXSourceRangeList to make it more future-proof.
Suggested by Alp Toker.

llvm-svn: 196591
2013-12-06 18:55:45 +00:00
Diego Novillo 67fe87fc5e Add flag -fauto-profile as alias to -fprofile-sample-use.
Summary:
GCC uses -fauto-profile to enable sample-based PGO. This patch
adds it to Clang as an alias for -fprofile-sample-use.

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

llvm-svn: 196589
2013-12-06 17:58:19 +00:00
Alp Toker 028ed91127 Fix code typos spotted while working on type traits
llvm-svn: 196587
2013-12-06 17:56:43 +00:00
Aaron Ballman a40bef25ee Reverting changes from r196415; this patch exposed a different, but unrelated bug regarding the __has_attribute implementation. Reverting to unblock the Chrome tsan builds.
llvm-svn: 196583
2013-12-06 15:58:47 +00:00
Daniel Jasper 3cd34c7637 Allow string literals as module names.
In order to make the migration to modules easier, it seems to be helpful
to allow a 1:1 mapping between target names of a current build system
and the corresponding C++ modules. As  such targets commonly contain
characters like "-". ":" and "/", allowing arbitrary quote-escaped
strings seems to be a straightforward option.

After several offline discussions, the precise mechanisms for C++
module names especially regarding submodules and import statements has
yet to be determined. Thus, this patch only enables string literals as
names inside the module map files which can be used by automatic module
import (through #include).

Also improve the error message on missing use-declarations.

llvm-svn: 196573
2013-12-06 09:25:54 +00:00
Richard Smith c275da6a14 PR18152: When computing the semantic form for an initializer list, keep track
of whether the initializer list is dependent.

llvm-svn: 196558
2013-12-06 01:27:24 +00:00
Warren Hunt 7b252d24ad Support MS-ABI's concept of "Required Alignment" imposed by
__declspec(align())

This patch implements required alignment in a way that makes 
__declspec(align()) and #pragma pack play correctly together. In the 
MS-ABI, __declspec(align()) is a hard rule and cannot be overridden by 
#pragma pack. This cases each record to have two interesting alignments 
"preferred alignment" (which matches Itanium's concept of alignment) and 
"required alignment" which is an alignment that must never be violated, 
even in the case of #pragma pack. This patch introduces the concept of 
Required Alignment to the record builder and tracks/uses it 
appropriately. Test cases are included.

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

llvm-svn: 196549
2013-12-06 00:01:17 +00:00
Ana Pazos 6a8b8b5f0d Implemented vget/vset_lane_f16 intrinsics
llvm-svn: 196535
2013-12-05 21:13:24 +00:00
Argyrios Kyrtzidis 9ef5775a94 [libclang] Record ranges skipped by the preprocessor and expose them with libclang.
Patch by Erik Verbruggen!

llvm-svn: 196487
2013-12-05 08:19:32 +00:00
Richard Smith a230224be4 Implement DR482: namespace members can be redeclared with a qualified name
within their namespace, and such a redeclaration isn't required to be a
definition any more.

Update DR status page to say Clang 3.4 instead of SVN and add new Clang 3.5
category (but keep Clang 3.4 yellow for now).

llvm-svn: 196481
2013-12-05 07:51:02 +00:00
Alp Toker beccbb84ad Fix comment typo in r196476
llvm-svn: 196477
2013-12-05 07:16:23 +00:00
Argyrios Kyrtzidis b9a405b33e [objc] If an interface has no initializer marked as designated and introduces at least one new initializer,
don't assume that it inherits the designated initializers from the super class.

If the assumption was wrong because a new initializer was a designated one that was not marked as such,
we will emit misleading warnings for subclasses of the interface.

llvm-svn: 196476
2013-12-05 07:07:03 +00:00
Alp Toker d473363876 Correct hyphenations in comments and assert messages
This patch tries to avoid unrelated changes other than fixing a few
hyphen-related ambiguities in nearby lines.

llvm-svn: 196466
2013-12-05 04:47:09 +00:00
Richard Smith 72bcaeca1d Per [dcl.meaning]p1, a name in an inline namespace can be redeclared using a
name from the enclosing namespace set if the name is specified as a
qualified-id.

llvm-svn: 196464
2013-12-05 04:30:04 +00:00
Faisal Vali 5fb7c3c4ed Fix init-captures for generic lambdas.
For an init capture, process the initialization expression
right away.  For lambda init-captures such as the following:
const int x = 10;
 auto L = [i = x+1](int a) {
   return [j = x+2,
          &k = x](char b) { };
 };
keep in mind that each lambda init-capture has to have:
 - its initialization expression executed in the context
   of the enclosing/parent decl-context.
 - but the variable itself has to be 'injected' into the
   decl-context of its lambda's call-operator (which has
   not yet been created).
Each init-expression is a full-expression that has to get
Sema-analyzed (for capturing etc.) before its lambda's
call-operator's decl-context, scope & scopeinfo are pushed on their
respective stacks.  Thus if any variable is odr-used in the init-capture
it will correctly get captured in the enclosing lambda, if one exists.
The init-variables above are created later once the lambdascope and
call-operators decl-context is pushed onto its respective stack.

Since the lambda init-capture's initializer expression occurs in the
context of the enclosing function or lambda, therefore we can not wait
till a lambda scope has been pushed on before deciding whether the
variable needs to be captured.  We also need to process all
lvalue-to-rvalue conversions and discarded-value conversions,
so that we can avoid capturing certain constant variables.
For e.g.,
 void test() {
  const int x = 10;
  auto L = [&z = x](char a) { <-- don't capture by the current lambda
    return [y = x](int i) { <-- don't capture by enclosing lambda
         return y;
    }
  };
If x was not const, the second use would require 'L' to capture, and
that would be an error.
Make sure TranformLambdaExpr is also aware of this.

Patch approved by Richard (Thanks!!) 
http://llvm-reviews.chandlerc.com/D2092

llvm-svn: 196454
2013-12-05 01:40:41 +00:00
Reid Kleckner 0503a870a9 Add an AdjustedType sugar node for adjusting calling conventions
Summary:
In general, this type node can be used to represent any type adjustment
that occurs implicitly without losing type sugar.  The immediate use of
this is to adjust the calling conventions of member function pointer
types without breaking template instantiation.

Fixes PR17996.

Reviewers: rsmith

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

llvm-svn: 196451
2013-12-05 01:23:43 +00:00
Mark Lacey d33ff74b19 Simplify the constructor to CodeGenABITypes.
The CodeGenOptions are not used for ABI type selection, so we will just
create one with the default constructor (there is a FloatABI option in
CodeGenOptions that is passed on to LLVM, but not used in Clang for LLVM
IR type generation).

We can use the DiagnosticsEngine on the ASTContext rather than making a
client pass one in explicitly.

llvm-svn: 196450
2013-12-05 01:23:01 +00:00
Richard Smith d091dc179d Reject template-ids containing literal-operator-ids that have a dependent
nested-name-specifier, rather than crashing. (In fact, reject all
literal-operator-ids that have a non-namespace nested-name-specifier). The
grammar doesn't allow these in some cases, and in other cases does allow them
but instantiation will always fail.

llvm-svn: 196443
2013-12-05 00:58:33 +00:00
Aaron Ballman 8b9e236bb4 Giving a Subjects list to DllExport, which allows the removal of some custom semantic handling. The same cannot be done for DllImport, and so comments were left explaining why.
llvm-svn: 196429
2013-12-04 23:23:19 +00:00
Aaron Ballman b4c112338f The MSP430Interrupt attribute does have a sema handler (it's in TargetAttributesSema). Added a FIXME about the attribute being nameless when it really does have a valid name, and a comment explaining why we're using the name instead of the attribute kind.
llvm-svn: 196420
2013-12-04 22:23:43 +00:00
Aaron Ballman 3001339783 This attribute somehow remained nameless in the attribute tablegen, until now.
llvm-svn: 196415
2013-12-04 21:43:30 +00:00
Rafael Espindola 85a657601b Remove empty header.
llvm-svn: 196410
2013-12-04 20:44:03 +00:00
Fariborz Jahanian 1a2519a7e9 ObjectiveC - Introducing objc_bridge_related attribute
which specifies couple of (optional) method selectors
for bridging a CFobject to or from an ObjectiveC 
object. This is wip. // rdsr://15499111

llvm-svn: 196408
2013-12-04 20:32:50 +00:00
Richard Smith 711ee8381e Fix indentation.
llvm-svn: 196406
2013-12-04 20:05:45 +00:00
Reid Kleckner 739756c0f9 [ms-cxxabi] Construct and destroy call arguments in the correct order
Summary:
MSVC destroys arguments in the callee from left to right.  Because C++
objects have to be destroyed in the reverse order of construction, Clang
has to construct arguments from right to left and destroy arguments from
left to right.

This patch fixes the ordering by reversing the order of evaluation of
all call arguments under the MS C++ ABI.

Fixes PR18035.

Reviewers: rsmith

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

llvm-svn: 196402
2013-12-04 19:23:12 +00:00
NAKAMURA Takumi ddc867985a Revert r196372, "do not warn about unknown pragmas in modes that do not handle them (pr9537)"
It broke clang tests on some hosts with +Asserts. Seems "STDC" clashes.

llvm-svn: 196376
2013-12-04 11:12:26 +00:00
Lubos Lunak 5c4269c688 do not warn about unknown pragmas in modes that do not handle them (pr9537)
And refactor to have just one place in code that sets up the empty
pragma handlers.

llvm-svn: 196372
2013-12-04 10:21:41 +00:00
Kevin Qin 8903f8df4b [AArch64 NEON] Add missing compare intrinsics.
llvm-svn: 196359
2013-12-04 07:53:09 +00:00
Faisal Vali cb7e5df97e Fix PR17637: incorrect calculation of template parameter depth
In delayed template parsing mode, adjust the template depth counter for each template parameter list associated with an out of line member template specialization.

llvm-svn: 196351
2013-12-04 03:51:14 +00:00
Richard Smith f95fe9b870 Fix crash if a variable template specialization is used in a nested-name-specifier.
llvm-svn: 196335
2013-12-04 00:47:45 +00:00
Richard Smith 72bfbd8615 Fix several crash-on-invalids when using template-ids that aren't
simple-template-ids (eg, 'operator+<int>') in weird places.

llvm-svn: 196333
2013-12-04 00:28:23 +00:00
Argyrios Kyrtzidis db5ce0f71e [objc] Add a warning when a class that provides a designated initializer, does not
override all of the designated initializers of its superclass.

llvm-svn: 196319
2013-12-03 21:11:54 +00:00
Argyrios Kyrtzidis b66d3cf5cf [objc] Emit warning when the implementation of a secondary initializer calls on
super another initializer and when the implementation does not delegate to
another initializer via a call on 'self'.

A secondary initializer is an initializer method not marked as a designated
initializer within a class that has at least one initializer marked as a
designated initializer.

llvm-svn: 196318
2013-12-03 21:11:49 +00:00
Argyrios Kyrtzidis fcded9b93a [objc] Emit warnings when the implementation of a designated initializer calls on
super an initializer that is not a designated one or any initializer on self.

llvm-svn: 196317
2013-12-03 21:11:43 +00:00
Argyrios Kyrtzidis 22bfa2c28b [objc] Emit a warning when the implementation of a designated initializer does not chain to
an init method that is a designated initializer for the superclass.

llvm-svn: 196316
2013-12-03 21:11:36 +00:00
Argyrios Kyrtzidis 9ed9e5f31c [objc] Introduce ObjCInterfaceDecl::getDesignatedInitializers() to get the
designated initializers of an interface.

If the interface declaration does not have methods marked as designated
initializers then the interface inherits the designated initializers of
its super class.

llvm-svn: 196315
2013-12-03 21:11:30 +00:00
Argyrios Kyrtzidis d1438b446e [objc] Introduce attribute 'objc_designated_initializer'.
It only applies to methods of init family in an interface declaration.

llvm-svn: 196314
2013-12-03 21:11:25 +00:00
Daniel Jasper 7371092d25 clang-format: Improve clang-format's documentation of ColumnLimit=0.
llvm-svn: 196297
2013-12-03 17:21:57 +00:00