Commit Graph

60841 Commits

Author SHA1 Message Date
John McCall f8a9b66f65 In ARC, peephole the initialization of a __weak variable with
a value loaded from a __weak variable into a call to
objc_copyWeak or objc_moveWeak.

llvm-svn: 250916
2015-10-21 18:06:31 +00:00
Nico Weber ff06370e12 clang-format: Teach --sort-includes to interleave #include and #import.
clang accepts both #include and #import for includes (the latter having an
implicit header guard).  Let clang-format interleave both types if
--sort-includes is passed.  #import is used frequently in Objective-C code.

http://reviews.llvm.org/D13853

llvm-svn: 250909
2015-10-21 17:13:45 +00:00
Benjamin Kramer 998039e2f6 Shrink DynTypedNode by one pointer from 40 to 32 bytes (on x86_64).
The MemoizationData cache was introduced to avoid a series of enum
compares at the cost of making DynTypedNode bigger. This change reverts
to using an enum compare but instead of building a chain of comparison
the enum values are reordered so the check can be performed with a
simple greater than. The alternative would be to steal a bit from the
enum but I think that's a more complex solution and not really needed
here.

I tried this on several large .cpp files with clang-tidy and didn't
notice any performance difference. The test change is due to matchers
being sorted by their node kind.

Differential Revision: http://reviews.llvm.org/D13946

llvm-svn: 250905
2015-10-21 16:33:15 +00:00
Craig Topper 2f6e21e76d Update clang to match llvm r250901. OptTable constructor now takes an ArrayRef. NFC
llvm-svn: 250903
2015-10-21 16:31:33 +00:00
Craig Topper 8459aa8f97 Use StringRef instead of calling c_str and doing pointer math before eventually creating a StringRef. NFC
llvm-svn: 250902
2015-10-21 16:31:31 +00:00
Anastasia Stulova bd3c08e301 [OpenCL] Add test for program scope variable restrictions in OpenCL v2.0
http://reviews.llvm.org/D13105

llvm-svn: 250892
2015-10-21 10:37:57 +00:00
Benjamin Kramer e8c51fdbd6 Revert "[AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap."
Putting DynTypedNode in the ParentMap bloats its memory foot print.
Before the void* key had 8 bytes, now we're at 40 bytes per key which
can mean multiple gigabytes increase for large ASTs and this count
doesn't even include all the added TypeLoc nodes. Revert until I come
up with a better data structure.

This reverts commit r250831.

llvm-svn: 250889
2015-10-21 10:07:26 +00:00
Richard Barton 7dacc242d9 Fix __ARM_FP value for sp-only FPUs with Half-precision
The logic for parsing FP capabilities to set __ARM_FP was mistakenly removing
the Half-Precision capability when handling fp-only-sp resulting in a value
of 0x4. Section 6.5.1 of ACLE states that for such FP architectures the value
should be 0x6

llvm-svn: 250888
2015-10-21 10:03:55 +00:00
Richard Smith 896c66ecc6 [modules] libstdc++ defines some static inline functions in its internal
headers. If those headers end up being textually included twice into the same
module, we get ambiguity errors.

Work around this by downgrading the ambiguity error to a warning if multiple
identical internal-linkage functions appear in an overload set, and just pick
one of those functions as the lookup result.

llvm-svn: 250884
2015-10-21 07:13:52 +00:00
Craig Topper dd2b74ab21 Use range-based for loops. NFC.
llvm-svn: 250881
2015-10-21 04:52:40 +00:00
Craig Topper 335c8f9e59 Use std::find instead of a manual loop.
llvm-svn: 250880
2015-10-21 04:52:38 +00:00
Craig Topper 67288a9b75 Parse into an unsigned type instead of a signed type and then checking for positive and casting to unsigned. Since we know the string starts with a digit it couldn't be negative anyway. NFCI
llvm-svn: 250879
2015-10-21 04:52:36 +00:00
Craig Topper de330c78b3 Fix bad indentation.
llvm-svn: 250878
2015-10-21 04:52:34 +00:00
Craig Topper 55765ca54a Use ArrayRef and MutableArrayRef instead of a pointer and size. NFC
llvm-svn: 250876
2015-10-21 02:34:10 +00:00
NAKAMURA Takumi 79e40ec856 Revert r247977, "clang/test/lit.cfg: *-ps4 doesn't have appropriate driver yet. Mark it as "non-clang-driver"."
They, "tests requiring clang-driver", should work in trunk since ps4 driver has been introduced.

llvm-svn: 250866
2015-10-20 22:36:16 +00:00
Reid Kleckner 744e3e7fc7 Re-land r250592 without rejecting field refs in unevaluated contexts
This time, I went with the first approach from
http://reviews.llvm.org/D6700, where clang actually attempts to form an
implicit member reference from an UnresolvedLookupExpr. We know that
there are only two possible outcomes at this point, a DeclRefExpr of the
FieldDecl or an error, but its safer to reuse the existing machinery for
this.

llvm-svn: 250856
2015-10-20 21:04:13 +00:00
David Majnemer 06ce8a4c70 [-fms-extensions] Allow missing exception specifications in redeclarations as an extension
Microsoft's ATL headers make use of this MSVC extension, add support for
it and issue a diagnostic under -Wmicrosoft-exception-spec.

This fixes PR25265.

llvm-svn: 250854
2015-10-20 20:49:21 +00:00
Reid Kleckner afb9aaefe3 Add back null check removed accidentally in r250554
Fixes PR25262

llvm-svn: 250844
2015-10-20 18:45:57 +00:00
Chris Bieneman 0eb2d8794e [CMake] Make clang/tools subdirectories controlled via options
Setting CLANG_TOOL_*_BUILD=Off on the CMake command line will disable inclusion of a clang/tools subdirectory.

llvm-svn: 250840
2015-10-20 18:12:12 +00:00
Reid Kleckner 077fe12e5d Look through using decls when classifying implicit member access
Clang will now accept this valid C++11 code:
  struct A { int field; };
  struct B : A {
    using A::field;
    enum { TheSize = sizeof(field) };
  };

Previously we would classify the 'field' reference as something other
than a field, and then forget to apply the C++11 rule to allow
non-static data member references in unevaluated contexts.

This usually arises in class templates that want to reference fields of
a dependent base in an unevaluated context outside of an instance
method. Such contexts do not allow references to 'this', so the only way
to access the field is with a using decl and an implicit member
reference.

llvm-svn: 250839
2015-10-20 18:12:08 +00:00
Chris Bieneman 38b2dec37e [CMake] Make external compiler-rt install scripts relative to CMAKE_INSTALL_PREFIX.
This change makes LLVM_BUILD_EXTERNAL_COMPILER_RT work correctly when overriding CMAKE_INSTALL_PREFIX on the install action (which is how LLVM_CREATE_XCODE_TOOLCHAIN works).

This fix is two parts:
(1) Pass CMAKE_INSTALL_PREFIX in as a variable from the parent install to the child install
(2) When passing COMPILER_RT_INSTALL_PATH into the external project make sure it is passed as a string not a path.

Not specifying the full path for COMPILER_RT_INSTALL_PATH isn't enough to fix the issue because relative paths specified on the CMake command line are expanded relative to the working directory before the cache is populated. Forcing this to a string allows it to remain a relative path through to the install() calls. Relative paths specified in install() calls are expanded relative to CMAKE_INSTALL_PREFIX at install time.

