Commit Graph

48197 Commits

Author SHA1 Message Date
Eli Friedman 1f5d8882f9 Fix -Wmissing-variable-declarations regression.
This issue was introduced in r181677.

PR17349.

llvm-svn: 191339
2013-09-24 23:10:08 +00:00
Richard Smith 5acb759f39 Avoid a signed/unsigned comparison warning with compilers that don't know how
to handle constant expressions.

llvm-svn: 191336
2013-09-24 22:13:21 +00:00
Fariborz Jahanian 7797c0d0f7 ObjectiveC migrator: provide space between the property
keyword and the rest on suggested property. // rdar://15069044

llvm-svn: 191335
2013-09-24 21:27:58 +00:00
Fariborz Jahanian aaabfcdffe ObjectiveC migrator: Another test for my last patch.
// rdar://15044991

llvm-svn: 191334
2013-09-24 20:31:24 +00:00
Fariborz Jahanian 10b7435ceb ObjectiveC migrator: iDOn't mangle names when
NS_RETURNS_INNER_POINTER annotation is suggested on
a property. // rdar://15044991

llvm-svn: 191332
2013-09-24 20:20:52 +00:00
Rafael Espindola 4f3f5ade54 Produce an error for unknown -m options.
llvm-svn: 191328
2013-09-24 19:35:01 +00:00
Yunzhong Gao 1f6aeebe76 Adding -mtbm and -mno-tbm command line options to the clang front end for the
x86 TBM instruction set. Also adding a __TBM__ macro if the TBM feature is
enabled. Otherwise there should be no functionality change to existing features.

Phabricator code review is located here: http://llvm-reviews.chandlerc.com/D1693

llvm-svn: 191326
2013-09-24 19:00:58 +00:00
Hans Wennborg b6331dcb51 clang-cl: fix passing optimization level to cl.exe in /fallback mode
We were previously mostly passing it through, but -O0 and -O3 are not valid
options to cl.exe.

We should translate -O0 to /Od and -O3 to /Ox. -O{1,2,s} get passed through.

llvm-svn: 191323
2013-09-24 18:17:21 +00:00
Hans Wennborg 263c213061 clang-cl: pass /nologo when falling back to cl.exe
llvm-svn: 191316
2013-09-24 17:36:21 +00:00
Fariborz Jahanian 0dded8ab04 Revert my patch in r191155 to allow forward
class/protocol decls in @implementation and
fixup modern rewriter to handle that.
// rdar://15066233

llvm-svn: 191311
2013-09-24 17:03:07 +00:00
Rafael Espindola 96a051367b Use a valid option (-msse) for testing QA_OVERRIDE_GCC3_OPTIONS.
llvm-svn: 191300
2013-09-24 13:37:21 +00:00
Rafael Espindola bfd88f2c7e Remove a use of OPT_m_Joined.
This patch turns the -mv* hexagon options into aliases. We should really produce
errors for invalid versions in the driver, but this patch preserves the old
behavior for now.

llvm-svn: 191298
2013-09-24 13:28:24 +00:00
Daniel Jasper 9a59e2c688 Fix uninitialized value bug discovered buy msan buildbot.
llvm-svn: 191292
2013-09-24 12:30:27 +00:00
Daniel Jasper ca9f73812c Add -fmodule-map-file option.
With this option, arbitrarily named module map files can be specified
to be loaded as required for headers in the respective (sub)directories.

This, together with the extern module declaration allows for specifying
module maps in a modular fashion without the need for files called
"module.map".

Among other things, this allows a directory to contain two modules that
are completely independent of one another.

Review: http://llvm-reviews.chandlerc.com/D1697.
llvm-svn: 191284
2013-09-24 09:27:13 +00:00
Daniel Jasper ba7f2f7110 Module use declarations (II)
Review: http://llvm-reviews.chandlerc.com/D1546.

I have picked up this patch form Lawrence
(http://llvm-reviews.chandlerc.com/D1063) and did a few changes.

From the original change description (updated as appropriate):
This patch adds a check that ensures that modules only use modules they
have so declared. To this end, it adds a statement on intended module
use to the module.map grammar:

  use module-id

A module can then only use headers from other modules if it 'uses' them.
This enforcement is off by default, but may be turned on with the new
option -fmodules-decluse.

When enforcing the module semantics, we also need to consider a source
file part of a module. This is achieved with a compiler option

-fmodule-name=<module-id>.

The compiler at present only applies restrictions to the module directly
being built.

llvm-svn: 191283
2013-09-24 09:14:14 +00:00
Simon Atanasyan 22127cee34 [Mips] Support -mnan=2008 option. Define "__mips_nan2008" macros and pass
this option to the assembler.

llvm-svn: 191282
2013-09-24 09:09:16 +00:00
Richard Smith b12cf6ceb7 Hopefully unbreak bots which are seeing an assert in this test. Temporary, real
fix to come once I've tracked down the problem (which is pre-existing and not
related to the change which introduced this test).

llvm-svn: 191279
2013-09-24 05:07:58 +00:00
Richard Smith 300e0c36a3 Implement restriction that a partial specialization must actually specialize
something, for variable templates.

llvm-svn: 191278
2013-09-24 04:49:23 +00:00
NAKAMURA Takumi 788af10a8a CGBuiltin.cpp: Prune a stray default: label. [-Wcovered-switch-default]
llvm-svn: 191277
2013-09-24 04:37:50 +00:00
Richard Smith 2a98862be2 Handle standard libraries that miss out the space when defining the standard
literal operators. Also, for now, allow the proposed C++1y "il", "i", and "if"
suffixes too. (Will revert the latter if LWG decides not to go ahead with that
change after all.)

llvm-svn: 191274
2013-09-24 04:06:10 +00:00
Alexey Bataev 756c196f14 [OPENMP] Bug fixes and improvements.
1. Fixed constructor of shared clause.
2. Some macros for clauses processing are replaced by private template methods.
3. Additional checks in sema analysis of OpenMP clauses.

llvm-svn: 191265
2013-09-24 03:17:45 +00:00
Jiangning Liu 036f16dc8c Initial support for Neon scalar instructions.
Patch by Ana Pazos.

1.Added support for v1ix and v1fx types.
2.Added Scalar Pairwise Reduce instructions.
3.Added initial implementation of Scalar Arithmetic instructions.

llvm-svn: 191264
2013-09-24 02:48:06 +00:00
Rafael Espindola 25f007f054 Remove unused option.
gcc doesn't support "gcc -m sse" and this was not tested in clang and only
used for link argument on darwin, so this was very likely just a bug.

llvm-svn: 191251
2013-09-24 00:10:56 +00:00
Hans Wennborg f4aee18086 clang-cl: print diagnostics as "error(clang): foo" in /fallback mode
This solves two problems:

1) MSBuild will not flag the build as unsuccessful just because we print
   an error in the output, since "error(clang):" doesn't seem to match
   the regex it's using.

2) It becomes more clear that the diagnostic is coming from clang as
   supposed to cl.exe.

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

llvm-svn: 191250
2013-09-24 00:08:55 +00:00
Rafael Espindola 8a2d496e18 Produce errors for unknown options.
This doesn't change a lot since clang still thinks it knows all of the
-f*, -m* and -W* options for example.

Other than the options clang explicitly claims to know, this fixes pr9701.

llvm-svn: 191249
2013-09-23 23:55:25 +00:00
Eli Friedman 3cd55f49ab Fix argument types of some AVX2 intrinsics.
This fix makes our headers consistent with gcc.

PR17312.

llvm-svn: 191248
2013-09-23 23:52:04 +00:00
Fariborz Jahanian 1a73b8f7d2 Remove extra space.
llvm-svn: 191246
2013-09-23 23:48:04 +00:00
Rafael Espindola 52ddfb3c16 Fix an incomplete copy and paste in my previous patch.
llvm-svn: 191245
2013-09-23 23:43:34 +00:00
Eli Friedman f9d8c6cebb Add _mm_stream_si64 intrinsic.
While I'm here, also fix the alignment computation for the whole family of
intrinsics.

PR17298.

llvm-svn: 191243
2013-09-23 23:38:39 +00:00
Rafael Espindola 05ccc50ba4 Add tests on how clang currently handles some unknown options.
This is not to say this is the desired behavior, but it makes sure we notice
if it changes.

llvm-svn: 191242
2013-09-23 23:27:32 +00:00
Fariborz Jahanian c71eb6adc3 ObjectiveC migrator. When migrating to property declaration
use Cocoa's naming convention for properties of ObjC
object type. // rdar://15045005

llvm-svn: 191240
2013-09-23 23:18:46 +00:00
Richard Smith 0b5511971e Revert change accidentally committed in r191150.
llvm-svn: 191237
2013-09-23 23:12:22 +00:00
Fariborz Jahanian 02bdb16524 ObjectiveC migrator: Infer NS_OPTIONS when if there is at
least one hex enumerator, all others are also
hex enumerator (0 enumerator is excepted). 
// rdar://15044304

llvm-svn: 191222
2013-09-23 20:27:06 +00:00
Kostya Serebryany bedc616804 Enable -fsanitize=use-after-return by default under -fsanitize=address
Summary:
We enable ASAN's use-after-return instrumentation at compile-time,
but still keep it disabled at run-time.
This enables the users to flip the flag at run-time using environment variable
ASAN_OPTIONS=detect_stack_use_after_return=1 instead of using a separate build.
If UAR detection is disabled at run-time, this extra compile-time instrumentation
costs very small slowdown. On SPEC 2006 14 tests are not affected at all,
4 tests get ~ 1% slowdown and 453.povray gets 4%.

Reviewers: samsonov

Reviewed By: samsonov

CC: llvm-commits

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

llvm-svn: 191186
2013-09-23 09:52:37 +00:00
Richard Smith 90061908f6 PR16529: Don't forget to add the CXXFunctionalCastExpr type sugar to an
InitListExpr for a C++11-style T{...} construction, if initialization
registered a destructor for it.

llvm-svn: 191182
2013-09-23 02:20:00 +00:00
Benjamin Kramer b8f33f1690 Make sort predicate match the qsort convention.
llvm-svn: 191177
2013-09-22 15:02:02 +00:00
Benjamin Kramer 04bf187e12 Fix array_pod_sort predicates after LLVM change.
llvm-svn: 191176
2013-09-22 14:10:29 +00:00
Benjamin Kramer 402f807d9d array_pod_sort loses some type safety, better use the right types.
llvm-svn: 191174
2013-09-22 12:53:24 +00:00
Benjamin Kramer a92b80f8a0 Rewrite a cold use of std::sort to array_pod_sort.
No functionality change.

llvm-svn: 191173
2013-09-22 12:41:24 +00:00
Nick Lewycky e2b2caaded Fix comment to match name of variable.
llvm-svn: 191171
2013-09-22 10:07:22 +00:00
Nick Lewycky 0f29289bb4 Simplify code to equivalent code. No need to test for null after cast<>, use
takeAs<> instead of cast<>(.take()). Fix 80-column violation in whitespace after
comment.

llvm-svn: 191170
2013-09-22 10:06:57 +00:00
Nick Lewycky ed4265c24e Fix typo. Add missing whitespace. No functionality change.
llvm-svn: 191169
2013-09-22 10:06:01 +00:00
David Majnemer 338a770eb9 Parse: Move simple-type-specifier sanity check earlier
No functional change, just makes the error handling a bit more obvious.

