Commit Graph

49347 Commits

Author SHA1 Message Date
David Peixotto fc004bdd49 Fix test case inefficiency
Was accidently passing the file to clang twice. No functionaly change.

llvm-svn: 196608
2013-12-06 20:42:24 +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 71140d68f8 [MS-ABI] adds padding before all vbases after a bitfield
MS-ABI adds padding before *every* vbase if the last field in a record 
is a bit-field. This changes clangs behavior to match. I also fix some 
windows-style line endings in the test file.

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

llvm-svn: 196605
2013-12-06 20:16:49 +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
Anna Zaks f5308fac1e Fixup to r196593.
This is another regression fixed by reverting r189090.

In this case, the problem is not live variables but the approach that was taken in r189090. This regression was caused by explicitly binding "true" to the condition when we take the true branch. Normally that's okay, but in this case we're planning to reuse that condition as the value of the expression.

llvm-svn: 196599
2013-12-06 19:28:16 +00:00
Anna Zaks cf8d2165ff Revert "[analyzer] Refactor conditional expression evaluating code"
This reverts commit r189090.

The original patch introduced regressions (see the added live-variables.* tests). The patch depends on the correctness of live variable analyses, which are not computed correctly. I've opened PR18159 to track the proper resolution to this problem.

The patch was a stepping block to r189746. This is why part of the patch reverts temporary destructor tests that started crashing. The temporary destructors feature is disabled by default.

llvm-svn: 196593
2013-12-06 18:56:29 +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
Roman Divacky 326d998cfa Move the body of GCCInstallationDetector ctor into an init() function
and call it from its only user. The linux toolchain. This saves quite
a lot of directory searching on other platforms.

llvm-svn: 196590
2013-12-06 18:32:18 +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 9e26485412 Tweak the ordering of a conditional to possibly avoid a few strcmps.
llvm-svn: 196584
2013-12-06 16:26:55 +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 e0ab9e7936 clang-format: Change line break decisions for array subscripts.
Before:
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<int> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      [aaaaaaaaaaaa];
After:
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<int>
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaa];

llvm-svn: 196582
2013-12-06 15:19:50 +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
Alp Toker 05f894358a Add introductory paragraph to the C++ status page
Use internal links to provide easier access to recent and ongoing work.

Also shift up the order of standards in the page title in order to avoid web
search results focusing on C++98 in the summary.

This is done to highlight the modern standards support in clang that was
previously languishing at the bottom of the page.

  "C++98/03 is sooooo yesterday" - dgregor

llvm-svn: 196565
2013-12-06 06:35:49 +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
Dmitri Gribenko e6ac50ad71 -Wassign-enum: compare unqualified types
This commit changes -Wassign-enum to compare unqualified types.  One could
think that this does not matter much, because who wants a value of enum type
that is const-qualified?  But this breaks the intended pattern to silence this
warning with an explicit cast:

    static const enum Foo z = (enum Foo) 42;

In this case, source type is 'enum Foo', and destination type is 'const enum
Foo', and if we compare qualified types, they don't match, so we used warn.

llvm-svn: 196548
2013-12-05 23:06:53 +00:00
Dmitri Gribenko 58683755ed Allow the warning 'case value not in enumerated type' to be silenced with
the following pattern.

If 'case' expression refers to a static const variable of the correct enum
type, then we count this as a sufficient declaration of intent by the user,
so we silence the warning.

llvm-svn: 196546
2013-12-05 22:52:07 +00:00
Reid Kleckner ae9451218f [ms-cxxabi] bitcast to i8* to deref a data member pointer
This was causing us to miscompile
llvm::SymbolTableListTraits::getListOwner(), which uses data member
pointers.

llvm-svn: 196545
2013-12-05 22:44:07 +00:00
Joerg Sonnenberger 706c28163b For NetBSD, use arm1176jzf-s as default CPU for ARMv6.
llvm-svn: 196538
2013-12-05 21:27:58 +00:00
Ana Pazos 6a8b8b5f0d Implemented vget/vset_lane_f16 intrinsics
llvm-svn: 196535
2013-12-05 21:13:24 +00:00
Richard Smith e7f5249913 Mark auto-generated file as auto-generated, as suggested by Alp.
llvm-svn: 196534
2013-12-05 21:08:20 +00:00
Joerg Sonnenberger 1f94da5a9b Pass down the target CPU to the system assembler for NetBSD/ARM.
llvm-svn: 196532
2013-12-05 21:07:29 +00:00
Fariborz Jahanian f3077a29ce ObjectiveC: Don't warn when method implemented in
category is declared in category's primary
class's super class. Because the super class is
expected to implemented the method. // rdar://15580969