llvm-svn: 250834
2015-10-20 16:39:25 +00:00
Benjamin Kramer 36307ffa1b [AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap.
Firstly this changes the type of parent map to be keyed on DynTypedNode to
simplify the following changes. This comes with a DenseMapInfo for
DynTypedNode, which is a bit incomplete still and will probably only work
for parentmap right now.

Then the RecursiveASTVisitor in ASTContext is updated and finally
ASTMatchers hasParent and hasAncestor learn about the new functionality.

Now ParentMap is only missing TemplateArgumentLocs and CXXCtorInitializers.

Differential Revision: http://reviews.llvm.org/D13897

llvm-svn: 250831
2015-10-20 15:08:46 +00:00
Angel Garcia Gomez 637d1e6694 Roll-back r250822.
Summary: It breaks the build for the ASTMatchers

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D13893

llvm-svn: 250827
2015-10-20 13:23:58 +00:00
Angel Garcia Gomez b5250d3448 Apply modernize-use-default to clang.
Summary: Replace empty bodies of default constructors and destructors with '= default'.

Reviewers: bkramer, klimek

Subscribers: klimek, alexfh, cfe-commits

Differential Revision: http://reviews.llvm.org/D13890

llvm-svn: 250822
2015-10-20 12:52:55 +00:00
Andrea Di Biagio 8bb12d0a77 [x86] Fix maskload/store intrinsic definitions in avxintrin.h
According to the Intel documentation, the mask operand of a maskload and
maskstore intrinsics is always a vector of packed integer/long integer values.
This patch introduces the following two changes:
 1. It fixes the avx maskload/store intrinsic definitions in avxintrin.h.
 2. It changes BuiltinsX86.def to match the correct gcc definitions for avx
    maskload/store (see D13861 for more details).

Differential Revision: http://reviews.llvm.org/D13861

llvm-svn: 250816
2015-10-20 11:19:54 +00:00
Benjamin Kramer b993613800 Revert accidental commit. This isn't ready yet.
llvm-svn: 250804
2015-10-20 07:53:14 +00:00
Benjamin Kramer 1b7dd8d7e3 Put back dead code that's used out-of-tree.
Partially reverts r250418.

llvm-svn: 250803
2015-10-20 07:50:21 +00:00
Alexey Bataev 2bf9b4c0d1 [DEBUG INFO] Emit debug info for type used in explicit cast only.
Currently debug info for types used in explicit cast only is not emitted. It happened after a patch for better alignment handling. This patch fixes this bug.
Differential Revision: http://reviews.llvm.org/D13582

llvm-svn: 250795
2015-10-20 04:24:12 +00:00
Reid Kleckner 7d3a2f067f Revert "Diagnose UnresolvedLookupExprs that resolve to instance members in static methods"
This reverts commit r250592.

It has issues around unevaluated contexts, like this:
  template <class T> struct A { T i; };
  template <class T>
  struct B : A<T> {
    using A<T>::i;
    typedef decltype(i) U;
  };
  template struct B<int>;

llvm-svn: 250774
2015-10-20 00:31:42 +00:00
Craig Topper d945d50efc [X86] Remove a few 'else' after 'return'
llvm-svn: 250764
2015-10-20 00:00:17 +00:00
David Majnemer fac5243493 [MS ABI] Give linkonce_odr, instead of external_linkage, to certain kinds of static data members
Out-of-line definitions of static data members which have an inline
initializer must get GVA_DiscardableODR linkage instead of
GVA_StrongExternal linkage.

MSVC 2013's behavior is different with respect to this and would cause
link errors if one TU provided a definition while another did not.
MSVC 2015 fixed this bug, making this OK.  Note that the 2015 behavior
is always compatible with 2013: it never produces a strong definition.

This essentially reverts r237787.

llvm-svn: 250757
2015-10-19 23:22:49 +00:00
Nico Weber 3cb667edaa clang-format: Use pipes instead of temporary files for most lit tests.
This makes the format tests look more like most other FileCheck tests in clang.

The multiple-inputs tests still use temp files, to make sure that the file
input code in clang-format stays tested.

Stop stripping out the comment lines in style-on-command-line.cpp as they don't
get in the way and it makes the test simpler. Also remove 2>&1s on the tests in
that file that don't need it.

http://reviews.llvm.org/D13852

llvm-svn: 250706
2015-10-19 16:21:29 +00:00
Diego Novillo 843dc6ffbf Sample Profiles - Fix location of binary encoding documentation. NFC.
llvm-svn: 250705
2015-10-19 15:53:17 +00:00
Marek Kurdej e5c485c70b Added new options to ClangFormat VSIX package.
Summary:
Added new options to ClangFormat VSIX package:
* fallback-style
* assume-filename
* sort-includes.
Changed version to 1.1 (otherwise one couldn't update).

Fixed clang-format escaping of XML reserved characters.

Reviewers: hans, aaron.ballman, klimek, rnk, zturner

Subscribers: djasper, cfe-commits

Differential Revision: http://reviews.llvm.org/D13549

llvm-svn: 250694
2015-10-19 10:08:35 +00:00
Manuel Klimek ab2e28ebaf Fix 'will be initialized after' warning.
llvm-svn: 250691
2015-10-19 08:43:46 +00:00
Manuel Klimek 74ca428df7 Make test not rely on %T ending on /Output.
llvm-svn: 250690
2015-10-19 08:27:51 +00:00
Michael Kuperstein b1ec50d56a [X86] Enable soft float ABI for x86
The Intel MCU psABI requires floating-point values to be passed in-reg.
This makes the x86-32 ABI code respect "-mfloat-abi soft" and generate float inreg arguments.

Differential Revision: http://reviews.llvm.org/D13554

llvm-svn: 250689
2015-10-19 08:09:43 +00:00
Michael Kuperstein dc74520432 Use saner variable names. NFC.
llvm-svn: 250687
2015-10-19 07:52:25 +00:00
Alexey Bataev 1d97d2a3d2 [OPENMP] Fix for http://llvm.org/PR25221: Infinite loop while parsing OpenMP directive
Clang skipped annot_pragma_openmp token, while it should be considered as a stop token while skipping tokens.

llvm-svn: 250684
2015-10-19 06:40:17 +00:00
Craig Topper 6c03a54444 Make getTargetBuiltins return an ArrayRef instead of having two out parameters of a pointer and length. NFC
llvm-svn: 250681
2015-10-19 04:51:35 +00:00
Craig Topper f054e3ad6d Recommit "Return an ArrayRef instead of having two out parameters of a pointer and length. NFC". Hopefully this time the bots will be happy.
llvm-svn: 250678
2015-10-19 03:52:27 +00:00
Craig Topper d255c00acd Revert r250676 "Return an ArrayRef instead of having two out parameters of a pointer and length. NFC"
llvm-svn: 250677
2015-10-19 03:17:00 +00:00
Craig Topper 9c4d9b2316 Return an ArrayRef instead of having two out parameters of a pointer and length. NFC
llvm-svn: 250676
2015-10-19 03:05:12 +00:00
Nico Weber afa62fae1e clang-format: Extend main header include sorting heuristic to Objective-C files.
llvm-svn: 250675
2015-10-19 01:36:09 +00:00
Saleem Abdulrasool 7f66d75832 docs: remote stale refs
Since the attribute documentation is now auto-generated, the previous references
are no longer valid.  This prevented the docs build from completing
successfully.

llvm-svn: 250674
2015-10-19 01:24:08 +00:00
Nico Weber 187fcf1e5d Update `clang-format -help` output in clang-format docs.
-assume-filename, -fallback-style, and -sort-includes are new.  (They're also
longer than the previous options, so all descriptions shift over by some amount,
making this diff look larger than it is.)

It looks like someone renamed "General options" to "Generic Options" too.

llvm-svn: 250672
2015-10-19 01:08:30 +00:00
Nico Weber 373ee96e73 Update list of languages advertised in OVERVIEW: A tool to format C/C++/Java/JavaScript/Objective-C/Protobuf code.
If no arguments are specified, it formats the code from standard input
and writes the result to the standard output.
If <file>s are given, it reformats the files. If -i is specified
together with <file>s, the files are edited in-place. Otherwise, the
result is written to the standard output.

USAGE: clang-format [options] [<file> ...]

OPTIONS:
  -assume-filename=<string> - When reading from stdin, clang-format assumes this
                              filename to look for a style config file (with
                              -style=file) and to determine the language.
  -cursor=<uint>            - The position of the cursor when invoking
                              clang-format from an editor integration
  -dump-config              - Dump configuration options to stdout and exit.
                              Can be used with -style option.
  -fallback-style=<string>  - The name of the predefined style used as a
                              fallback in case clang-format is invoked with
                              -style=file, but can not find the .clang-format
                              file to use.
                              Use -fallback-style=none to skip formatting.
  -help                     - Display available options (-help-hidden for more)
  -i                        - Inplace edit <file>s, if specified.
  -length=<uint>            - Format a range of this length (in bytes).
                              Multiple ranges can be formatted by specifying
                              several -offset and -length pairs.
                              When only a single -offset is specified without
                              -length, clang-format will format up to the end
                              of the file.
                              Can only be used with one input file.
  -lines=<string>           - <start line>:<end line> - format a range of
                              lines (both 1-based).
                              Multiple ranges can be formatted by specifying
                              several -lines arguments.
                              Can't be used with -offset and -length.
                              Can only be used with one input file.
  -offset=<uint>            - Format a range starting at this byte offset.
                              Multiple ranges can be formatted by specifying
                              several -offset and -length pairs.
                              Can only be used with one input file.
  -output-replacements-xml  - Output replacements as XML.
  -sort-includes            - Sort touched include lines
  -style=<string>           - Coding style, currently supports:
                                LLVM, Google, Chromium, Mozilla, WebKit.
                              Use -style=file to load style configuration from
                              .clang-format file located in one of the parent
                              directories of the source file (or current
                              directory for stdin).
                              Use -style="{key: value, ...}" to set specific
                              parameters, e.g.:
                                -style="{BasedOnStyle: llvm, IndentWidth: 8}"
  -version                  - Display the version of this program output.

llvm-svn: 250671
2015-10-19 01:03:19 +00:00
Nick Lewycky 4b81fc87ad No functionality change, just fix whitespace, a typo and remove an unnecessary
emacs mode marker. (Changes left behind from another patch that ended up not
working out.)

llvm-svn: 250666
2015-10-18 20:32:12 +00:00
Saleem Abdulrasool b25445cb48 CodeGen: simplify TargetOptions setup
Do direct assignment of boolean values and regroup.  Use StringSwitch instead of
custom cases.  NFC.

llvm-svn: 250665
2015-10-18 20:24:53 +00:00
Dimitry Andric 0cc6f47348 Support linking against OpenMP runtime on FreeBSD.
Summary:
Similar to rL248426 (which was a followup to rL248379 and rL248424), add the
required libraries for OpenMP on the linker command line, and update the test
case.

Reviewers: emaste, theraven, joerg

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D13822

llvm-svn: 250657
2015-10-18 13:32:20 +00:00
Daniel Jasper 265309e38a clang-format: [JS] Handle string literals spanning character classes.
If a RegExp contains a character group with a quote (/["]/), the
trailing end of it is first tokenized as a string literal, which leads
to the merging code seeing an unbalanced bracket.

This change parses regex literals from the left hand side. That
simplifies the parsing code and also allows correctly handling escapes
and character classes, hopefully correctly parsing all regex literals.

Patch by Martin Probst, thank you.
Review: http://reviews.llvm.org/D13765

llvm-svn: 250648
2015-10-18 07:02:28 +00:00
Craig Topper 273dbc602f Make a bunch of static arrays const.
llvm-svn: 250647
2015-10-18 05:29:26 +00:00
Craig Topper e353a7257e Add an unnecessary makeArrayRef I add earlier. I didn't realize range-based for loops worked with arrays.
llvm-svn: 250646
2015-10-18 05:29:23 +00:00
Craig Topper 2685cbe056 Use std::is_sorted instead of a manual loop.
llvm-svn: 250645
2015-10-18 05:29:21 +00:00
NAKAMURA Takumi 91352728af clang/test/Driver/ps4-linker-non-win.c: Tweak for cygwin like ps4-linker-win.c@250403. Cygwin seeks dependent libs along $PATH.
llvm-svn: 250632
2015-10-17 23:54:54 +00:00
NAKAMURA Takumi c8e10523f9 clang/test/Driver/ps4-linker-non-win.c: Make %T/ps4-ld executable, or the driver wouldn't find it.
llvm-svn: 250631
2015-10-17 23:47:02 +00:00
NAKAMURA Takumi c4d8ed0e53 clang/test/Driver/ps4-linker-non-win.c: Make sure that %T/ps4-ld would be used but *fails*.
llvm-svn: 250630
2015-10-17 23:15:16 +00:00
Daniel Jasper 148f32925f clang-format: Add test for (properly escaped) XML output.
llvm-svn: 250629
2015-10-17 22:44:19 +00:00
Craig Topper 924f6db21d Replace a static compare function with a lambda. NFC
llvm-svn: 250621
2015-10-17 20:18:46 +00:00
Craig Topper c00e953cb2 Use a range-based for loop. Use std::end instead of pointer+array_lengthof. NFC
llvm-svn: 250617
2015-10-17 17:10:43 +00:00
Davide Italiano c4958b4b52 [Frontend] Name variable correctly.
Reported by: Kim Grasman!

llvm-svn: 250605
2015-10-17 06:46:39 +00:00
Eric Fiselier 3acf5fdd88 Add an AST node matcher for TemplateTypeParmDecl objects.
llvm-svn: 250602
2015-10-17 02:34:44 +00:00
Reid Kleckner f438a020bf Diagnose UnresolvedLookupExprs that resolve to instance members in static methods
During the initial template parse for this code, 'member' is unresolved
and we don't know anything about it:

  struct A { int member };
  template <typename T>
  struct B : public T {
    using T::member;
    static void f() {
      (void)member; // Could be static or non-static.
    }
  };
  template class B<A>;

The pattern declaration contains an UnresolvedLookupExpr rather than an
UnresolvedMemberExpr because `f` is static, and `member` should never be
a field. However, if the code is invalid, it may become a field, in
which case we should diagnose it.

Reviewers: rjmccall, rsmith

Differential Revision: http://reviews.llvm.org/D6700

llvm-svn: 250592
2015-10-17 00:19:04 +00:00
Richard Smith 95dc57a611 [modules] Allow the error when explicitly loading an incompatible module file
via -fmodule-file= to be turned off; in that case, just include the relevant
files textually. This allows module files to be unconditionally passed to all
compile actions via CXXFLAGS, and to be ignored for rules that specify custom
incompatible flags.

llvm-svn: 250577
2015-10-16 23:20:19 +00:00
Davide Italiano 27043302a4 [Frontend/CompilerInvocation] Use range-based loop. NFC.
llvm-svn: 250559
2015-10-16 22:13:53 +00:00
Richard Smith 3d5b48c480 Refactor module lookup when looking up a header file, and wire through the requesting module. No functionality change.
llvm-svn: 250554
2015-10-16 21:42:56 +00:00
Richard Barton ea04359859 Once again fix this test to read from stdin rather than an input file
llvm-svn: 250547
2015-10-16 20:15:33 +00:00
Richard Barton 8c11bcf73a Further increase helfulness of assert message
If you increase the number of diags of a particular type by one more than the
number available you get the nice assert message. If you do it by two more
than available you get the old non-helpful message. Combining the two makes
sense I think.

llvm-svn: 250546
2015-10-16 20:15:29 +00:00
James Y Knight a6c9ee777a Teach MyriadToolchain how to find its C++ header paths.
Also move the addLibStdCXXIncludePaths helper function from Linux to
Generic_GCC.

llvm-svn: 250536
2015-10-16 18:46:26 +00:00
Filipe Cabecinhas 4585ed006a [PS4] Add missing tests for -fsanitize=...
llvm-svn: 250516
2015-10-16 15:08:01 +00:00
Filipe Cabecinhas 67d28057fa PS4: Add tests for rtti/vptr-sanitizer interaction
llvm-svn: 250515
2015-10-16 15:07:56 +00:00
Filipe Cabecinhas 82cd6af690 PS4: Make sure to add the sanitizer runtime before any linker input
llvm-svn: 250514
2015-10-16 15:07:48 +00:00
NAKAMURA Takumi 55bf953344 [CMake] Reformat CLANG_TEST_DEPS.
llvm-svn: 250503
2015-10-16 09:38:42 +00:00
Sean Eveson 3f072ef82c Test commit
llvm-svn: 250500
2015-10-16 08:54:23 +00:00
Craig Topper e33f51fa91 [X86] Add fxsr feature name for fxsave/fxrestore builtins.
llvm-svn: 250498
2015-10-16 06:22:36 +00:00
Craig Topper 3804669996 [X86] Add sse4.2 feature name to CRC32 builtins.
llvm-svn: 250496
2015-10-16 05:25:15 +00:00
Craig Topper f924578b2b [X86] Add proper feature name to some avx512dq builtins.
llvm-svn: 250495
2015-10-16 05:25:04 +00:00
George Burgess IV a51c4077c5 Make __builtin_object_size more conservative
r246877 made __builtin_object_size substantially more aggressive with
unknown bases if Type=1 or Type=3, which causes issues when we encounter
code like this:

struct Foo {
  int a;
  char str[1];
};

const char str[] = "Hello, World!";
struct Foo *f = (struct Foo *)malloc(sizeof(*f) + strlen(str));
strcpy(&f->str, str);

__builtin_object_size(&f->str, 1) would hand back 1, which is
technically correct given the type of Foo, but the type of Foo lies to
us about how many bytes are available in this case.

This patch adds support for this "writing off the end" idiom -- we now
answer conservatively when we're given the address of the very last
member in a struct.

Differential Revision: http://reviews.llvm.org/D12169

llvm-svn: 250488
2015-10-16 01:49:01 +00:00
George Burgess IV 2a6150d932 [Sema] Fix address-of + enable_if overloading logic
Previously, our logic when taking the address of an overloaded function
would not consider enable_if attributes, so long as all of the enable_if
conditions on a given candidate were true. So, two functions with
identical signatures (one with enable_if attributes, the other without),
would be considered equally good overloads. If we were calling the
function instead of taking its address, then the function with enable_if
attributes would be preferred.

This patch makes us prefer the candidate with enable_if regardless of if
we're calling or taking the address of an overloaded function.

Differential Revision: http://reviews.llvm.org/D13795

llvm-svn: 250486
2015-10-16 01:17:38 +00:00
Eric Fiselier 09c1ffdc8f Add "-Wc++11-inline-namespace" so that libc++ can use -pedantic in C++03.
Summary: The title says it all.

Reviewers: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D13790

llvm-svn: 250477
2015-10-16 00:31:36 +00:00
Eric Christopher c276e80022 Mark this test as requiring and x86 registered target.
llvm-svn: 250475
2015-10-16 00:14:36 +00:00
Eric Christopher 15709991d0 Add an error when calling a builtin that requires features that don't
match the feature set of the function that they're being called from.

This ensures that we can effectively diagnose some[1] code that would
instead ICE in the backend with a failure to select message.

Example:

__m128d foo(__m128d a, __m128d b) {
  return __builtin_ia32_addsubps(b, a);
}

compiled for normal x86_64 via:

clang -target x86_64-linux-gnu -c

would fail to compile in the back end because the normal subtarget
features for x86_64 only include sse2 and the builtin requires sse3.

[1] We're still not erroring on:

__m128i bar(__m128i const *p) { return _mm_lddqu_si128(p); }

where we should fail and error on an always_inline function being
inlined into a function that doesn't support the subtarget features
required.

llvm-svn: 250473
2015-10-15 23:47:11 +00:00
Eric Christopher 4bad57c9bc Fix the subtarget features required by some x86 builtins.
Update the fma builtins to be fma/fma4 until some we can find some
documentation either way.

Update a couple of the avx intrinsics because they were in the wrong
category.

llvm-svn: 250470
2015-10-15 22:46:02 +00:00
Teresa Johnson 8f865a41fb Add llvm-bcanalyzer to list of clang test dependences
This addresses a bot failure from r250455, since new Misc/thinlto.c
test uses it.

llvm-svn: 250460
2015-10-15 21:06:53 +00:00
Teresa Johnson 945bc50f21 Recommit "Clang support for -flto=thin."
This recommits r250398 with fixes to the tests for bot failures.

Add "-target x86_64-unknown-linux" to the clang invocations that
check for the gold plugin.

llvm-svn: 250455
2015-10-15 20:35:53 +00:00
Eric Christopher abde1c2b51 The target-feature command line option doesn't take a comma delimited
string, so split them into multiple options.

llvm-svn: 250449
2015-10-15 20:04:42 +00:00
Eric Christopher 4fb4fbc5d6 Add the minimum target features that these tests depend upon.
llvm-svn: 250448
2015-10-15 20:04:40 +00:00
Daniel Jasper f39757d0c0 clang-format: Basic escaping when outputting XML.
llvm-svn: 250440
2015-10-15 18:39:31 +00:00
Benjamin Kramer 2811b04874 Put back doxygen comment accidentally dropped in r250418.
llvm-svn: 250428
2015-10-15 16:46:25 +00:00
Nico Weber 2cd92f1cc7 clang-format/java: Break after annotations on fields in Chromium style.
Chromium follows the Android style guide for Java code, and that doesn't make
the distinction between fields and non-fields that the Google Java style guide
makes:

https://source.android.com/source/code-style.html#use-standard-java-annotations
https://google.github.io/styleguide/javaguide.html#s4.8.5-annotations

llvm-svn: 250422
2015-10-15 16:03:01 +00:00
Benjamin Kramer c2d2b4259c [CodeGen] Remove dead code. NFC.
llvm-svn: 250418
2015-10-15 15:29:40 +00:00
Ed Schouten ea9448e468 Add support for CloudABI/aarch64.
The core C library has already been ported over to aarch64 successfully,
meaning there is no reason to hold this change back.

llvm-svn: 250416
2015-10-15 15:07:07 +00:00
NAKAMURA Takumi 430443ba61 Tweak to make clang/test/Driver/ps4-linker-win.c less sinsitive of DLL path.
- On mingw-w64, libstdc++-6.dll is used for clang.exe. The DLL might not be in Windows' system directory.
  - With --enable-shared, DLLs might be in ${CMAKE_BINARY_DIR}/bin.

I understand this test confirms that appropriate name of executable can be found on %PATH%.
Therefore I added "Output\\" before each expression.

FIXME: The output directory %T is hardcoded like "Output\\ps4-ld.exe".
llvm-svn: 250403
2015-10-15 13:51:13 +00:00
Teresa Johnson fca505c674 Revert "Clang support for -flto=thin." (bot failures)
Rolling this back for now since there are a couple of bot failures on
the new tests I added, and I won't have a chance to look at them in detail
until later this afternoon. I think the new tests need some restrictions on
having the gold plugin available.

This reverts commit r250398.

llvm-svn: 250402
2015-10-15 13:41:51 +00:00
Teresa Johnson 31b2354929 Clang support for -flto=thin.
Summary:
Add clang support for -flto=thin option, which is used to set the
EmitFunctionSummary code gen option on compiles.

Add -flto=full as an alias to the existing -flto.

Add tests to check for proper overriding of -flto variants on the
command line, and convert grep tests to FileCheck.

Reviewers: dexonsmith, joker.eph

Subscribers: davidxl, cfe-commits

Differential Revision: http://reviews.llvm.org/D11908

llvm-svn: 250398
2015-10-15 13:08:13 +00:00
Peter Collingbourne e919b0f9ad Headers: Switch some headers to LF line endings for consistency.
llvm-svn: 250388
2015-10-15 10:33:27 +00:00
Eric Christopher 28a6db5929 Update clang for DIBuilder::createSubroutineType API change.
Patch by Amaury Sechet!

llvm-svn: 250373
2015-10-15 06:56:08 +00:00
Craig Topper 1ac9bfb844 [X86] Add proper feature names to xsave builtins.
llvm-svn: 250369
2015-10-15 05:23:46 +00:00
Craig Topper da9fe56bf6 [X86] Add command line switches for xsave/xsaveopt/xsavec/xsaves. Macro defines for the same. And add the flags to correct CPU names.
llvm-svn: 250368
2015-10-15 05:23:38 +00:00
Douglas Katzman 64071ad864 Remove unnecessary braces in single-line 'if'.
llvm-svn: 250363
2015-10-15 04:10:40 +00:00
Craig Topper 543f3bdf39 [X86] Use C+11 non-static data member initialization to initialize all the X86 feature controls. NFC
This simplifies the constructor initialization list and makes it less likely a feature flag will be forgotten there.

llvm-svn: 250348
2015-10-14 23:47:57 +00:00
Diego Novillo 33452761bb Sample profiles - Update text profile documentation.
There's been some changes to the text encoding for sample profiles. This
updates the documentation and an example.

llvm-svn: 250310
2015-10-14 18:37:39 +00:00
Hans Wennborg 4ca00afd7c Intrin.h: implement __emul and __emulu
llvm-svn: 250301
2015-10-14 16:24:28 +00:00
Filipe Cabecinhas 2432ff59d3 Tweak a -g related test for the PS4
Make sure we're matching what we want:
 - Always have -generate-arange-section (independent of -g)
 - Emit a -dwarf-version=... when -g is there.

llvm-svn: 250298
2015-10-14 14:45:36 +00:00
Filipe Cabecinhas c888e190ba Bring back r250262: PS4 toolchain
There was a minor problem with a test. Sorry for the noise yesterday.

This patch adds missing pieces to clang, including the PS4 toolchain
definition, added warnings, PS4 defaults, and Driver changes needed for
our compiler.

A patch by Filipe Cabecinhas, Pierre Gousseau and Katya Romanova!

Differential Revision: http://reviews.llvm.org/D13482

llvm-svn: 250293
2015-10-14 12:25:43 +00:00
Chris Bieneman 767828b7bb [CMake] Add LLVM_VERSION_PATCH to the -current_version flag for libclang.
This is to match autoconf where LLVM_SUBMIT_SUBVERSION is usually set to ${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}.

llvm-svn: 250278
2015-10-14 07:50:47 +00:00
Sean Silva 2eab17737d Revert-to-green r250262 (PS4 toolchain patch)
It is breaking llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast
e.g. http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/1362

llvm-svn: 250273
2015-10-14 06:45:07 +00:00
Eric Christopher cd875efa78 Canonicalize some of the x86 builtin tests and either remove or comment
about optimization options.

llvm-svn: 250271
2015-10-14 05:40:21 +00:00
Eric Christopher 442c9b6b41 Remove the optimization option from this test as it is unnecessary
and front end tests should avoid this if possible.

llvm-svn: 250270
2015-10-14 05:40:11 +00:00
Alexey Bataev 6910347f62 [MSVC] Fix for http://llvm.org/PR24132: __declspec(property): double invocations of foo() when compiling foo()->propertyName
Removes extra codegen for base expression of MS property call
Differential Revision: http://reviews.llvm.org/D13375

llvm-svn: 250265
2015-10-14 04:05:42 +00:00
Ekaterina Romanova ae50156fbf I took care of the build problem in the commit 250252.
Resubmitting the patch. 

This patch adds missing pieces to clang, including the PS4 toolchain
definition, added warnings, PS4 defaults, and Driver changes needed for
our compiler.

A patch by Filipe Cabecinhas, Pierre Gousseau and Katya Romanova!

Differential Revision: http://reviews.llvm.org/D13482

llvm-svn: 250262
2015-10-14 01:09:02 +00:00
Ekaterina Romanova 89afd1297d reverting my patch, cause build problems
llvm-svn: 250257
2015-10-14 00:03:20 +00:00
Ekaterina Romanova a59fcbae4f This patch adds missing pieces to clang, including the PS4 toolchain
definition, added warnings, PS4 defaults, and Driver changes needed for
our compiler.

A patch by Filipe Cabecinhas, Pierre Gousseau and Katya Romanova!

Differential Revision: http://reviews.llvm.org/D13482

llvm-svn: 250252
2015-10-13 23:40:02 +00:00
Argyrios Kyrtzidis 3a43754329 [Sema/objc] When checking for unimplemented methods treat methods from class extensions as continuation of the class interface.
llvm-svn: 250250
2015-10-13 23:27:34 +00:00
Chris Bieneman 658beb930e [CMake]Getting rid of references to LLVM_SUBMIT_VERSION and LLVM_SUBMIT_SUBVERSION in favor of LLVM_VERSION_MAJOR and LLVM_VERSION_MINOR.
LLVM_SUBMIT_VERSION and LLVM_SUBMIT_SUBVERSION are commonly used variable names in the autoconf build system. They seem to have leeched into clang's CMake in a few places, and should just be replaced by the LLVM_VERSION_* variables where appropriate.

llvm-svn: 250246
2015-10-13 23:03:54 +00:00
Devin Coughlin 4f770dee54 [analyzer] Don’t invalidate CXXThis when conservatively evaluating const methods (PR 21606)
Prevent invalidation of `this' when a method is const; fixing PR 21606.

A patch by Sean Eveson!

Differential Revision: http://reviews.llvm.org/D13099

llvm-svn: 250237
2015-10-13 22:20:52 +00:00
Eric Christopher e45972719e Move the adc-builtins test to the pattern of the other builtins
tests by predefining _MM_MALLOC_H rather than use -ffreestanding.

llvm-svn: 250203
2015-10-13 18:40:21 +00:00
Eric Christopher 525334cf6c Add subtarget feature support for 3dnowa to the 3dnowa intrinsics.
llvm-svn: 250202
2015-10-13 18:40:17 +00:00
Chris Bieneman 4977f4261e [CMake] When building clang as an external project we should pass through all variables that start with COMPILER_RT
llvm-svn: 250196
2015-10-13 18:17:30 +00:00
Douglas Katzman 722bcb08f1 Always pass a -dwarf-version argument to integrated as.
This removes the default of 3 hidden in the assembler previously.

Fixes breakage caused by r249655, reported by vsukharev.

llvm-svn: 250173
2015-10-13 16:22:51 +00:00
Benjamin Kramer f420dda18d [Driver] Use the parent_path of the clang executable as the default InstalledDir
This is what most people want anyways. Clang -cc1's main() will override
this but for other tools this is the most sensible default and avoids
some work.

llvm-svn: 250164
2015-10-13 15:19:32 +00:00
Amjad Aboud 2b9b8a5921 [X86] Add XSAVE intrinsic family
Add intrinsics for the
  XSAVE instructions (XSAVE/XSAVE64/XRSTOR/XRSTOR64)
  XSAVEOPT instructions (XSAVEOPT/XSAVEOPT64)
  XSAVEC instructions (XSAVEC/XSAVEC64)
  XSAVES instructions (XSAVES/XSAVES64/XRSTORS/XRSTORS64)

Differential Revision: http://reviews.llvm.org/D13014

llvm-svn: 250158
2015-10-13 12:29:35 +00:00
Benjamin Kramer 71aa9c74a7 Remove unused diagnostic. NFC.
llvm-svn: 250155
2015-10-13 10:10:03 +00:00
Craig Topper 334d46150d [X86] LLVM now prints XOP immediates as unsigned after r250147. Fix expected check string accordingly.
llvm-svn: 250149
2015-10-13 05:15:17 +00:00
Richard Smith 68142216ee [modules] Improve error message on failed module load due to a missing file to
say which module file referenced the missing file.

llvm-svn: 250140
2015-10-13 01:26:26 +00:00
Richard Smith e69bdd10ea [modules] Allow the error on importing a C++ module within an extern "C"
context (but otherwise at the top level) to be disabled, to support use of C++
standard library implementations that (legitimately) mark their <blah.h>
headers as being C++ headers from C libraries that wrap things in 'extern "C"'
a bit too enthusiastically.

llvm-svn: 250137
2015-10-13 00:39:40 +00:00
NAKAMURA Takumi 38c2f6cb20 Tweak clang/test/CodeGen/debug-prefix-map.c to appease win32 hosts.
!1 = !DIFile(filename: "/var/empty\5C<stdin>", directory: "E:\5Cllvm\5Cbuild\5Ccmake-ninja\5Ctools\5Cclang\5Ctest\5CCodeGen")

llvm-svn: 250136
2015-10-13 00:38:06 +00:00
Richard Smith f983f7f627 [modules] Fix merging of __va_list_tag's implicit special member functions.
We model predefined declarations as not being from AST files, but in most ways
they act as if they come from some implicit prebuilt module file imported
before all others. Therefore, if we see an update to the predefined 'struct
__va_list_tag' declaration (and we've already loaded any modules), it needs a
corresponding update record, even though it didn't technically come from an AST
file.

llvm-svn: 250134
2015-10-13 00:23:25 +00:00
Evgeniy Stepanov 82c00bee3c [safestack] Driver link test for safestack on android.
Safestack runtime should never be linked on Android targets because
it is implemented directly in libc. This is already the case, but
mostly by chance (collectSanitizerRuntimes would only link shared
sanitizer runtimes, and safestack has only a static one). Protect
this behavior with a test.

llvm-svn: 250128
2015-10-12 23:50:19 +00:00
Matthias Gehre 2cf7e803bb Add decayedType and hasDecayedType AST matchers
Summary: Add decayedType and hasDecayedType AST matchers

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D13639

llvm-svn: 250114
2015-10-12 21:46:07 +00:00
Saleem Abdulrasool 9e593499b9 test: change argument
This failed on AArch64 due to the type mismatch using int instead of
__builtin_va_list.

llvm-svn: 250112
2015-10-12 21:19:30 +00:00
Saleem Abdulrasool 83346258eb test: relax path matching for windows
The test failed on Windows due to use of \ as a path separator rather than /.

llvm-svn: 250111
2015-10-12 21:19:27 +00:00
Richard Smith 2c072af95e Add warning flags for #include_next and some nearby warnings.
llvm-svn: 250105
2015-10-12 21:05:54 +00:00
Hans Wennborg 7357bbc6c3 Parse and ignore #pragma runtime_checks in MS extensions mode (PR25138)
We already silently ignore the /RTC, which controls the same functionality.

llvm-svn: 250099
2015-10-12 20:47:58 +00:00
Saleem Abdulrasool 436256a713 Support Debug Info path remapping
Add support for the `-fdebug-prefix-map=` option as in GCC.  The syntax is
`-fdebug-prefix-map=OLD=NEW`.  When compiling files from a path beginning with
OLD, change the debug info to indicate the path as start with NEW.  This is
particularly helpful if you are preprocessing in one path and compiling in
another (e.g. for a build cluster with distcc).

Note that the linearity of the implementation is not as terrible as it may seem.
This is normally done once per file with an expectation that the map will be
small (1-2) entries, making this roughly linear in the number of input paths.

Addresses PR24619.

llvm-svn: 250094
2015-10-12 20:21:08 +00:00
George Burgess IV 5f21c71800 [Sema] Make `&function_with_enable_if_attrs` an error
This fixes a bug where one can take the address of a conditionally
enabled function to drop its enable_if guards. For example:

  int foo(int a) __attribute__((enable_if(a > 0, "")));
  int (*p)(int) = &foo;
  int result = p(-1); // compilation succeeds; calls foo(-1)

Overloading logic has been updated to reflect this change, as well.

Functions with enable_if attributes that are always true are still
allowed to have their address taken.

Differential Revision: http://reviews.llvm.org/D13607

llvm-svn: 250090
2015-10-12 19:57:04 +00:00
George Burgess IV 5f2ef457bf [Sema] Don't emit multiple diags for one error
Fixed a bug where we'd emit multiple diagnostics if there was a problem
taking the address of an overloaded template function.

Differential Revision: http://reviews.llvm.org/D13664

llvm-svn: 250078
2015-10-12 18:40:58 +00:00
Chris Bieneman a1566a414a [CMake] Bug 14109 - CMake build for compiler-rt should use just-built clang
Summary:
Many small improvements to LLVM_BUILD_EXTERNAL_COMPILER_RT.

* Works correctly with Ninja by working around CMake Bug 14771 (https://cmake.org/Bug/view.php?id=14771)
* Has install-compiler-rt target, and installs as part of the default install target
* Sets the install paths properly so that it matches the non-standalone build
* Only generate the test targets if(LLVM_INCLUDE_TESTS)

Reviewers: samsonov, Bigcheese

Differential Revision: http://reviews.llvm.org/D13399

llvm-svn: 250064
2015-10-12 16:34:23 +00:00
Benjamin Kramer 71ce376b2f [VFS] Let the user decide if they want path normalization.
This is a more principled version of what I did earlier. Path
normalization is generally a good thing, but may break users in strange
environments, e. g. using lots of symlinks. Let the user choose and
default it to on.

This also changes adding a duplicated file into returning an error if
the file contents are different instead of an assertion failure.

Differential Revision: http://reviews.llvm.org/D13658

llvm-svn: 250060
2015-10-12 16:16:39 +00:00
Simon Atanasyan ecce7e1cac [Driver] Remove `else` after `return`
llvm-svn: 250043
2015-10-12 14:32:57 +00:00
Benjamin Kramer 753726d6a9 [VFS] Unbreak test.
llvm-svn: 250037
2015-10-12 13:39:33 +00:00
Benjamin Kramer 4ad1c43edd [VFS] Don't try to be heroic with '.' in paths.
Actually the only special path we have to handle is ./foo, the rest is
tricky to get right so do the same thing as the existing YAML vfs here.

llvm-svn: 250036
2015-10-12 13:30:38 +00:00
Benjamin Kramer c3741ec8d3 [VFS] remove handling of '..' for now.
This can fail badly if we're overlaying a real file system and there are
symlinks there. Just keep the path as-is for now.

This essentially reverts r249830.

llvm-svn: 250021
2015-10-12 09:22:07 +00:00
Alexey Bataev 6d45532961 [ATTR] Automatic line feed after pragma-like attribute.
Automatically insert line feed after pretty printing of all pragma-like attributes + fix printing of pragma-like pragmas on declarations.
Differential Revision: http://reviews.llvm.org/D13546

llvm-svn: 250017
2015-10-12 06:59:48 +00:00
Daniel Jasper 4d72449de6 clang-format: Fixed typecast getting put on a separate line from the
key in Obj-C dictionary literals

This fixes: https://llvm.org/PR22647

Patch by Kent Sutherland. Thank you.

llvm-svn: 250010
2015-10-12 03:19:07 +00:00
Daniel Jasper 8d0e223498 clang-format: [JS] handle character classes in regexes.
Slashes in regular expressions do not need to be escaped and do not
terminate the regular expression even without a preceding backslash.

Patch by Martin Probst. Thank you.

llvm-svn: 250009
2015-10-12 03:13:48 +00:00
Saleem Abdulrasool d79eec97fc bindings: add new C++ function attribute accessors
Add methods to index Cursor to see if a cxx method is pure_virtual,
virtual or const methods.

Patch by Jonathan B Coe!

llvm-svn: 250008
2015-10-12 03:10:20 +00:00
George Burgess IV 78ed9b43fd Fix warning caused by r249995
llvm-svn: 249997
2015-10-11 20:37:14 +00:00
George Burgess IV 4546181e12 [Sema] Allow C conversions in C overload logic
C allows for some implicit conversions that C++ does not, e.g. void* ->
char*. This patch teaches clang that these conversions are okay when
dealing with overloads in C.

Differential Revision: http://reviews.llvm.org/D13604

llvm-svn: 249995
2015-10-11 20:13:20 +00:00
Olivier Goffart 122993bfd6 Keep the IfStmt node even if the condition is invalid
This is important to keep the information in IDE or other tools
even if the code contains a few errors

llvm-svn: 249982
2015-10-11 17:27:29 +00:00
NAKAMURA Takumi 6ae5084f90 [CMake] Always generate and install cmake config files on CMake>=3.0.
Currently, cmake config files are only generated and installed when CLANG_BUILD_STANDALONE set, which means config file will not be generated or installed when clang is built with llvm. This change removes that restriction.

Thanks to Don Hinton <hintonda@gmail.com>

http://reviews.llvm.org/D13453

llvm-svn: 249935
2015-10-10 02:37:30 +00:00
Nathan Wilson f89306b437 [Concepts] Fixing Concepts TS directory structure; NFC
llvm-svn: 249934
2015-10-10 02:17:39 +00:00
Douglas Gregor d4f2afa23c Fix inference of _Nullable for weak Objective-C properties.
The inference of _Nullable for weak Objective-C properties was broken
in several ways:

* It was back-patching the type information very late in the process
  of checking the attributes for an Objective-C property, which is
  just wrong.
* It was using ad hoc checks to try to suppress the warning about
  missing nullability specifiers (-Wnullability-completeness), which
  didn't actual work in all cases (rdar://problem/22985457)
* It was inferring _Nullable even outside of assumes-nonnull regions,
  which is wrong.

Putting the inference of _Nullable for weak Objective-C properties in
the same place as all of the other inference logic fixes all of these
ills.

llvm-svn: 249896
2015-10-09 20:36:17 +00:00
Eric Christopher c04cb4a123 Add a fixme to handleTargetFeatures.
The goal of wanting this to avoid munging the feature list is so
that it can be used for various targets as a way of both adding
and verifying the features that are going to be output into the
IR.

llvm-svn: 249894
2015-10-09 20:30:48 +00:00
Douglas Katzman 795f57fa7a [Myriad]: put libstdc++ and libc in the right order
llvm-svn: 249893
2015-10-09 20:26:20 +00:00
Eric Christopher b093d69062 Fix whitespace, 80-column violations, embedded tabs for the
TargetInfo class.

llvm-svn: 249872
2015-10-09 18:39:59 +00:00
Eric Christopher 8c47b427f9 constify the feature vector going into initFeatureMap as it shouldn't
change the set of features.

llvm-svn: 249871
2015-10-09 18:39:55 +00:00
Chris Bieneman 8c2abff17e [CMake] Fixing LTO library path passed into bootstrap builds.
This just fixes a small error in constructing the path to the LTO library.

llvm-svn: 249858
2015-10-09 17:45:44 +00:00
Duncan P. N. Exon Smith 14c71c6644 Analysis: Make CFG::graph_iterator dereference to non-const
Since the original commit in r145858, we've had `CFG::graph_iterator`
and `CFG::const_graph_iterator`, and both have derefenced to a
`const`-ified `value_type`.  The former has an implicit conversion to
non-`const`, which is how this worked at all until r249782 started using
the dereference operator (partially reverted in r249783).

This fixes the non-const iterator to be non-const (sometimes
const-iterators are intentional, but with a separate const-ified class
(and a non-const implicit conversion leak) that's not likely to be the
case here).

llvm-svn: 249849
2015-10-09 16:50:55 +00:00
Reid Kleckner 04ab116e41 Fix VFS GCC unittest on Windows
llvm-svn: 249846
2015-10-09 16:48:52 +00:00
Aaron Ballman 6269236a8e Amending r249721 to properly handle pathological attribute-related names like __ and ____.
Patch by Adrian Zgorzalek!

llvm-svn: 249833
2015-10-09 13:53:24 +00:00
Benjamin Kramer 49692eda7e [VFS] Rename RedirectingFS internals to avoid collisions with public clang classes
Hopefully fixes the MSVC build. NFC intended.

llvm-svn: 249832
2015-10-09 13:28:13 +00:00
Benjamin Kramer 407eb79fbf [VFS] Wire up driver VFS through tooling.
Sadly I don't currently have a way to tests this as the driver is always
initialized with the default triple and finding system headers is system
specific.

llvm-svn: 249831
2015-10-09 13:03:25 +00:00
Benjamin Kramer decb2aeab3 [VFS] Just normalize away .. and . in paths for in-memory file systems.
This simplifies the code and gets us support for .. for free.

llvm-svn: 249830
2015-10-09 13:03:22 +00:00
Benjamin Kramer c5862f08de [VFS] Wire up multilib toolchain code to the VFS.
This lets a VFSified driver actually validate the GCC paths.

llvm-svn: 249829
2015-10-09 13:03:18 +00:00
Benjamin Kramer c4cb3b10dc [VFS] Port tooling to use the in-memory file system.
This means file remappings can now be managed by ClangTool (or a
ToolInvocation user) instead of by ToolInvocation itself. The
ToolInvocation remapping is still in place so users can migrate.

Differential Revision: http://reviews.llvm.org/D13474

llvm-svn: 249815
2015-10-09 09:54:37 +00:00
Vedant Kumar 55c214484c [Sema] Add "Ty" suffix to QualType variables for clarity (NFC)
llvm-svn: 249801
2015-10-09 01:47:26 +00:00
Eric Christopher b1abfed324 Fix a few typos in the required feature set for some of the x86
builtins:

avx512vd -> avx512vl
rdrand -> rdrnd
avx512ff -> avx512f

no functional change.

llvm-svn: 249790
2015-10-09 00:35:30 +00:00
Eric Fiselier 18677d51e0 Skip NonNull sema checks in unevaluated contexts.
Summary:
Currently when a function annotated with __attribute__((nonnull)) is called in an unevaluated context with a null argument a -Wnonnull warning is emitted. 
This warning seems like a false positive unless the call expression is potentially evaluated. Change this behavior so that the non-null warnings use DiagRuntimeBehavior so they wont emit when they won't be evaluated.

Reviewers: majnemer, rsmith

Subscribers: mclow.lists, cfe-commits

Differential Revision: http://reviews.llvm.org/D13408

llvm-svn: 249787
2015-10-09 00:17:57 +00:00
Hans Wennborg 1f53eb6fbd Expose -f[no]ms-{compatibility,extensions} in clang-cl (PR25114)
These are enabled by default in clang-cl, because the whole idea is that
it should work like cl.exe, but I suppose it can make sense to disable
them if someone wants to compile code in a more strict mode.

llvm-svn: 249775
2015-10-08 23:13:28 +00:00
Evgeniy Stepanov 14deb7b65f Use Triple.isAndroid() where possible.
llvm-svn: 249751
2015-10-08 21:21:44 +00:00
Reid Kleckner 5539152404 [WinEH] Push cleanupendpad scopes around exceptional cleanups
We were only doing this for SEH as a special case. Generalize it to all
cleanups.

llvm-svn: 249748
2015-10-08 21:14:56 +00:00
Akira Hatanaka aec6b2c20e [CodeGen] [CodeGen] Attach function attributes to functions created in
CGBlocks.cpp.

This commit fixes a bug in clang's code-gen where it creates the
following functions but doesn't attach function attributes to them:

__copy_helper_block_
__destroy_helper_block_
__Block_byref_object_copy_
__Block_byref_object_dispose_

rdar://problem/20828324

Differential Revision: http://reviews.llvm.org/D13525

llvm-svn: 249735
2015-10-08 20:26:34 +00:00
Eric Christopher a7260af7e5 Handle sse turning on mmx, but no -mmx not turning off SSE.
Rationale :

// sse3
__m128d test_mm_addsub_pd(__m128d A, __m128d B) {
  return _mm_addsub_pd(A, B);
}

// mmx
void shift(__m64 a, __m64 b, int c) {
  _mm_slli_pi16(a, c);
  _mm_slli_pi32(a, c);
  _mm_slli_si64(a, c);
  _mm_srli_pi16(a, c);
  _mm_srli_pi32(a, c);
  _mm_srli_si64(a, c);
  _mm_srai_pi16(a, c);
  _mm_srai_pi32(a, c);
}

clang -msse3 -mno-mmx file.c -c

For this code we should be able to explicitly turn off MMX
without affecting the compilation of the SSE3 function and then
diagnose and error on compiling the MMX function.

This is a preparatory patch to the actual diagnosis code which is
coming in a future patch. This sets us up to have the correct information
where we need it and verifies that it's being emitted for the backend
to handle.

llvm-svn: 249733
2015-10-08 20:10:18 +00:00
Eric Christopher bbd746db9e Migrate most feature map inclusion to initFeatureMap for the x86 target so
that we can build up an accurate set of features rather than relying on
TargetInfo initialization via handleTargetFeatures to munge the list
of features.

llvm-svn: 249732
2015-10-08 20:10:14 +00:00
Akira Hatanaka 200500d6d3 [CodeGen] Check if the Decl pointer passed is null, and if so, return
early.

This is needed in a patch I plan to commit later, in which a null Decl
pointer is passed to SetLLVMFunctionAttributesForDefinition.

Relevant discussion is in http://reviews.llvm.org/D13525.

llvm-svn: 249722
2015-10-08 19:30:57 +00:00
Aaron Ballman 8b5e7baab2 When mapping no_sanitize_* attributes to no_sanitize attributes, handle GNU-style formatting that involves prefix and suffix underscores. Cleans up other usages of similar functionality.
Patch by Adrian Zgorzalek!

llvm-svn: 249721
2015-10-08 19:24:08 +00:00
Reid Kleckner b6776e0d07 [clang-cl] Make /EHs turn on C++ EH once again
C++ exceptions are still off by default, which is similar to how C++
cleanups are off by default in MSVC.

If you use clang instead of clang-cl, exceptions are also still off by
default. In the future, when C++ EH is proven to be stable, we may flip
the default for that driver to be consistent with other platforms.

llvm-svn: 249704
2015-10-08 17:29:07 +00:00
Renato Golin e84b000ccb Simplify DefaultCPU in ARMTargetInfo
Simplifying the convoluted CPU handling in ARMTargetInfo.

The default base CPU on ARM is ARM7TDMI, arch ARMv4T, and
ARMTargetInfo had a different one. This wasn't visible from
Clang because the driver selects the defaults and sets the
Arch/CPU features directly, but the constructor depended
on the CPU, which was never used.

This patch corrects the mistake and greatly simplifies
how CPU is dealt with (essentially by removing the duplicated
DefaultCPU field).

Tests updated.

llvm-svn: 249699
2015-10-08 16:43:26 +00:00
NAKAMURA Takumi 811a09ec5b CGStmtOpenMP.cpp: Prune redundant \param. [-Wdocumentation]
llvm-svn: 249698
2015-10-08 16:41:42 +00:00
Benjamin Kramer 46d311da19 [VFS] Use VFS instead of virtual files in PPCallbacks test.
llvm-svn: 249693
2015-10-08 14:20:14 +00:00
Douglas Katzman 989157a3ad [Myriad]: default the Dwarf version to 2
llvm-svn: 249692
2015-10-08 14:18:02 +00:00
Benjamin Kramer 32bd3c8cff [Driver] Use Twine instead of itostr. NFC.
No need to construct temporary std::strings here.

llvm-svn: 249676
2015-10-08 10:31:17 +00:00
David Majnemer dc9be216c0 [MSVC Compat] Try to treat an implicit, fixed enum as an unfixed enum
consider the following:
enum E *p;
enum E { e };

The above snippet is not ANSI C because 'enum E' has not bee defined
when we are processing the declaration of 'p'; however, it is a popular
extension to make the above work.  This would fail using the Microsoft
enum semantics because the definition of 'E' would implicitly have a
fixed underlying type of 'int' which would trigger diagnostic messages
about a mismatch between the declaration and the definition.

Instead, treat fixed underlying types as not fixed for the purposes of
the diagnostic.

llvm-svn: 249674
2015-10-08 10:04:46 +00:00
Alexey Bataev f24e7b1f60 [OPENMP 4.1] Codegen for array sections/subscripts in 'reduction' clause.
OpenMP 4.1 adds support for array sections/subscripts in 'reduction' clause. Patch adds codegen for this feature.

llvm-svn: 249672
2015-10-08 09:10:53 +00:00
David Majnemer 475f9eabc2 Update a few more tests in response to the MS ABI enum semantics
Our self hosting buildbots found a few more tests which weren't updated
to reflect that the enum semantics are part of the Microsoft ABI.

llvm-svn: 249670
2015-10-08 08:28:09 +00:00
David Majnemer e4e3e6a5bf [Sema] Tweak incomplete enum types on MSVC ABI targets
Enums without an explicit, fixed, underlying type are implicitly given a
fixed 'int' type for ABI compatibility with MSVC.  However, we can
enforce the standard-mandated rules on these types as-if we didn't know
this fact if the tag is not part of a definition.

llvm-svn: 249667
2015-10-08 07:45:35 +00:00
David Majnemer c10b8381f7 Update tests touched by r249656
These test updates almost exclusively around the change in behavior
around enum: enums without a definition are considered incomplete except
when targeting MSVC ABIs.  Since these tests are interested in the
'incomplete-enum' behavior, restrict them to %itanium_abi_triple.

llvm-svn: 249660
2015-10-08 06:31:22 +00:00
Douglas Katzman 060f5b4836 Use itostr(), not std::to_string() because of Android.
llvm-svn: 249658
2015-10-08 05:25:03 +00:00
Douglas Katzman 6d6a942022 Unbreak 'debug-options' test when builder is Darwin
llvm-svn: 249657
2015-10-08 05:02:24 +00:00
David Majnemer 3f02150d31 [MSVC Compat] Enable ABI impacting non-conforming behavior independently of -fms-compatibility
No ABI for C++ currently makes it possible to implement the standard
100% perfectly.  We wrongly hid some of our compatible behavior behind
-fms-compatibility instead of tying it to the compiler ABI.

llvm-svn: 249656
2015-10-08 04:53:31 +00:00
Douglas Katzman 3459ce2e5e Stop messing with the 'g' group of options in CompilerInvocation.
With this change, most 'g' options are rejected by CompilerInvocation.
They remain only as Driver options. The new way to request debug info
from cc1 is with "-debug-info-kind={line-tables-only|limited|standalone}"
and "-dwarf-version={2|3|4}". In the absence of a command-line option
to specify Dwarf version, the Toolchain decides it, rather than placing
Toolchain-specific logic in CompilerInvocation.

Also fix a bug in the Windows compatibility argument parsing
in which the "rightmost argument wins" principle failed.

Differential Revision: http://reviews.llvm.org/D13221

llvm-svn: 249655
2015-10-08 04:24:12 +00:00
Craig Topper 416421c9b4 Fix a -Wdeclaration-after-statement warning.
llvm-svn: 249652
2015-10-08 03:37:36 +00:00
Reid Kleckner 129552b375 [WinEH] Remove NewMSEH and enable its behavior by default
Testing has shown that it is at least as reliable as the old landingpad
pattern matching code.

llvm-svn: 249647
2015-10-08 01:13:52 +00:00
Richard Smith e87aeb378d When pretty-printing a C++11 literal operator, don't insert whitespace between
the "" and the suffix; that breaks names such as 'operator""if'. For symmetry,
also remove the space between the 'operator' and the '""'.

llvm-svn: 249641
2015-10-08 00:17:59 +00:00
Reid Kleckner 7c2f9e80f7 Don't emit exceptional stackrestore cleanups around inalloca functions
The backend restores the stack pointer after recovering from an
exception.  This is similar to r245879, but it doesn't try to use the
normal cleanup mechanism, so hopefully it won't cause the same breakage.

llvm-svn: 249640
2015-10-08 00:17:45 +00:00
Ehsan Akhgari f8d44de143 Make clang_Cursor_getMangling not mangle if the declaration isn't mangled
Right now clang_Cursor_getMangling will attempt to mangle any
declaration, even if the declaration isn't mangled (extern C).  This
results in a partially mangled name which isn't useful for much. This
patch makes clang_Cursor_getMangling return an empty string if the
declaration isn't mangled.

Patch by Michael Wu <mwu@mozilla.com>.

llvm-svn: 249639
2015-10-08 00:01:20 +00:00
Reid Kleckner 1f88e93973 [WinEH] Don't use lifetime markers for MS catch parameters
We don't have a good place to put them. Our previous spot was causing us
to optimize loads from the exception object to undef, because it was
after the catchpad instruction that models the write to the catch
object.

llvm-svn: 249616
2015-10-07 21:03:41 +00:00
Benjamin Kramer 7a22fc238f Fix a shared CMake build by linking with libclangBasic.
Patch by Jan Vesely!

llvm-svn: 249608
2015-10-07 20:19:25 +00:00
Daniel Jasper d1ac50ecaa ASTMatchers: Keep AllCallbacks in a set instead of a vector
AllCallbacks is currently only used to call onStartOfTranslationUnit and
onEndOfTranslationUnit on them. In this (and any other scenario I can
come up with), it is important (or at least better) not to have
duplicates in this container. E.g. currently onEndOfTranslationUnit is
called repeatedly on the same callback for every matcher that is
registered with it.

llvm-svn: 249598
2015-10-07 19:56:12 +00:00