llvm-svn: 191162
2013-09-22 03:30:01 +00:00
David Majnemer a5e92556ac Parse: Don't crash during parsing if we lack a simple-type-specifier
Summary:
Parsing cast expressions during error recovery can put us in a bad
state.  Check to see if the token for a simple-type-specifier makes
sense before further parsing.

Fixes PR17255.

Reviewers: rsmith, doug.gregor, CornedBee, eli.friedman

CC: cfe-commits

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

llvm-svn: 191159
2013-09-22 01:24:26 +00:00
Fariborz Jahanian aa78931e91 ObjectiveC: ObjC declarations, including forward class
and protocols can be at global scope only.

llvm-svn: 191155
2013-09-22 00:02:16 +00:00
Richard Smith 089c31637f PR17295: Do not allow explicit conversion functions to be used in cases where
an additional conversion (other than a qualification conversion) would be
required after the explicit conversion.

Conversely, do allow explicit conversion functions to be used when initializing
a temporary for a reference binding in direct-list-initialization.

llvm-svn: 191150
2013-09-21 21:55:46 +00:00
Richard Smith 6c6ddabf7b Some comment updates and tweaks for clarity.
llvm-svn: 191147
2013-09-21 21:23:47 +00:00
Richard Smith aaa0ec45fe Rearrange narrowing checks in initialization to be a different form of step
rather than a post-processing action, so we can support inserting these checks
at stages other than the end of the initialization. No functionality change
intended.

llvm-svn: 191146
2013-09-21 21:19:19 +00:00
Daniel Jasper df620b2457 clang-format: Improve address-of-operator detection
Before:
  size = sizeof * a;

After:
  size = sizeof *a;

llvm-svn: 191139
2013-09-21 17:31:51 +00:00
Daniel Jasper cf627f0f7b Fix clang-format-diff.py to accept -style again.
Copy and paste error in r190935..

llvm-svn: 191137
2013-09-21 10:05:02 +00:00
Petar Jovanovic c19a284182 [Mips] Allocate NaClTargetInfo for MIPSEL NaCl
A patch to AllocateTarget function to recognize llvm::Triple::NaCl for
MIPSEL and return NaClTargetInfo. Additional test has been added to check
if the expected macros get defined.

llvm-svn: 191124
2013-09-21 01:27:01 +00:00
Eli Friedman 9b04f41899 Fix return type of _mm_extract_epi8 etc.
PR17300.

llvm-svn: 191120
2013-09-21 00:05:25 +00:00
Chandler Carruth 2c93cb2a6f Switch tests in test/Headers to use %clang_cc1 rather than %clang. There
is no need to go through the driver indirection here, and it clutters
things up as dependencies can sneak in for specific things the driver is
doing.

llvm-svn: 191107
2013-09-20 21:12:25 +00:00
Richard Smith 4e0d2e41b7 Refactor: CheckExplicitInitList is only called to check an entire InitListExpr,
so the Index in/out parameters are pointless (always passed in as 0, always
ignored by the caller).

llvm-svn: 191103
2013-09-20 20:10:22 +00:00
Hans Wennborg 188382eba5 clang-cl: implement custom search for cl.exe in /fallback mode
This solves the problem of fallback onto ourselves if clang-cl
has been renamed to cl.exe and put on the PATH, as happens with
the VS integration.

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

llvm-svn: 191099
2013-09-20 18:16:35 +00:00
Reid Kleckner 1784d2fc9c Update -fmsc-version docs for r190908, which set the default to 1700
llvm-svn: 191098
2013-09-20 18:01:52 +00:00
Reid Kleckner eb248d7fd8 Fix ReST links I just added to the manual
llvm-svn: 191097
2013-09-20 17:54:39 +00:00
Reid Kleckner d128f8a252 Clarify that we silently ignore some MS extensions like IDL attributes
llvm-svn: 191096
2013-09-20 17:51:00 +00:00
Reid Kleckner 993e72a68e Use -fms-compatibility to trigger lookup into dep. bases
Update the docs for -fms-extensions and -fms-compatibility to try to
clarify the difference between the two.