llvm-svn: 196531
2013-12-05 20:52:31 +00:00
Argyrios Kyrtzidis 5899e8916b [c-index-test] For the '-remap-file' option use a comma for separator which is more
Windows friendly than the colon.

llvm-svn: 196529
2013-12-05 20:13:27 +00:00
Bob Wilson 83e723a9c9 Fix assertion failure left over from changes to move away from "darwin" triples.
I happened to notice this while trying to write a test for an iOS simulator
target. I suspect we just missed this when we added separate "macosx" and "ios"
triples instead of the generic "darwin" OS.

llvm-svn: 196527
2013-12-05 19:38:42 +00:00
Alp Toker a31d1dd179 AttributeList: tweak the conditional order to avoid two strcmps
llvm-svn: 196518
2013-12-05 18:04:42 +00:00
Hans Wennborg 6a3816a66f clang-format vsix cmake build: use ${LLVM_TOOLS_BINARY_DIR}/${CMAKE_CFG_INTDIR}
as the location for grabbing clang-format.exe, and also output the .vsix here.

This allows us to find clang-format.exe when building from a MSVC Solution.

llvm-svn: 196512
2013-12-05 17:49:58 +00:00
Alp Toker 52937abc8b Check the initial line number without going through PresumedLoc
No practical difference in this case and would return 1 either way, but this is
more self-explanatory.

llvm-svn: 196511
2013-12-05 17:28:42 +00:00
Alp Toker f6a24ce40f Fix a tranche of comment, test and doc typos
llvm-svn: 196510
2013-12-05 16:25:25 +00:00
Richard Smith f03bd30854 PR17983: Fix crasher bug in C++1y mode when performing a non-global array
delete on a class which has no array cookie and has no class-specific operator
new.

llvm-svn: 196488
2013-12-05 08:30:59 +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
Argyrios Kyrtzidis 011e6a5f44 [c-index-test] Enhance perform_test_reparse_source() to allow remapping a file
at a particular reparsing iteration.

Passing '-remap-file-1=from:to' will remap the files in the second iteration.

llvm-svn: 196486
2013-12-05 08:19:23 +00:00
Argyrios Kyrtzidis a60d8ae09d [c-index-test] For the '-remap-file=' option use ':' instead of ';' for separator.
lldb does not like semicolon as part of an option.

llvm-svn: 196485
2013-12-05 08:19:18 +00:00
Alp Toker fcf30326fd clang-format-diff.py: pass through errors to stderr, not stdout
Also use write() for unified diff output to avoid further processing by the
print function (e.g. trailing newline).

llvm-svn: 196484
2013-12-05 08:14:54 +00:00
Richard Smith 28b1939849 Update C++ status from 'SVN' to 'Clang 3.4' in preparation for release. Leave
boxes yellow until we release, though.

llvm-svn: 196482
2013-12-05 07:52:05 +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
Richard Trieu e99bb4b2b9 Fixed a bad assert from r194968. r194969 removed the assert.
llvm-svn: 196463
2013-12-05 04:27:16 +00:00
Alp Toker f580a3cc05 Add an assert to make it clear we're on the first line
A raw lexer in its initial state is guaranteed to be on line number one.

llvm-svn: 196461
2013-12-05 03:41:20 +00:00
Richard Trieu 314a27360c Remove unused variable.
llvm-svn: 196459
2013-12-05 02:52:09 +00:00
Reid Kleckner 06bd7e64b9 Fix non-MSVC build error in ASTContext::getAdjustedType
Use FunctionTypeUnwrapper like we do in AttributedType to try to keep
some sugar.  We can actually do one better here in the future by
avoiding the AdjustedType node altogether when no sugar would be lost.

llvm-svn: 196455
2013-12-05 01:41:37 +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
David Majnemer 3252fd0d5b Parse: Recover better from bad definitions with base specifiers
We would skip until the next comma, hoping good things whould lie there,
however this would fail when we have such things as this:

struct A {};
template <typename>
struct D;
template <>
struct D<C> : B, A::D;

Once this happens, we would believe that D with a nested namespace
specifier of A was a variable that was being declared. We would go on
to complain that there was an extraneous 'template <>' on their variable
declaration.

Crashes would happen when 'A' gets defined as 'enum class A {}' as
various asserts would fire.

Instead, we should skip up until the semicolon if we see that we are in
the middle of a definition and the current token is a ':'

This fixes PR17084.

llvm-svn: 196453
2013-12-05 01:36:53 +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