llvm-svn: 191095
2013-09-20 17:04:25 +00:00
Jordan Rose 5770c038fe [analyzer] Use getParentIgnoreParenCasts instead of doing it by hand.
Apart from being more compact and already implemented, this also handles the
case where the parent is null. (It does also ignore all casts, not just
implicit ones, but this is more efficient to test and in the case we care
about---a message in a PseudoObjectExpr---there should only be implicit casts
anyway.

This should fix our internal buildbot.

llvm-svn: 191094
2013-09-20 16:51:50 +00:00
Alexander Potapenko 4462c5b5d6 [ASan] Fix darwin-sanitizer-ld.c to test for the new order of linker flags introduced by r191076.
llvm-svn: 191077
2013-09-20 08:23:19 +00:00
Alexander Potapenko ce87633ff9 [ASan] Do not imply -undefined dynamic_lookup when linking dylibs with -fsanitize=address.
Instead add the ASan runtime to the linker command line so that only the ASan API functions can be undefined in the target library.

Fixes http://llvm.org/bugs/show_bug.cgi?id=17275

llvm-svn: 191076
2013-09-20 08:09:51 +00:00
Richard Trieu 406e65c8d1 Modify the uninitialized field visitor to detect uninitialized use across the
fields in the class.  This allows a better checking of member intiailizers and
in class initializers in regards to initialization ordering.

For instance, this code will now produce warnings:

class A {
  int x;
  int y;
  A() : x(y) {}  // y is initialized after x, warn here
  A(int): y(x) {} // default initialization of leaves x uninitialized, warn here
};

Several test cases were updated with -Wno-uninitialized to silence this warning.

llvm-svn: 191068
2013-09-20 03:03:06 +00:00
Richard Smith b8c65f0136 Testcase I forgot to svn add in r191057.
llvm-svn: 191067
2013-09-20 02:48:08 +00:00
Richard Smith 541b38be7b Switch the semantic DeclContext for a block-scope declaration of a function or
variable from being the function to being the enclosing namespace scope (in
C++) or the TU (in C). This allows us to fix a selection of related issues
where we would build incorrect redeclaration chains for such declarations, and
fail to notice type mismatches.

Such declarations are put into a new IdentifierNamespace, IDNS_LocalExtern,
which is only found when searching scopes, and not found when searching
DeclContexts. Such a declaration is only made visible in its DeclContext if
there are no non-LocalExtern declarations.

llvm-svn: 191064
2013-09-20 01:15:31 +00:00
Richard Smith f7ec86a55b PR17290: Use 'false' macro in fix-it hint for initializing a variable of type
_Bool in C, if the macro is defined. Also teach FixItUtils to look at whether
the macro was defined at the source location for which it is creating a fixit,
rather than looking at whether it's defined *now*. This is especially relevant
for analysis-based warnings which are delayed until end of TU.

llvm-svn: 191057
2013-09-20 00:27:40 +00:00
Kaelyn Uhrain aee2ebe5a5 Don't correct typos in Sema::BuildCXXNestedNameSpecifier with -fms-extensions
When -fms-extensions is enabled, the typo correction was being called here on
non-error paths (as in test/SemaTemplate/lookup-dependent-bases.cpp) and correct
compilation depended on Sema::CorrectTypo not finding a viable candidate.

llvm-svn: 191046
2013-09-19 22:38:48 +00:00
Hans Wennborg 87cfa71071 clang-cl: implement /fallback mode
When this flag is enabled, clang-cl falls back to cl.exe if it
cannot compile the code itself for some reason.

The idea is to use this to help build projects that almost compile
with clang-cl, except for some files that can then be built with
the fallback mechanism.

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

llvm-svn: 191034
2013-09-19 20:32:16 +00:00
Fariborz Jahanian 8bf05566d7 Fixes a buildbot failure (was using local
type in template instantiation).

llvm-svn: 191022
2013-09-19 17:52:50 +00:00
Fariborz Jahanian 5c005839f6 Refinement to my previous patch for
objc_returns_inner_pointer on properties. // rdar://14990439

llvm-svn: 191016
2013-09-19 17:18:55 +00:00
Reid Kleckner 81e6a60efa clang-cl: Accept -fmsc-version so we can set it without -Xclang
llvm-svn: 191011
2013-09-19 17:00:54 +00:00
Fariborz Jahanian 8a5e947454 ObjectiveC: Allow NS_RETURNS_INNER_POINTER annotation
of ObjectiveC properties to mean annotation of 
NS_RETURNS_INNER_POINTER on its synthesized getter.
This also facilitates more migration to properties when 
methods are annotated with NS_RETURNS_INNER_POINTER. 
// rdar://14990439

llvm-svn: 191009
2013-09-19 16:37:20 +00:00
Ben Langmuir ed6e97d2c3 Fix ifdef macro missed in previous commit
llvm-svn: 191003
2013-09-19 14:07:14 +00:00
Ben Langmuir 6efe3a886e Move sha intrinsics to immintrin.h
This is consistent with ICC and Intel's SHA-enabled GCC version.

llvm-svn: 191002
2013-09-19 14:00:22 +00:00
Amara Emerson fc362c62bf [ARMv8] Add crypto-neon-fp-armv8 -mfpu option in driver.
llvm-svn: 191001
2013-09-19 13:54:03 +00:00
Ben Langmuir 58078d0103 Add C intrinsics for Intel SHA Extensions
Intrinsics added shaintrin.h, which is included from x86intrin.h if __SHA__ is
enabled. SHA implies SSE2, which is needed for the __m128i type.

Also add the -msha/-mno-sha option.

llvm-svn: 190999
2013-09-19 13:22:04 +00:00
Reid Kleckner 2f7fe8acb3 Use -ffreestanding in ms-intrin.cpp and define size_t manually.
llvm-svn: 190985
2013-09-19 01:54:40 +00:00
Eli Friedman 29749d2e3b Fix use-after-free in r190980.
llvm-svn: 190984
2013-09-19 01:51:23 +00:00
Craig Topper 2956112308 Use curly braces all the way through long if/else chain for consistency and readability.
llvm-svn: 190982
2013-09-19 01:13:07 +00:00
Eli Friedman 7127108357 Fix crash with cast of value-dependent expr.
We don't really need to perform semantic analysis on the dependent expression
anyway, so just call the cast dependent.

<rdar://problem/15012610>

llvm-svn: 190981
2013-09-19 01:12:33 +00:00
Eli Friedman 0834a4b901 Make Preprocessor::Lex non-recursive.
Before this patch, Lex() would recurse whenever the current lexer changed (e.g.
upon entry into a macro). This patch turns the recursion into a loop: the
various lex routines now don't return a token when the current lexer changes,
and at the top level Preprocessor::Lex() now loops until it finds a token.
Normally, the recursion wouldn't end up being very deep, but the recursion depth
can explode in edge cases like a bunch of consecutive macros which expand to
nothing (like in the testcase test/Preprocessor/macro_expand_empty.c in this
patch).

<rdar://problem/14569770>

llvm-svn: 190980
2013-09-19 00:41:32 +00:00
Reid Kleckner 5cc15addbe Avoid including <stdlib.h> in the intrin.h test
llvm-svn: 190979
2013-09-19 00:32:11 +00:00
Reid Kleckner f0e232287a Fix ifdef ordering at the end of Intrin.h from r190965
Test that intrin.h at least parses in C++ TUs.

llvm-svn: 190978
2013-09-19 00:19:53 +00:00
Craig Topper 5f79e2661d Disabling sse2 should disable aes and pclmul support.
llvm-svn: 190977
2013-09-19 00:01:05 +00:00
Eli Friedman 626956111d Add specific warning flags for GNU ext in Sema.
This patch adds the following, more specific warning flags:

gnu-anonymous-struct
gnu-compound-literal-initializer
gnu-empty-struct
gnu-flexible-array-initializer
gnu-flexible-array-union-member
gnu-folding-constant
redeclared-class-member
gnu-redeclared-enum
gnu-union-cast
gnu-variable-sized-type-not-at-end

Patch by Peter Lewis.

llvm-svn: 190972
2013-09-18 23:23:17 +00:00
Eli Friedman f9edb00fa4 Fix CharByteWidth assertion in LiteralSupport.
Patch by Eelis van der Weegen.

llvm-svn: 190971
2013-09-18 23:23:13 +00:00
Richard Smith 7506e6bf25 Remove a bogus diagnostic preventing static data member templates from being
defined with no initializer.

llvm-svn: 190970
2013-09-18 23:09:24 +00:00
Eric Christopher cc87253f90 Fix closing brace around ifdef.
llvm-svn: 190965
2013-09-18 22:40:18 +00:00
Hans Wennborg 9cb7d9ba94 clang-cl: Don't warn about overriding /MD with /MT, /Fo with another /Fo, etc.
I put in the warnings because MSVC has them, but I don't think they're very
useful.

Clang does not warn about overriding flags in general, e.g. it's perfectly
fine to have -fomit-frame-pointer followed by -fno-omit-frame-pointer.

We should focus on warning where things get confusing, such as with the
/TP and /TC options. In "clang-cl /TC a.c /TP b.cc", the user might not
realize that the /TP flag will apply to both files, and we warn about that.

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

llvm-svn: 190964
2013-09-18 22:26:39 +00:00
Eric Christopher 0db88a7d7e The intrinsics should all have C linkage.
llvm-svn: 190963
2013-09-18 22:24:01 +00:00
Adrian Prantl 7f2ef22452 get rid of extra parentheses.
llvm-svn: 190962
2013-09-18 22:18:17 +00:00
Adrian Prantl 0315f38a92 Debug info: Explicitly set the DIVariable::isIndirect() flag for VLAs.
This allows us to get rid of an ugly hack in the backend.
Paired commit with LLVM.

llvm-svn: 190960
2013-09-18 22:08:57 +00:00
Richard Smith 5977d875c1 Remove some dead code.
llvm-svn: 190959
2013-09-18 21:55:14 +00:00
Fariborz Jahanian 1c900bcf26 ObjectiveC migrator: For consistency, also infer
'instancetype' for known family of methods
with related result type; such as 'init'
methods. // rdar://14987948

llvm-svn: 190956
2013-09-18 20:35:47 +00:00
Jordan Rose 36bc6b4559 [analyzer] Don't even try to convert floats to booleans for now.
We now have symbols with floating-point type to make sure that
(double)x == (double)x comes out true, but we still can't do much with
these. For now, don't even bother trying to create a floating-point zero
value; just give up on conversion to bool.

PR14634, C++ edition.

llvm-svn: 190953
2013-09-18 18:58:58 +00:00
Fariborz Jahanian 2ba62a7206 ObjectiveC migrator: Infer property in the presense
of methods annotated with attributes. 
// rdar://14987909

llvm-svn: 190947
2013-09-18 17:22:25 +00:00
Fariborz Jahanian e47a14addc ObjectiveC migrator: placing another check for
'deprecated' container before doing the 'instancetype'
inference.

llvm-svn: 190943
2013-09-18 15:43:52 +00:00
Daniel Jasper dcab7fbb83 Simplify clang-format-diff.py using new clang-format options.
clang-format's -lines parameter makes this significantly easier.

llvm-svn: 190935
2013-09-18 12:14:09 +00:00
Joey Gouly 1e8637b259 [ARMv8] Add builtins for CRC instructions.
Patch by Bradley Smith!

llvm-svn: 190931
2013-09-18 10:07:09 +00:00
Stepan Dyatkovskiy b88c30facd Recommited:
Fix for PR16752. Second commit.

PR16752: 'mode' attribute for unusual targets doesn't work properly
Description:
Troubles could be happened due to some assumptions in handleModeAttr function (see SemaDeclAttr.cpp).
For example, it assumes that 32 bit integer is 'int', while it could be 16 bit only.
Instead of asking target: 'which type do you want to use for int32_t ?' it just hardcodes general opinion. That doesn't looks pretty correct.
Please consider the next solution:
1. In Basic/TargetInfo add getIntTypeByWidth and getRealTypeByWidth methods. Methods asks target for proper type for given bit width.
2. Fix handleModeAttr according to new methods in TargetInfo.

Fixes:
1st Commit (Done): Add new methods for TargetInfo:
     getRealTypeByWidth and getIntTypeByWidth
  for ASTContext names are almost same(invokes new methods from TargetInfo):
     getIntTypeForBitwidth and getRealTypeForBitwidth

2nd Commit (Current): Fix SemaDeclAttr, handleModeAttr function.

Also test/Sema/attr-mode.c was fixed. 'XC' mode test was disabled for PPC64 machines.

llvm-svn: 190926
2013-09-18 09:08:52 +00:00
Amaury de la Vieuville 718ce62b3c Add support for poly16 vtst and vtstq
vtst and vtstq currently support poly8 types, but they should also work on
poly16.

llvm-svn: 190925
2013-09-18 08:33:53 +00:00
Hal Finkel 33be5e0e5c Add new libm LIBBUILTIN definitions, synchronizing with __builtin_*
For all libm __builtin_* functions that are defined, this adds the
corresponding LIBBUILTIN definitions (tagged, as necessary, with "e" instead of
"c" when the function may set errno).

Note that this changes the current definitions for lrint and fma
(unfortunately). The Linux man page documents that these don't set errno, but
the POSIX standard says that they should.

llvm-svn: 190922
2013-09-18 06:19:40 +00:00
Hal Finkel c4d7c82c7f Add the intrinsic __builtin_convertvector
LLVM supports applying conversion instructions to vectors of the same number of
elements (fptrunc, fptosi, etc.) but there had been no way for a Clang user to
cause such instructions to be generated when using builtin vector types.

C-style casting on vectors is already defined in terms of bitcasts, and so
cannot be used for these conversions as well (without leading to a very
confusing set of semantics). As a result, this adds a __builtin_convertvector
intrinsic (patterned after the OpenCL __builtin_astype intrinsic). This is
intended to aid the creation of vector intrinsic headers that create generic IR
instead of target-dependent intrinsics (in other words, this is a generic
_mm_cvtepi32_ps). As noted in the documentation, the action of
__builtin_convertvector is defined in terms of the action of a C-style cast on
each vector element.

llvm-svn: 190915
2013-09-18 03:29:45 +00:00
Hal Finkel 4c2316be49 Remove unnecessary comment regarding AsTypeExpr base class
llvm-svn: 190914
2013-09-18 03:29:09 +00:00
Richard Smith ef985ac91c Fix accepts-invalid if a variable template explicit instantiation is missing an
argument list, but could be instantiated with argument list of <>.

llvm-svn: 190913
2013-09-18 02:10:12 +00:00
Eli Friedman 1d24af872d Fix ObjC @encode for C++ classes w/virtual bases.
PR17142.

llvm-svn: 190912
2013-09-18 01:59:16 +00:00
Richard Smith d25789a671 -ast-dump support for variable templates.
llvm-svn: 190911
2013-09-18 01:36:02 +00:00
Richard Smith 785067eca7 If a variable template specialization with an incomplete array type is
referenced, try to instantiate its definition in order to complete the type.

llvm-svn: 190910
2013-09-18 01:35:26 +00:00
Hans Wennborg e693e8432e Add comment about exporting clang::driver::ArgStringList,
as suggested by Jordan on IRC. Also, use the unqualified name
in Job.cpp.

And while we're here, refer to StringRef with the unqualified
name, because we have a using directive for that too.

llvm-svn: 190909
2013-09-18 00:41:15 +00:00
Reid Kleckner c106fdafdd Claim compatibility with VS 2012 by default
This will define _MSC_VER to 1700 by default and avoid linker errors
from /failifmismatch linker directives in the C++ standard headers.

Most people trying out the Visual Studio integration are using 2012,
since that's the only version that clang-format works with.  This way
they don't have to pass funky -Xclang -fmsc-version=1700 flags just to
link against the standard C++ runtime.

llvm-svn: 190908
2013-09-18 00:33:59 +00:00
Hans Wennborg 0daa1225c6 Revert r190902 and r190906
The first one broke the build, and the latter one made it worse.

llvm-svn: 190907
2013-09-18 00:21:51 +00:00
Hans Wennborg 9b7c8a378a Revert "Move using directive from Job.h to Job.cpp" (r190902)
Seems like it was intentional to export ArgStringList as
driver::ArgStringList, and e.g. examples/clang-interpreter/main.cpp
uses it this way.

However, exporting it with a typedef seems like a more common way to do it.

llvm-svn: 190906
2013-09-18 00:17:07 +00:00
David Majnemer 50ce835ecb Revert "Revert "[-cxx-abi microsoft] Mangle local TagDecls appropriately""
This reverts commit r190895 which reverted r190892.

llvm-svn: 190904
2013-09-17 23:57:10 +00:00
Hans Wennborg 138be5e9f4 Move using directive from Job.h to Job.cpp
I don't think it belongs in the header, but seems handy in the .cpp file.

llvm-svn: 190902
2013-09-17 23:37:44 +00:00
Fariborz Jahanian 6e1798e36a ObjectiveC migrator. infer NS_OPTIONS correctly in the
presense of parenthesized enumerator initializers.

llvm-svn: 190901
2013-09-17 23:32:51 +00:00
Hans Wennborg cfe2109978 clang-cl: ignore ths /GS- flag
The /GS- flag is used to turn off run-time buffer security checks (/GS).
Since no such checks are enabled in the first place, I think we should just
ignore this flag.

llvm-svn: 190900
2013-09-17 23:27:39 +00:00
David Majnemer 3775441379 Revert "[-cxx-abi microsoft] Mangle local TagDecls appropriately"
This reverts commit r190892.

llvm-svn: 190895
2013-09-17 22:45:28 +00:00
Fariborz Jahanian f6c6505eaa ObjectiveC migrator: Don't infer property from
'deprected' setters either. // rdar://14989365

llvm-svn: 190894
2013-09-17 22:41:25 +00:00
David Majnemer 1ebb145bdf [-cxx-abi microsoft] Mangle local TagDecls appropriately
Summary:
When selecting a mangling for an anonymous tag type:
- We should first try it's typedef'd name.
- If that doesn't work, we should mangle in the name of the declarator
  that specified it as a declaration specifier.
- If that doesn't work, fall back to a static mangling of
  <unnamed-type>.

This should make our anonymous type mangling compatible.

This partially fixes PR16994; we would need to have an implementation of
scope numbering to get it right (a separate issue).

Reviewers: rnk, rsmith, rjmccall, cdavis5x

CC: cfe-commits

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

llvm-svn: 190892
2013-09-17 22:21:27 +00:00
Fariborz Jahanian 75226d5c0d ObjectiveC migrator. Ignore migrating 'deprecated'
entities. // rdar://14989365

llvm-svn: 190890
2013-09-17 21:56:04 +00:00
Fariborz Jahanian 4c3d9c5e24 ObjectiveC migrator: Don't infer a property from isXXX method
of retainable object (readonly or otherwise).

llvm-svn: 190881
2013-09-17 19:38:55 +00:00
Argyrios Kyrtzidis 85230d50f2 [arcmt] Don't try to handle files that are already ARC'ified, this is not possible currently.
rdar://14461559

llvm-svn: 190880
2013-09-17 19:14:29 +00:00
Fariborz Jahanian 92f7242a56 ObjectiveC migrator. Infer property in categories
declared as getter with or without setter method.
// rdar://15010020

llvm-svn: 190878
2013-09-17 19:00:30 +00:00
Fariborz Jahanian ff0c460863 ObjectiveC modern translator: Provide proper cast of
the ObjectiveC object of an @synchronized statement.
// rdar://14993814

llvm-svn: 190874
2013-09-17 17:51:48 +00:00
Daniel Jasper fb81b09d87 clang-format: Don't accidentally move tokens into preprocessor directive.
This fixes llvm.org/PR17265.

Before:
  Foo::Foo()
  #ifdef BAR
      : baz(0)
  #endif {
  }

After:
  Foo::Foo()
  #ifdef BAR
      : baz(0)
  #endif
  {
  }

llvm-svn: 190861
2013-09-17 09:52:48 +00:00
Daniel Jasper 545c652d75 clang-format: Add comment to tests explaining their grouping.
llvm-svn: 190858
2013-09-17 09:26:07 +00:00
Daniel Jasper 88f9222c4e clang-format: Fix line breaking bug after empty ifs.
Before:
  if () {
  }
    else {
  }

After:
  if () {
  } else {
  }

This fixed llvm.org/PR17262.

llvm-svn: 190855
2013-09-17 08:28:05 +00:00
Daniel Jasper 0de8efa63d clang-format: Don't split a >>-operator.
Before (with column limit 60):
  aaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa >
      > aaaaa);

After:
  aaaaaaaaaaaaaaaaaaaaaaaaaaaa(
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaa >> aaaaa);

(Not sure how that could have stayed in that long without being
detected..)

llvm-svn: 190854
2013-09-17 08:15:46 +00:00
Craig Topper 86d79ef4b8 Push contents of X86TargetInfo::setFeatureEnabled down to a static function called by the virtual version and all the places in getDefaultFeatures. This way getDefaultFeatures doesn't make so many virtual calls.
llvm-svn: 190847
2013-09-17 04:51:29 +00:00
Craig Topper 13f61a6c37 Mark setSSELevel/setMMXLevel/setXOPLevel as static since they don't access anything in the class.
llvm-svn: 190846
2013-09-17 04:12:55 +00:00
Eli Friedman b2a8d464aa Don't build extra init lists.
AssignConvertType::IncompatibleVectors means the two types are in fact
compatible. :)

No testcase; I don't think the extra init list has any actual visible effect
other than making the resulting AST dump look a bit strange.

llvm-svn: 190845
2013-09-17 04:07:04 +00:00
Eli Friedman 1409e6e7c6 Fix const-eval of vector init-lists of a vector.
Like any other type, an init list for a vector can have the same type as
the vector itself; handle that case.

<rdar://problem/14990460>

llvm-svn: 190844
2013-09-17 04:07:02 +00:00
Anna Zaks 226a56fa1d [analyzer] More reliably detect property accessors.
This has a side effect of preventing a crash, which occurs because we get a
property getter declaration, which is overriding but is declared inside
@protocol. Will file a bug about this inconsistency internally. Getting a
small test case is very challenging.

llvm-svn: 190836
2013-09-17 01:30:57 +00:00
Anna Zaks fb05094b52 [analyzer] Stop tracking the objects with attribute cleanup in the RetainCountChecker.
This suppresses false positive leaks. We stop tracking a value if it is assigned to a variable declared with a cleanup attribute.

llvm-svn: 190835
2013-09-17 00:53:28 +00:00
Eli Friedman 9fc443aaed Address review comment on r189557.
We need to escape filenames the same way in InclusionRewriter whether
UseLineDirective is true or false.

Review comment from http://llvm.org/bugs/show_bug.cgi?id=17018#c2

llvm-svn: 190834
2013-09-17 00:51:31 +00:00
Eli Friedman 963ff2c366 Fix potential race in module building code.
Let the module building code handle the case of overwriting an existing file
itself, so the existing locking infrastructure works correctly.

<rdar://problem/14403381>

llvm-svn: 190833
2013-09-17 00:51:29 +00:00
Hans Wennborg 1f84980bbf cl-options.c just use touch to create that .obj file
llvm-svn: 190832
2013-09-17 00:50:43 +00:00
Hans Wennborg dc674a57d3 Fix test/Driver/cl-options.c test
The test builds an object file to be able to get into linking mode
with a valid obj file on the command-line. Using clang-cl for this,
which targets win32, caused problems on some buildbots, so just
use regular clang.

llvm-svn: 190829
2013-09-17 00:25:08 +00:00
Hans Wennborg a8ef14f3f4 clang-cl: ignore compile-only options in link-only invocations.
Previously we would warn about unused arguments such as /MD when linking.
Clang already has logic to ignore compile-only options, e.g. for -D and -U.
This patch extends that to include clang-cl's compile-only options too.

Also, some clang-cl options should always be ignored. Doing this earlier
means they get ignored both for compilation and link-only invocations.

llvm-svn: 190825
2013-09-17 00:03:41 +00:00
David Majnemer fab61e95f3 ffreestanding shouldn't effect main() on win32
llvm-svn: 190824
2013-09-16 23:59:35 +00:00
Hans Wennborg 7baa983a7e clang-cl: ignore all /w<foo> options
We previously ignored /wd<n>, but I think we can ignore the rest too.

llvm-svn: 190819
2013-09-16 23:11:56 +00:00
David Majnemer c729b0b506 [-cxx-abi microsoft] Correctly identify Win32 entry points
Summary:
This fixes several issues with the original implementation:
- Win32 entry points cannot be in namespaces
- A Win32 entry point cannot be a function template, diagnose if we it.
- Win32 entry points cannot be overloaded.
- Win32 entry points implicitly return, similar to main.

Reviewers: rnk, rsmith, whunt, timurrrr

Reviewed By: rnk

CC: cfe-commits, nrieck

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

llvm-svn: 190818
2013-09-16 22:44:20 +00:00
Richard Trieu 3a446ff6a4 Move the uninitialized field check to after all the field initializers are added
to the CXXConstructorDecl so that information from the constructor can be used.

llvm-svn: 190810
2013-09-16 21:54:53 +00:00
Reid Kleckner 543a16c06b Emit an error when attempting to generate IR for SEH __try
Currently we silently omit the code in the try and finally bodies, which
is pretty bad.  This way we fail loudly.

llvm-svn: 190809
2013-09-16 21:46:30 +00:00
Richard Smith 12a41bd3e0 Add some missing ProhibitAttributes calls to some declaration-like #pragmas.
llvm-svn: 190806
2013-09-16 21:17:44 +00:00
Richard Trieu fd68777c7b Pass additional information around the uninitialized field visitor.
llvm-svn: 190805
2013-09-16 20:46:50 +00:00
Alexander Kornienko 81e3294e7e When in pre-c++11 mode, treat _T("xxx") as a single string literal, repeat the _T() part around each fragment. This addresses http://llvm.org/PR17122
Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek, rsmith

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

llvm-svn: 190804
2013-09-16 20:20:49 +00:00
Aaron Ballman 6e2dd7b553 Updated the way the ownership attributes are semantically diagnosed. Added test cases for the semantics checks.
llvm-svn: 190802
2013-09-16 18:11:41 +00:00
Amara Emerson 8c3de546d6 Add error checking to reject neon_vector_type attribute on targets without NEON.
Patch by Artyom Skrobov.

llvm-svn: 190801
2013-09-16 18:07:35 +00:00
Anton Yartsev f5bcccee76 New message for cases when ownership is taken:
"+method_name: cannot take ownership of memory allocated by 'new'."
instead of the old
"Memory allocated by 'new' should be deallocated by 'delete', not +method_name"

llvm-svn: 190800
2013-09-16 17:51:25 +00:00
Argyrios Kyrtzidis 07ee5c44b4 [libclang] Don't report a DecayedType as "unexposed", report it as the original (as written) type.
Patch by Anders Waldenborg!

llvm-svn: 190796
2013-09-16 17:26:23 +00:00
Benjamin Kramer 4d6efbb28a Add a define for the ObjFW runtime ABI version.
This removes __has_feature(objc_msg_lookup_stret), as it is not required
anymore after this patch.

Patch by Jonathan Schleifer!

llvm-svn: 190791
2013-09-16 16:31:49 +00:00
Jordan Rose 3bde507a7a [analyzer] scan-build: add missing semicolon
Patch by Kevin Zheng!

llvm-svn: 190789
2013-09-16 16:17:18 +00:00
Wei Pan c354d2177a Handle PredefinedExpr with templates and lambdas
Summary:

- lambdas, blocks or captured statements in templates were not
  handled which causes codegen crashes.

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

llvm-svn: 190784
2013-09-16 13:57:27 +00:00
Craig Topper 31db3a2efc Make F16C feature imply AVX. Matches GCC behavior.
llvm-svn: 190776
2013-09-16 04:54:13 +00:00
NAKAMURA Takumi c5d86153ed Prune "return" after llvm_unreachable(). It was redundant.
llvm-svn: 190774
2013-09-16 01:58:47 +00:00
Ed Schouten 401aebab93 Make __has_extension(c_thread_local) work.
Unlike C++11's "thread_local" keyword, C11's "_Thread_local" is in the
reserved namespace, meaning we provide it unconditionally; it is marked
as KEYALL in TokenKinds.def.

This means that like all the other C11 keywords, we can expose its
presence through __has_extension().

llvm-svn: 190755
2013-09-14 16:17:20 +00:00
Serge Pavlov d5489074e6 Avoid getting an argument of allocation function if it does not exist.
This is a fix to PR12778: in erroneous code an allocation function
can be declared with no arguments, quering the first argument in this case
causes assertion violation.

llvm-svn: 190751
2013-09-14 12:00:01 +00:00
Daniel Jasper 5c9e3cdb6d clang-format: Fix bug in style option AlwaysBreakTemplateDeclarations.
Before:
  template <template <typename>
            class Fooooooo, template <typename>
            class Baaaaaaar>
  struct C {};

After:
  template <template <typename> class Fooooooo,
            template <typename> class Baaaaaaar>
  struct C {};

llvm-svn: 190747
2013-09-14 08:13:22 +00:00
David Majnemer 90b1729af9 Parse: Template specializations which aren't dependent needn't have their parsing be delayed
Summary:
We should treat a non-dependent template specialization like it wasn't
templated at all.

Reviewers: rsmith

CC: cfe-commits

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

llvm-svn: 190743
2013-09-14 05:46:42 +00:00
Cameron Esfahani 556d91e2c3 Clean up some Triple usage in clang.
llvm-svn: 190737
2013-09-14 01:09:11 +00:00
Jordan Rose e10c859583 [analyzer] Put more uniqueness in scan-build's temporary directory names.
This is necessary when running two scan-build processes in parallel. The
directory naming scheme is now:

  yyyy-MM-dd-HHmmss-PID-N
  2013-09-13-174210-123-1

where "PID" is the scan-build process ID, and "N" is a sequential counter
(not likely to be needed now that seconds are mangled in, but just in case).

PR17196, using a suggested fix from Greg Czajkowski!

llvm-svn: 190735
2013-09-14 00:41:32 +00:00
Eric Christopher 138c32b402 Add support for -ggnu-pubnames matching the llvm support.
llvm-svn: 190729
2013-09-13 22:37:55 +00:00
Michael Han 2d6f64e5ae Fix a comment.
llvm-svn: 190728
2013-09-13 22:24:50 +00:00
Reid Kleckner 881dff3683 Lex and ignore Microsoft's #pragma warning(...)
Summary:
This fixes PR17145 and avoids unknown pragma warnings.

This change does not attempt to map MSVC warning numbers to clang
warning flags.  Perhaps in the future we will implement a mapping for
some common subset of Microsoft warnings, but for now we don't.

Reviewers: rsmith

CC: cfe-commits

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

llvm-svn: 190726
2013-09-13 22:00:30 +00:00
Richard Smith 17e32460ed Part three of PR15721: if we have an invalid CXXDefaultInitExpr, don't crash if
we try to constant-evaluate it. Patch by Karthik Bhat, test by me.

llvm-svn: 190722
2013-09-13 20:51:45 +00:00
Aaron Ballman 8c9795d9fa vector_size cannot be applied to Booleans. Updated the semantic checking logic, as well as the comment and added a test case. Fixes PR12649
llvm-svn: 190721
2013-09-13 20:43:08 +00:00
Aaron Ballman 3b1dde63a2 Switching the WeakRef attribute to using the new checkStringLiteralArgument helper function.
llvm-svn: 190719
2013-09-13 19:35:18 +00:00
Preston Gurd a3c58c02f1 Update Atom Silvermont (SLM) support by adding enabled features.
llvm-svn: 190718
2013-09-13 19:27:17 +00:00
David Blaikie dedd27fc62 DebugInfo: omit debug info for friends
GCC ToT doesn't do this & it's worth about 3.2% on Clang's DWO file size
with Clang. Some or all of this may be due to things like r190715 which
could have source fixes/improvements, but it's not clear that's the case
and that doesn't help other source bases.

llvm-svn: 190716
2013-09-13 18:45:00 +00:00
David Blaikie 0a4e61f81c Remove unnecessary inclusion of Sema.h
Let me tell you a tale...

Within some twisted maze of debug info I've ended up implementing an
insane man's Include What You Use device. When the debugger emits debug
info it really shouldn't, I find out why & then realize the code could
be improved too.

In this instance CIndexDiagnostics.cpp had a lot more debug info with
Clang than GCC. Upon inspection a major culprit was all the debug info
describing clang::Sema. This was emitted because clang::Sema is
befriended by DiagnosticEngine which was rightly required, but GCC
doesn't emit debug info for friends so it never emitted anything for
Clang. Clang does emit debug info for friends (will be fixed/changed to
reduce debug info size).

But why didn't Clang just emit a declaration of Sema if this entire TU
didn't require a definition?

1) Diagnostic.h did the right thing, only using a declaration of Sema
and not including Sema.h at all.
2) Some other dependency of CIndexDiagnostics.cpp didn't do the right
thing. ASTUnit.h, only needing a declaration, still included Sema.h
(hence this commit which removes that include and adds the necessary
includes to the cpp files that were relying on this)
3) -flimit-debug-info didn't save us because of
EnterExpressionEvaluationContext, defined inline in Sema.h which fires
the "requiresCompleteType" check/flag (since it uses nested types from
Sema and calls Sema member functions) and thus, if debug info is ever
emitted for the type, the whole type is emitted and not just a
declaration.

Improving -flimit-debug-info to account for this would be... hard.
Modifying the code so that's not 'required to be complete' might be
possible, but probably only by moving EnterExpressionEvaluationContext
either into Sema, or out of Sema.h. That might be a bit too much of a
contortion to be bothered with.

Also, this is only one of the cases where emitting debug info for
friends caused us to emit a lot more debug info (this change reduces
Clang's DWO size by 0.93%, dropping friends entirely reduces debug info
by 3.2%) - I haven't hunted down the other cases, but I assume they
might be similar (Sema or something like it). IWYU or a similar tool
might help us reduce build times a bit, but analyzing debug info to find
these differences isn't worthwhile. I'll take the 3.2% win, provide this
small improvement to the code itself, and move on.

llvm-svn: 190715
2013-09-13 18:32:52 +00:00
David Blaikie 5cc6cc1326 Fix indentation of closing };
llvm-svn: 190711
2013-09-13 17:56:13 +00:00
Aaron Ballman d6600a5b9b Updated the PCS calling convention to use the new checkStringLiteralArgument helper function.
llvm-svn: 190710
2013-09-13 17:48:25 +00:00
Benjamin Kramer a9dfa9280e As Aaron pointed out it's simpler to reject wide string availability attr messages in the parser.
llvm-svn: 190706
2013-09-13 17:31:48 +00:00
NAKAMURA Takumi 5c81ca460e ASTContext.cpp: Fix a warning in r190684. [-Wcovered-switch-default]
llvm-svn: 190705
2013-09-13 17:12:09 +00:00
Renato Golin 6031230e82 Moving Cortex-R cores to armv7r arch
llvm-svn: 190704
2013-09-13 17:02:59 +00:00
Renato Golin 1a04f22356 Add more Cortex CPUs and tests
llvm-svn: 190703
2013-09-13 17:02:54 +00:00
Renato Golin eefb577be8 Fix Neon detection for Cortex-A class, plus adds some more CPUs to default features
llvm-svn: 190702
2013-09-13 17:02:45 +00:00
Benjamin Kramer ca9fe1453f Guard availability and thread safety attributes against wide strings.
Found by inspection.

llvm-svn: 190701
2013-09-13 16:30:12 +00:00
Benjamin Kramer 6ee1562cfc Unify handling of string literal arguments for attributes and add fixits.
This fixes a couple of latent crashes for invalid attributes and also adds a
fixit hint to turn identifiers into string literals if one was expected. It then
proceeds recovery as if the identifier was a literal. Diagnostic locations are
also changed to point at the literal instead of the attribute if the error
concerns the argument. PR17175.

For example:
hidden.c:1:40: error: 'visibility' attribute requires a string
extern int x __attribute__((visibility(hidden)));
                                       ^
                                       "     "
hidden.c:2:29: error: visibility does not match previous declaration
extern int x __attribute__((visibility("default")));
                            ^
hidden.c:1:29: note: previous attribute is here
extern int x __attribute__((visibility(hidden)));
                            ^

llvm-svn: 190699
2013-09-13 15:35:43 +00:00
Joey Gouly be8c27372a [ARMv8] Change the naming of some options to be more consistent.
Clang side changes for LLVM r190692.

llvm-svn: 190693
2013-09-13 13:48:33 +00:00
Daniel Jasper e488f5dd1e clang-format: Add -assume-filename option for editor integrations.
With -style=file, clang-format now starts to search for a .clang-format
file starting at the file given with -assume-filename if it reads from
stdin. Otherwise, it would start searching from the current directory,
which is not helpful for editor integrations.

Also changed vim, emacs and sublime integrations to actually make use of
this flag.

This fixes llvm.org/PR17072.

llvm-svn: 190691
2013-09-13 13:40:24 +00:00
Alexander Kornienko 95b3be36e0 Added missing field comparisons to the FormatStyle::operator==
llvm-svn: 190688
2013-09-13 12:54:40 +00:00
David Tweed 4fd0234e54 A buildbot compiling with strict error on unused variables pointed out a
historical remnant in r190684; remove it.

llvm-svn: 190687
2013-09-13 12:51:05 +00:00
David Tweed 31d09b0cef Certain multi-platform languages, such as OpenCL, have the concept of
address spaces which is both (1) a "semantic" concept and
(2) possibly a hardware level restriction. It is desirable to
be able to discard/merge the LLVM-level address spaces on arguments for which
there is no difference to the current backend while keeping
track of the semantic address spaces in a funciton prototype. To do this
enable addition of the address space into the name-mangling process. Add
some tests to document this behaviour against inadvertent changes.

Patch by Michele Scandale!

llvm-svn: 190684
2013-09-13 12:04:22 +00:00
Amaury de la Vieuville 7681afdff0 Add "native" to config.available_features, to make it easier to disable non-x-compile-safe tests
Patch by Artyom Skrobov!

llvm-svn: 190681
2013-09-13 11:02:31 +00:00
Daniel Jasper f3d977979c clang-format: Detect braced lists in subscript expressions.
Before (even with Style.Cpp11BracedListStyle):
  f(MyMap[{ composite, key }]);

After:
  f(MyMap[{composite, key}]);

llvm-svn: 190678
2013-09-13 10:55:31 +00:00
David Majnemer 9d0bb9d2ba [-cxx-abi microsoft] Mangle user defined entry points properly
Summary:
Functions named "main", "wmain", "WinMain", "wWinMain", and "DllMain"
are never mangled regardless of linkage, even when compiling for kernel
mode.
Depends on D1655

Reviewers: timurrrr, pcc, rnk, whunt

CC: cfe-commits

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

llvm-svn: 190675
2013-09-13 09:40:55 +00:00
Daniel Jasper 015ed028cf clang-format: Fix incorrect enum parsing / layouting.
Before:
  enum {
    Bar = Foo < int,
    int > ::value
  };

After:
  enum {
    Bar = Foo<int, int>::value
  };

llvm-svn: 190674
2013-09-13 09:20:45 +00:00
David Majnemer d5a42b8b48 [-cxx-abi microsoft] Mangle declarations inside extern "C"
Summary:
This is a first step to getting extern "C" working properly inside
clang.  There are a number of quirks but mangling declarations inside
such a function are a good first step.

Reviewers: timurrrr, pcc, cdavis5x

CC: cfe-commits

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

llvm-svn: 190671
2013-09-13 09:03:14 +00:00
David Majnemer 5f6c860cfc CHECK -> CHECK-DAG
llvm-svn: 190670
2013-09-13 08:59:19 +00:00
Richard Trieu 1bc22c12cb Refactor the uninitialized field visitor. Also moved the calls to the visitor
later in the code so that the expressions will have addition processing first.
This catches a few additional cases of uninitialized uses of class fields.

llvm-svn: 190657
2013-09-13 03:20:53 +00:00
James Dennett 7ac694e87e Documentation: Doxygen-ification of existing docs for Sema/DelayedDiagnostic.h.
llvm-svn: 190656
2013-09-13 02:58:19 +00:00
James Dennett bba389b107 Documentation cleanup: Fixing \brief comments, migrating away from old style
that duplicated the name of the entity being documented at the start of its
comment, and other minor tidyups.

llvm-svn: 190655
2013-09-13 02:46:09 +00:00
Jordan Rose 3ea5886d14 Fix two incorrect comments.
Patch by Jared Grubb!

llvm-svn: 190652
2013-09-13 00:45:22 +00:00
Jordan Rose 8dddf8ff20 [analyzer] Fix copy-paste error in internal docs.
Patch by Jared Grubb!

llvm-svn: 190651
2013-09-13 00:44:57 +00:00
Jordan Rose cb7b7eaff0 [analyzer] Run post-stmt checks for DeclStmt.
No tests because no in-tree checkers use this, but that shouldn't stop
out-of-tree checkers.

Found by Aemon Cannon!

llvm-svn: 190650
2013-09-13 00:44:47 +00:00
Hal Finkel 28b2ae3692 Restore the sqrt -> llvm.sqrt mapping in fast-math mode
This restores the sqrt -> llvm.sqrt mapping, but only in fast-math mode
(specifically, when the UnsafeFPMath or NoNaNsFPMath CodeGen options are
enabled). The @llvm.sqrt* intrinsics have slightly different semantics from the
libm call, specifically, they are undefined when given a non-zero negative
number (the libm calls will always return NaN for any negative number).

This mapping was removed in r100613, and replaced with a TODO, but at that time
the fast-math flags were not yet implemented. Now that we have these, restoring
this mapping is important because it will enable autovectorization of sqrt
calls in loops (at least in fast-math mode).

llvm-svn: 190646
2013-09-12 23:57:55 +00:00
Nick Lewycky 3141d605b9 Fix typo in llvm_unreachable string.
llvm-svn: 190641
2013-09-12 23:36:08 +00:00
Richard Smith 1fff95c702 PR13657 (and duplicates):
When a comma occurs in a default argument or default initializer within a
class, disambiguate whether it is part of the initializer or whether it ends
the initializer.

The way this works (which I will be proposing for standardization) is to treat
the comma as ending the default argument or default initializer if the
following token sequence matches the syntactic constraints of a
parameter-declaration-clause or init-declarator-list (respectively).

This is both consistent with the disambiguation rules elsewhere (where entities
are treated as declarations if they can be), and should have no regressions
over our old behavior. I think it might also disambiguate all cases correctly,
but I don't have a proof of that.

There is an annoyance here: because we're performing a tentative parse in a
situation where we may not have seen declarations of all relevant entities (if
the comma is part of the initializer, lookup may find entites declared later in
the class), we need to turn off typo-correction and diagnostics during the
tentative parse, and in the rare case that we decide the comma is part of the
initializer, we need to revert all token annotations we performed while
disambiguating.

Any diagnostics that occur outside of the immediate context of the tentative
parse (for instance, if we trigger the implicit instantiation of a class
template) are *not* suppressed, mirroring the usual rules for a SFINAE context.

llvm-svn: 190639
2013-09-12 23:28:08 +00:00
Eli Friedman 4ef077a072 Fix regression from r190427.
<rdar://problem/14970968>

llvm-svn: 190635
2013-09-12 22:36:24 +00:00
Michael Han 6ca01b4b6c Add a test case to test RAV visits parameters of implicit copy constructor.
llvm-svn: 190632
2013-09-12 20:59:33 +00:00
Richard Smith ba8071ec81 PR16054: Slight strengthening for -Wsometimes-uninitialized: if we use a
variable uninitialized every time we reach its (reachable) declaration, or
every time we call the surrounding function, promote the warning from
-Wmaybe-uninitialized to -Wsometimes-uninitialized.

This is still slightly weaker than desired: we should, in general, warn
if a use is uninitialized the first time it is evaluated.

llvm-svn: 190623
2013-09-12 18:49:10 +00:00
Hans Wennborg e8677ef5ca Move the execution code from Compilation::ExecuteCommand to Command::Execute
I think it makes sense that a Command knows how to execute itself.

There's no functionality change but i rewrote the code to avoid the manual
memory management of Argv.

My motivation for this is that I plan to subclass Command to build fall-back
functionality into clang-cl.

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

llvm-svn: 190621
2013-09-12 18:35:08 +00:00
Hans Wennborg b212b34f19 Move Compilation::PrintJob and PrintDiagnosticJob into Job::Print.
This moves the code to Job.cpp, which seems like a more natural fit,
and replaces the "is this a JobList? is this a Command?" logic with
a virtual function call.

It also removes the code duplication between PrintJob and
PrintDiagnosticJob and simplifies the code a little.

There's no functionality change here, except that the Executable is
now always printed within quotes, whereas it would previously not be
quoted in crash reports, which I think was a bug.

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

llvm-svn: 190620
2013-09-12 18:23:34 +00:00
Jordan Rose f31f5f8488 [CMake] Put controversial always-recheck-revision-number behind an option.
CMake does not have the ability to perform actions before calculating
dependencies, so it can't know whether it needs to rebuild clangBasic
to update for a new revision number. CLANG_ALWAYS_CHECK_VC_REV (off by
default) will cause clangBasic to always be dirty by deleting the
generated SVNVersion.inc after use; otherwise, SVNVersion.inc will
always be updated, but only included in the final binary when clangBasic
is rebuilt.

It'd be great to find a better way to do this, but hopefully this is
still an improvement over the complete lack of version information before.

llvm-svn: 190613
2013-09-12 16:17:41 +00:00
Joey Gouly 92dfcfa403 Fix the MCTargetAsmParser API change.
llvm-svn: 190601
2013-09-12 10:59:24 +00:00
Argyrios Kyrtzidis 5fcef77b2e [libclang] In clang_getLocation, check that the provided line/column is valid.
rdar://14971432

llvm-svn: 190568
2013-09-12 01:10:36 +00:00
Argyrios Kyrtzidis 623ecfdba0 Fix the end-location of a CXXTemporaryObjectExpr when it is created with a initializer_list.
rdar://14887351

llvm-svn: 190561
2013-09-11 23:23:27 +00:00
Jordan Rose e51d5f6706 [CMake] Fix repository version checking dependencies harder.
Just always regenerate SVNVersion.inc. Don't worry about it not changing.

llvm-svn: 190560
2013-09-11 23:12:55 +00:00
NAKAMURA Takumi 4c57b9db10 clang/test/FixIt/fixit-unicode-with-utf8-output.c: Remove XFAIL.
It'd be another issue that the terminal and stdout(including redirects) with utf8. This test XPASSed on Win32, at least on Lit.

FYI, we don't use a triplet like "-win64" anywhere.

llvm-svn: 190559
2013-09-11 23:09:22 +00:00
Jordan Rose 206d4c4678 [CMake] Always include the Clang repo version, just like the autoconf build.
Now that LLVM's helper script GetSVN.cmake actually works consistently,
there's no reason not to use it. This does mean that the clangBasic target
is potentially always dirty, because CMake-generated projects do not
necessarily recalculate dependencies after running each target.

This should end the issues of the AST format changing and breaking old
module files; CMake-Clang should now detect that the version changed just
like Autoconf-Clang has.

llvm-svn: 190557
2013-09-11 22:46:46 +00:00
Fariborz Jahanian 47502c11f5 ObjectiveC migration. NS_RETURNS_NOT_RETAINED is the default for
unknown methods which return Cocoa objects. No need to annotate
such methods.

llvm-svn: 190555
2013-09-11 22:46:09 +00:00
Daniel Jasper 5ca9b7141f clang-format: Fix bug in pointer detection
Before:
  for (int i = 0; i* 2 < z; i *= 2) {}
After:
  for (int i = 0; i * 2 < z; i *= 2) {}

llvm-svn: 190546
2013-09-11 20:37:10 +00:00
Aaron Ballman 682ee42550 Tablegen now generates a StringSwitch for attributes containing enumeration arguments to map strings to the proper enumeration value. This makes error checking more consistent and reduces the amount of hand-written code required.
llvm-svn: 190545
2013-09-11 19:47:58 +00:00
Fariborz Jahanian 34fea36340 ObjectiveC migrator. Modify inferred property name
such that it does not lower case the staring property
name if getter name (after "get" prefix) starts with 
two upper case letters.

llvm-svn: 190539
2013-09-11 18:27:16 +00:00
Alexander Kornienko 48c9900713 Test for correct usage of columnWidth in clang fixit hints.
Summary:
This test only works on systems capable of outputting UTF-8 encoded
text on the standard output (tested on linux and OS X, should XFAIL on windows,
if I haven't messed up the XFAIL line).

Reviewers: jordan_rose

Reviewed By: jordan_rose

CC: cfe-commits

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

llvm-svn: 190537
2013-09-11 18:10:30 +00:00
Roman Divacky 786d32ecf7 Clarify the status of PowerPC support.
llvm-svn: 190533
2013-09-11 17:12:49 +00:00
Fariborz Jahanian ca39960f31 ObjectiveC migrator. methods which look like a getter and
start with "get" are inferreed as a readonly properties.

llvm-svn: 190532
2013-09-11 17:05:15 +00:00
Serge Pavlov 60ac1269c6 Added regression tests.
llvm-svn: 190531
2013-09-11 17:04:24 +00:00
Jordan Rose 9519ff59ec [analyzer] Handle zeroing constructors for fields of structs with empty bases.
RegionStore tries to protect against accidentally initializing the same
region twice, but it doesn't take subregions into account very well. If
the outer region being initialized is a struct with an empty base class,
the offset of the first field in the struct will be 0. When we initialize
the base class, we may invalidate the contents of the struct by providing
a default value of Unknown (or some new symbol). We then go to initialize
the member with a zeroing constructor, only to find that the region at
that offset in the struct already has a value. The best we can do here is
to invalidate that value and continue; neither the old default value nor
the new 0 is correct for the entire struct after the member constructor call.

The correct solution for this is to track region extents in the store.

<rdar://problem/14914316>

llvm-svn: 190530
2013-09-11 16:46:50 +00:00
Hans Wennborg d9ad0681fa clang-cl: Warn about overriding /MD with /MT etc.
This also bakes the /M options into a separate option group to make
them easier to refer to from the code.

llvm-svn: 190529
2013-09-11 16:38:41 +00:00
Michael Han c90d12d1df Teach RAV to visit parameter variable declarations of implicit functions. Fixes PR16182.
Normally RAV visits parameter variable declarations of a function by traversing the TypeLoc of
the parameter declarations. However, for implicit functions, their parameters don't have any
TypeLoc, because they are implicit.

So for implicit functions, we visit their parameter variable declarations by traversing them through
the function declaration, and visit them accordingly.

Reviewed by Richard Smith and Manuel Klimek.

llvm-svn: 190528
2013-09-11 15:53:29 +00:00
Robert Lytton 01081113c2 fix xcore-opts.c test
llvm-svn: 190526
2013-09-11 15:14:38 +00:00
Aaron Ballman e4ba0bdf11 Adding some additional test cases for the cleanup attribute.
llvm-svn: 190525
2013-09-11 13:43:47 +00:00
Evgeniy Stepanov a98799fe4b Fix 2 cases of uninitialized reads of an invalid PresumedLoc.
The code in CGExpr was added back in 2012 (r165536) but not exercised in tests
until recently.

Detected on the MemorySanitizer bootstrap bot.

llvm-svn: 190521
2013-09-11 12:33:58 +00:00
Alexander Kornienko 9e649af004 Support for CR LF newlines.
Summary:
reformat() tries to determine the newline style used in the input
(either LF or CR LF), and uses it for the output. Maybe not every single case is
supported, but at least the bug described in http://llvm.org/PR17182 should be
resolved.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 190519
2013-09-11 12:25:57 +00:00
Timur Iskhodzhanov 3b6adcb63a Fix the ASan dll_thunk path
llvm-svn: 190516
2013-09-11 11:45:31 +00:00
Benjamin Kramer 2d4d8cb329 Simplify code with the in place path::native. No functionality change.
llvm-svn: 190515
2013-09-11 11:23:15 +00:00
Daniel Jasper c531daefd9 Split -Wunused-variable warning.
With r190382, -Wunused-variable warns about unused const variables when
appropriate. For codebases that use -Werror, this poses a problem as
existing unused const variables need to be cleaned up first. To make the
transistion easier, this patch splits -Wunused-variable by pulling out
an additional -Wunused-const-variable (by default activated along with
-Wunused-variable).

llvm-svn: 190508
2013-09-11 10:37:35 +00:00
Daniel Sanders cb2929c239 [mips][msa] Corrected the definition of the dotp_[su].[hwd] intrinsics
The elements of the operands should be half the width of the elements of
the result.

llvm-svn: 190505
2013-09-11 09:59:17 +00:00
NAKAMURA Takumi 0d142fdb17 SemaTemplateDeduction.cpp: Prune two stray \param(s), TPOC and NumCallArguments in Sema::getMostSpecialized(). They were removed since r190444. [-Wdocumentation]
llvm-svn: 190501
2013-09-11 09:41:51 +00:00
Benjamin Kramer 994272bf4a Remove unused diagnostics.
llvm-svn: 190500
2013-09-11 09:35:04 +00:00
Daniel Jasper 97292843d0 Support for modular module-map-files
This patch is the first step to make module-map-files modular (instead
of requiring a single "module.map"-file per include directory). This
step adds a new "extern module" declaration that enables
module-map-files to reference one another along with a very basic
implementation.

The next steps are:

* Combine this with the use-declaration (from
  http://llvm-reviews.chandlerc.com/D1546) in order to only load module
  map files required for a specific compilation.
* Add an additional flag to start with a specific module-map-file (instead
  of requiring there to be at least one "module.map").

Review: http://llvm-reviews.chandlerc.com/D1637
llvm-svn: 190497
2013-09-11 07:20:44 +00:00
Craig Topper c0070a4320 Fix a bug where -msse followed by -mno-sse would leave MMX enabled.
llvm-svn: 190496
2013-09-11 06:48:53 +00:00
David Majnemer 5a1b2045dc [-cxx-abi microsoft] Canonicalize array parameters better
Summary:
More accurately characterize the nature of array parameters. Doing this
removes false back-reference opportunities.  Remove some hacks now that
we characterize these better.

Reviewers: rnk, timurrrr, whunt, cdavis5x

CC: cfe-commits

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

llvm-svn: 190488
2013-09-11 04:44:30 +00:00
Rui Ueyama 2ceba7938d Do not quote YAML plain string myself. Let YAMLIO do that.
llvm-svn: 190486
2013-09-11 04:00:35 +00:00
Eli Friedman aa76981400 volatile types are not trivially copyable.
PR17123.

llvm-svn: 190484
2013-09-11 03:49:34 +00:00
Eli Friedman de432143bd Fix test.
llvm-svn: 190483
2013-09-11 03:49:30 +00:00
Eli Friedman 9ea1e16747 Fix is_trivially_constructible preconditions.
Fixes a crash in cases where the first argument was an incomplete type
or an uninstantiated template type.

<rdar://problem/14938471>

llvm-svn: 190482
2013-09-11 02:53:02 +00:00
Nick Lewycky 8b4e379de3 Disable the bool and enum sanitizers when emitting the implicitly-defined copy
constructor, copy assignment operator and move assignment operator.

llvm-svn: 190481
2013-09-11 02:03:20 +00:00
Aaron Ballman c12aaff2cb The cleanup attribute no longer uses an unresolved, simple identifier as its argument. Instead, it takes an expression that is fully resolved.
llvm-svn: 190476
2013-09-11 01:37:41 +00:00
Richard Smith e5b5220072 PR17075: When performing partial ordering of a member function against a
non-member function, the number of arguments in the two candidate calls
will be different (the non-member call will have one extra argument).
We used to get confused by this, and fail to compare the last argument
when testing whether the member is better, resulting in us always
thinking it is, even if the non-member is more specialized in the last
argument.

llvm-svn: 190470
2013-09-11 00:52:39 +00:00
Nico Rieck 7857d46c64 Add -fansi-escape-codes option
Some build systems use pipes for stdin/stderr. On nix-ish platforms colored
output can be forced by -fcolor-diagnostics. On Windows this option has
no effect in these cases because LLVM uses the console API (which only
operates on the console buffer) even if a console wrapper capable of
interpreting ANSI escape codes is used.

The -fansi-escape-codes option allows switching from the console API to
ANSI escape codes. It has no effect on other platforms.

llvm-svn: 190464
2013-09-11 00:38:02 +00:00
Eli Friedman 4f0409aae5 Get rid of unused isPodLike definition.
llvm-svn: 190463
2013-09-11 00:37:10 +00:00
Eli Friedman e5a7dcb6fd Remove unused class.
llvm-svn: 190462
2013-09-11 00:37:06 +00:00
DeLesley Hutchins 85c07d9a93 Fix ICE in consumed analysis when CFG is null.
llvm-svn: 190447
2013-09-10 23:10:10 +00:00
Eli Friedman 39996f42cf Remove unused variable.
llvm-svn: 190445
2013-09-10 23:00:03 +00:00
Richard Smith 35e1da259f getMostSpecialized for function template sets is never used in the context of a
call; remove its 'number of explicit arguments' and 'what kind of call'
parameters.

llvm-svn: 190444
2013-09-10 22:59:25 +00:00
Eli Friedman dc41d791f9 Add unused markings to suppress warnings.
trunk clang is a bit more aggressive about emitting unused-declaration
warnings, so adjust some AST code to match.  Specifically, use
LLVM_ATTRIBUTE_UNUSED for declarations which are never supposed to be
referenced, and turn references to declarations which are supposed to be
referenced into odr-uses.

llvm-svn: 190443
2013-09-10 22:57:15 +00:00
Reid Kleckner f978886ea4 Ignore noreturn when checking function template specializations
As requested when applying the same logic to calling conventions.

Reviewers: rsmith

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

llvm-svn: 190441
2013-09-10 22:21:37 +00:00
Richard Smith 84c6b3d293 PR5683: Issue a warning when subtracting pointers to types of zero size, and
treat such subtractions as being non-constant. Patch by Serge Pavlov! With a
few tweaks by me.

llvm-svn: 190439
2013-09-10 21:34:14 +00:00
Eli Friedman a5dfebdcfd Fix regression from r190382.
Make sure we perform the correct "referenced-but-not-used" check for
static member constants.

Fixes bug reported on cfe-commits by Alexey Samsonov.

llvm-svn: 190437
2013-09-10 21:10:25 +00:00
Hans Wennborg 4e6bec7e26 Fix cl-link.c test failure on Mac platforms
The test filename (%s) is easily confused with an option when
it starts with /Users...

llvm-svn: 190435
2013-09-10 20:53:34 +00:00
Reid Kleckner 1ece9fc806 [ms-cxxabi] Mangle dynamic initializer stubs the same way MSVC does
Summary: Dynamic initializers are mangled as ??__E <name> YAXXZ.

Reviewers: timurrrr

CC: cfe-commits

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

llvm-svn: 190434
2013-09-10 20:43:12 +00:00
Hans Wennborg 24ffd63626 Remove Windows line-endings in two clang-cl test files.
llvm-svn: 190432
2013-09-10 20:35:58 +00:00
Hans Wennborg f1a7425bd9 clang-cl: Support building DLLs (PR17083)
This adds driver support for building DLLs (the /LD and /LDd flags).
It basically does two things: runtime selection and passing -dll and
-implib to the linker.

llvm-svn: 190428
2013-09-10 20:18:04 +00:00
Reid Kleckner d8110b6558 [ms-cxxabi] Implement guard variables for static initialization
Static locals requiring initialization are not thread safe on Windows.
Unfortunately, it's possible to create static locals that are actually
externally visible with inline functions and templates.  As a result, we
have to implement an initialization guard scheme that is compatible with
TUs built by MSVC, which makes thread safety prohibitively difficult.

MSVC's scheme is that every function that requires a guard gets an i32
bitfield.  Each static local is assigned a bit that indicates if it has
been initialized, up to 32 bits, at which point a new bitfield is
created.  MSVC rejects inline functions with more than 32 static locals,
and the externally visible mangling (?_B) only allows for one guard
variable per function.

On Eli's recommendation, I used MangleNumberingContext to track which
bit each static corresponds to.

Implements PR16888.

Reviewers: rjmccall, eli.friedman

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

llvm-svn: 190427
2013-09-10 20:14:30 +00:00
Fariborz Jahanian c02bfb9a85 ObjectiveC migrator: rename inferred isXXX property,
with a suitable 'getter' attribute.

llvm-svn: 190420
2013-09-10 18:39:32 +00:00
Hans Wennborg 9f6581bb88 Allow _clang-format as alternative to .clang-format config filename
Dotfiles are impractical on Windows. This makes clang-format search
for the style configuration file as '_clang-format' in addition to
the usual '.clang-format'. This is similar to how VIM searches for
'_vimrc' on Windows.

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

llvm-svn: 190413
2013-09-10 15:41:12 +00:00
Alexander Kornienko d8d47fa504 Don't divide L and #x in macro definitions. Fixes http://llvm.org/PR17144
Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 190408
2013-09-10 13:41:43 +00:00
Alexander Kornienko 917f9e04b5 Correctly calculate OriginalColumn after multi-line tokens.
Summary: This also unifies the handling of escaped newlines for all tokens.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 190405
2013-09-10 12:29:48 +00:00
Daniel Jasper 71665cd1fd clang-format: Understand function type typedefs with typeof.
Before:
  typedef typeof(int(int, int)) * MyFunc;
After:
  typedef typeof(int(int, int)) *MyFunc;

This fixes llvm.org/PR17178.

llvm-svn: 190401
2013-09-10 10:26:38 +00:00
Daniel Sanders 3615c45d76 [mips][msa] Removed unsupported dot product instructions (dotp_[su].b).
The dotp_[su].b instructions never existed in any revision of the MSA spec.

llvm-svn: 190399
2013-09-10 10:10:39 +00:00
Alexander Kornienko 39856b71a6 Calculate and store ColumnWidth instead of CodePointCount in FormatTokens.
Summary:
This fixes various issues with mixed tabs and spaces handling, e.g.
when realigning block comments.

Reviewers: klimek, djasper

Reviewed By: djasper

CC: cfe-commits

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

llvm-svn: 190395
2013-09-10 09:38:25 +00:00
Alexey Samsonov 3767ccf318 Delete unused static class members
llvm-svn: 190394
2013-09-10 09:26:48 +00:00
Stepan Dyatkovskiy c250d23c06 Rejected 190391, due to failures on clang-x86_64-darwin11-nobootstrap-RAincremental.
llvm-svn: 190393
2013-09-10 08:37:22 +00:00
Stepan Dyatkovskiy f16ade7604 Fix for PR16752. Second commit.
PR16752: 'mode' attribute for unusual targets doesn't work properly
Description:
Troubles could be happened due to some assumptions in handleModeAttr function (see SemaDeclAttr.cpp).
For example, it assumes that 32 bit integer is 'int', while it could be 16 bit only.
Instead of asking target: 'which type do you want to use for int32_t ?' it just hardcodes general opinion. That doesn't looks pretty correct.
Please consider the next solution:
1. In Basic/TargetInfo add getIntTypeByWidth and getRealTypeByWidth methods. Methods asks target for proper type for given bit width.
2. Fix handleModeAttr according to new methods in TargetInfo.

Fixes:
1st Commit (Done): Add new methods for TargetInfo:
     getRealTypeByWidth and getIntTypeByWidth
  for ASTContext names are almost same(invokes new methods from TargetInfo):
     getIntTypeForBitwidth and getRealTypeForBitwidth

2nd Commit (Current): Fix SemaDeclAttr, handleModeAttr function.

llvm-svn: 190391
2013-09-10 08:18:44 +00:00
David Tweed 6c2149b3e5 Fix minor coding style issue in r190296 pointed out by Richard Smith.
llvm-svn: 190390
2013-09-10 08:00:34 +00:00
Craig Topper 7481d8aa17 Separate popcnt and sse4.2 feature control somewhat to match gcc behavior.
Enabling sse4.2 will implicitly enable popcnt unless popcnt is explicitly disabled.
Disabling sse4.2 will not disable popcnt if popcnt is explicitly enabled.

llvm-svn: 190387
2013-09-10 06:55:47 +00:00
Nick Lewycky b39be1f38e Generate code for the move assignment operator using memcpy, the same as we do
for the copy assignment operator.

llvm-svn: 190385
2013-09-10 05:14:39 +00:00
Eli Friedman 5ef2175866 Make -Wunused warning rules more consistent.
This patch does a few different things.

This patch improves unused var diags for const vars: we no longer
unconditionally suppress diagnostics for const vars, instead only suppressing
the diagnostic when the declaration appears to be useful.

This patch also makes us more consistently use whether a variable/function
is declared in the main file to suppress diagnostics where appropriate.

Fixes <rdar://problem/14907887>.

llvm-svn: 190382
2013-09-10 03:05:56 +00:00
Hans Wennborg 81f74480b3 clang-cl: use -fdiagnostics-format=msvc by default
This allows for navigating to errors within the MSVC IDE by clicking
on the diagnostics.

llvm-svn: 190378
2013-09-10 01:07:07 +00:00
Reid Kleckner 76808056f9 Ignore calling conventions when checking function template specializations
Summary:
Calling conventions are inherited during decl merging.  Before this
change, deduction would fail due to a type mismatch between the template
and the specialization.  This change adjusts the CCs to match before
deduction, and lets the decl merging logic diagnose mismatch or inherit
the CC from the template.

This allows specializations of static member function templates in the
Microsoft C++ ABI.

Reviewers: rsmith

CC: cfe-commits

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

llvm-svn: 190377
2013-09-10 01:04:45 +00:00
Fariborz Jahanian 9d5fffb425 ObjectiveC migrator. Do not infer NS_RETURNS_INNER_POINTER
annotation on methods which return typedef of pointer to 
an incomplete struct type.

llvm-svn: 190372
2013-09-09 23:56:14 +00:00
Aaron Ballman 5f05a6cbbf Attempting to unbreak the makefile-base builds.
llvm-svn: 190370
2013-09-09 23:50:01 +00:00
Aaron Ballman febff0cdfb Adding a FIXME based on feedback from Richard Smith.
llvm-svn: 190369
2013-09-09 23:40:31 +00:00
Aaron Ballman 8ee40b7264 Attribute tablegen now understands that attribute arguments can be optional. This allows for automated checking of the number of arguments expected vs number of arguments given for attributes. Greatly reduces the amount of manual checking required.
llvm-svn: 190368
2013-09-09 23:33:17 +00:00
Matt Beaumont-Gay 093f240a73 Fix a crash introduced in r189828.
The predicates in CXXRecordDecl which test various properties of special
members can't be called on incomplete decls.

llvm-svn: 190353
2013-09-09 21:07:58 +00:00
Fariborz Jahanian b1a2124652 Modern ObjectiveC translator. Fix translation of
message sent to aggregate-valued methods. Fix
visibility of trampoline type used in translation 
of such expressions.  // rdar://14932320

llvm-svn: 190341
2013-09-09 19:59:59 +00:00
Sean Silva 98c64d4dca [docs] Prominently note modules are experimental.
It was really hard to tell that modules are experimental. This makes it
really clear by

* Noting the experimental status in the title.
* Moving the "warning" above the table of contents.

llvm-svn: 190340
2013-09-09 19:57:49 +00:00
Sean Silva fcb46a0dec [docs] End users should see just "Clang"
Half the internet has wildly incorrect ideas about what LLVM is (in
particular, many get the impression that LLVM is some magical
cross-platform runtime), so saying "LLVM" near "cross-compilation" in a
user-facing doc might provoke confusion.

llvm-svn: 190338
2013-09-09 19:50:47 +00:00
Sean Silva 3c53673b50 [docs] Fix Sphinx toctree warning.
Last I heard LSan is getting close to prime-time, but for now keep
LeakSanitizer.rst hidden (especially since it contains so little
content).

llvm-svn: 190337
2013-09-09 19:50:46 +00:00
Sean Silva a928c24984 [docs] Fix some finicky Sphinx warnings.
llvm-svn: 190336
2013-09-09 19:50:40 +00:00
Sean Silva 7a8b6ca2d1 [docs] Typographical and rewording fixes.
llvm-svn: 190333
2013-09-09 19:30:44 +00:00
Hans Wennborg 2102df96a6 clang-cl: parse (but don't support) the /o flag
Apparently folks run into this (PR17097). The flag is not supported by
MSVC either, but we should parse it so we don't get confused when it occurs.

This changes the clang-cl output for "clang-cl /c /o foo.obj" from:

  clang-cl.exe: error: no such file or directory: '/o'
  clang-cl.exe: error: no such file or directory: 'foo.obj'

to:

  clang-cl.exe: warning: argument unused during compilation: '/o bajs.obj'

llvm-svn: 190323
2013-09-09 19:04:49 +00:00
Ted Kremenek 6700934ac7 Move checker downloads to llvm.org.
llvm-svn: 190316
2013-09-09 17:19:27 +00:00
Richard Smith d55889a655 C++ modules: if a class is defined in multiple modules (for instance, because
it is an implicit instantiation of a class template specialization), pick the
first-loaded definition to be the canonical definition, and merge all other
definitions into it.

This is still rather incomplete -- we need to extend every form of declaration
that can appear within a CXXRecordDecl to be redeclarable if it came from an
AST file (this includes fields, enumerators, ...).

llvm-svn: 190315
2013-09-09 16:55:27 +00:00
Benjamin Kramer 1b18a5ec28 CGDebugInfo: Hoist string allocation in a helper function. No functionality change.
llvm-svn: 190314
2013-09-09 16:39:06 +00:00
Benjamin Kramer 7037021e78 Sema: Don't crash on visibility attributes with an identifier argument.
PR17105.

llvm-svn: 190312
2013-09-09 15:08:57 +00:00
Benjamin Kramer 60509af49a Fix constructor-related typos.
Noticed by Roman Divacky.

llvm-svn: 190311
2013-09-09 14:48:42 +00:00
Aaron Ballman 1f2bc24d9b Silencing an MSVC warning about an empty control statement (it dislikes ; but is fine with {}).
llvm-svn: 190305
2013-09-09 13:29:38 +00:00
Aaron Ballman 60f62ad3d3 Removing the endian attribute and updating associated test cases. This functionality was never completely implemented, and this is an improvement over silently eating the attribute.
llvm-svn: 190303
2013-09-09 12:57:20 +00:00
David Tweed 1bcaeb2403 Commit 190296 missed out the tests; add them now. Note that it actually tests
"long long" which is currently technically only "reserved for future" use in OpenCL, but
since clang in OpenCL mode supports it we may as well test the modifications to
the settings made for that type.

llvm-svn: 190297
2013-09-09 09:55:07 +00:00
David Tweed 2da6438969 The OpenCL standard specifies the sizes and alignments of various types than other C-family
languages, as well as specifying errno is not set by the math functions. Make the
clang front-end set those appropriately when the OpenCL language option is set.

Patch by Erik Schnetter!

llvm-svn: 190296
2013-09-09 09:17:24 +00:00
Stepan Dyatkovskiy a4a59d7468 Additional fix for PR16752 and for commit 190044:
-- For TargetInfo::getRealTypeByWidth also added support for IEEEQuad float type.

llvm-svn: 190294
2013-09-09 07:46:54 +00:00
Richard Smith 4abe0a8d82 C++ modules: fix a bug where loading a declaration with some name would prevent
name lookup from lazily deserializing the other declarations with the same
name, by tracking a bit to indicate whether a name in a DeclContext might have
additional external results. This also allows lazier reconciling of the lookup
table if a module import adds decls to a pre-existing DC.

However, this exposes a pre-existing bug, which causes a regression in
test/Modules/decldef.mm: if we have a reference to a declaration, and a
later-imported module adds a redeclaration, nothing causes us to load that
redeclaration when we use or emit the reference (which can manifest as a
reference to an undefined inline function, a use of an incomplete type, and so
on). decldef.mm has been extended with an additional testcase which fails with
or without this change.

llvm-svn: 190293
2013-09-09 07:34:56 +00:00
Bill Wendling 5257538df9 Update to the new API interface which requires the MCRegisterInfo object. <rdar://problem/13623355>
llvm-svn: 190291
2013-09-09 02:37:56 +00:00
Jiangning Liu 1bda93a252 Implement aarch64 neon instruction set AdvSIMD (3V Diff), covering the following 26 instructions,
SADDL, UADDL, SADDW, UADDW, SSUBL, USUBL, SSUBW, USUBW, ADDHN, RADDHN, SABAL, UABAL, SUBHN, RSUBHN, SABDL, UABDL, SMLAL, UMLAL, SMLSL, UMLSL, SQDMLAL, SQDMLSL, SMULL, UMULL, SQDMULL, PMULL

llvm-svn: 190289
2013-09-09 02:21:08 +00:00
Renato Golin f70e35ddc4 Adding cross-compilation instructions to Clang
llvm-svn: 190281
2013-09-08 20:44:39 +00:00