Commit Graph

58545 Commits

Author SHA1 Message Date
David Majnemer 8d44ac4785 [ItaniumMangle] Fix a typo.
llvm-svn: 238002
2015-05-22 05:54:24 +00:00
David Majnemer ab6607ab09 [Sema] Don't crash on out-of-line virtual constexpr functions
The method wasn't an overrider but didn't have 'virtual' textually
written because our CXXMethodDecl was an out-of-line definition.  Make
sure we use the canonical decl instead.

This fixes PR23629.

llvm-svn: 237999
2015-05-22 05:49:41 +00:00
Faisal Vali 2933621203 Apply existing checks to C++1Z (has_feature_cxx0x); NFC
This applies the existing checks in has_feature_cxx0x to -std=c++1z.
In addition, references to C++1y are updated to refer to C++14

No functional change. Testing of __has_feature for C++1z features
is not added in this change.

Patch by Hubert Tong! 

llvm-svn: 237992
2015-05-22 02:57:28 +00:00
Ahmed Bougacha b55d416ef1 [OpenMP] Test AVX default SIMD alignment. NFC.
llvm-svn: 237991
2015-05-22 02:51:49 +00:00
Ahmed Bougacha 1fca2edc48 [CodeGen] Use TargetInfo::getABI() throughout X86*TargetCodeGenInfo.
We already have the ABI, we don't need a "HasAVX" flag.
This will also makes it easier to add an AVX512 ABI.

No functional change intended.

llvm-svn: 237989
2015-05-22 02:25:58 +00:00
Richard Smith a7bd4582e7 Fix assertion when assigning to object in OpenCL constant address space.
Patch by John Garvin!

llvm-svn: 237983
2015-05-22 01:14:39 +00:00
Faisal Vali 24d59d14ba "This adds -fconcepts-ts as a cc1 option for enabling the
in-progress implementation of the Concepts TS. The recommended feature
test macro __cpp_experimental_concepts is set to 1 (as opposed to
201501) to indicate that the feature is enabled, but the
implementation is incomplete.

The link to the Concepts TS in cxx_status is updated to refer to the
PDTS (N4377). Additional changes related to __has_feature and
__has_extension are to follow in a later change.

Relevant tests include:

test/Lexer/cxx-features.cpp

The test file is updated with testing of the C++14 + Concepts TS mode.
The expected behaviour is the same as that of the C++14 modes except
for the case of __cpp_experimental_concepts."

- Hubert Tong.

Being committed for Hubert (as per his understanding with Richard Smith) as we start work on the concepts-ts following our preliminary strategy session earlier today. 

The patch is tiny and seems quite standard.

Thanks Hubert!

llvm-svn: 237982
2015-05-22 01:11:10 +00:00
Adrian Prantl be81cf570e Debug info: Adapt to new DIBuilder interface.
llvm-svn: 237948
2015-05-21 20:37:26 +00:00
Douglas Gregor 3c523c4a37 Itanium mangler: don't trip an assertion when unresolved members have implicit bases.
When we find a member of the current instantation, the base of the
unresolved member expression is implicit; use nullptr for such
bases. This is not a change in behavior: the AST already contains null
in such cases, so non-asserts builds do the right thing already. Fixes
rdar://problem/21020559.

llvm-svn: 237929
2015-05-21 18:28:18 +00:00
Manuel Klimek 79e06081a3 clang-format: [JS] Better support for fat arrows.
Assigns a token type (TT_JsFatArrow) to => tokens, and uses that to
more easily recognize and format fat arrow functions.
Improves function parsing to better recognize formal parameter
lists and return type declarations.
Recognizes arrow functions and parse function bodies as child blocks.

Patch by Martin Probst.

llvm-svn: 237895
2015-05-21 12:23:34 +00:00
John Brawn 94fd963315 [ARM] Restructure cpu handling in the driver to mostly use the triple
Using the target cpu to determine some behaviour is sprinkled in
several places in the driver, but in almost all the information that
is needed can be found in the triple. Restructure things so that the
triple is used, and the cpu is only used if the exact cpu name is
needed.

Also add a check that the -mcpu argument is valid, and correct the
-march argument checking so that it handles -march=native correctly. I
would have liked to move these checks into the computation of the
triple, but the triple is calculated several times in several places
and that would lead to multiple error messages for the same thing.

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

llvm-svn: 237894
2015-05-21 12:19:49 +00:00
Alexey Bataev 5129d3a4f5 [OPENMP] Fixed codegen for parameters privatization.
For parameters we shall take a derived type of parameters, not the original one.

llvm-svn: 237882
2015-05-21 09:47:46 +00:00
Alexey Bataev 7a228ff439 [OPENMP] Fixed codegen for lastprivate LCV in worksharing constructs.
If loop control variable in a worksharing construct is marked as lastprivate, we should copy last calculated value of private counter back to original variable.

llvm-svn: 237879
2015-05-21 07:59:51 +00:00
Richard Smith e520293c8b Avoid using a C++11 library feature not present in libstdc++4.7.
llvm-svn: 237872
2015-05-21 01:26:53 +00:00
Richard Smith 04765ae01e [modules] If we re-enter a submodule from within itself (when submodule
visibility is enabled) or leave and re-enter it, restore the macro and module
visibility state from last time we were in that submodule.

This allows mutually-#including header files to stand a chance at being
modularized with local visibility enabled.

llvm-svn: 237871
2015-05-21 01:20:10 +00:00
Alexey Samsonov de0aff3e91 [Driver] Improve unused-argument diagnostic for extra sanitizer features.
Don't print unused-argument warning for sanitizer-specific feature flag
if this sanitizer was eanbled, and later disabled in the command line.
For example, now:
  clang -fsanitize=address -fsanitize-coverage=bb -fno-sanitize=address a.cc
doesn't print warning, but
  clang -fsanitize-coverage=bb
does. Same holds for -fsanitize-address-field-padding= and
-fsanitize-memory-track-origins= flags.

Fixes PR23604.

llvm-svn: 237870
2015-05-21 01:07:52 +00:00
Reid Kleckner 012665e16b Rename a helper template function to 'bytes' to avoid a C++17 STL conflict
MSVC 2015 includes the std::data() template function added to C++17. ADL
causes both cl.exe and clang-cl to prefer std::data over our static
helper here, and we get errors about converting int64_t* to StringRef.
Renaming it to bytes avoids the ambiguity.

llvm-svn: 237863
2015-05-21 00:13:09 +00:00
Reid Kleckner b4a26ed58e Work around overloading bug in MSVC 2015
MSVC 2015 appears to be unable to find the correct operator== here. I
haven't yet filed a bug with Microsoft as I've been unable to create a
reduced test case.

llvm-svn: 237862
2015-05-21 00:12:53 +00:00
Richard Trieu cbab79a4f8 Check for bool-like conversion in conditional expressions.
Add a check for bool-like conversions for the condition expression of
conditional operators.  This is similiar to the checking of condition
expressions of if statements, for-loops, while-loops, and do-while loops.
Specificially, this is to fix the problem of assert("message") not triggering
-Wstring-conversion when the assert macro uses a conditional operator.

llvm-svn: 237856
2015-05-20 23:29:18 +00:00
Richard Smith 31d1de2229 [OpenMP] Make default OpenMP library (the one selected with just -fopenmp)
configurable in the CMake build. There shouldn't be any change in default
behavior.

Derived from a patch by Daniel Jasper!

llvm-svn: 237850
2015-05-20 22:48:44 +00:00
Reid Kleckner 892bb0cace Evaluate union cast subexpressions when the cast value is unused
Fixes PR23597.

llvm-svn: 237839
2015-05-20 21:59:25 +00:00
Aaron Ballman 068aa51dae Refactored some common functionality into MaybeParseMicrosoftDeclSpecs; NFC.
llvm-svn: 237835
2015-05-20 20:58:33 +00:00
Ahmed Bougacha 71185aca7e [CodeGen] Check x86_64-arguments.c tests on AVX as well. NFC.
We used to only check the differing tests on AVX, but we might
as well check all of them.

llvm-svn: 237818
2015-05-20 18:39:16 +00:00
Richard Smith fd8b64eea0 [modules] Support merging a parsed default argument with an imported hidden one for non-type and template template parameters too.
llvm-svn: 237815
2015-05-20 18:24:21 +00:00
Richard Smith c7d48d1a16 [modules] Support merging a parsed default function/template argument with an imported but hidden one.
llvm-svn: 237814
2015-05-20 17:50:35 +00:00
Pete Cooper 2f1637ad85 Use Intrinsic::ID instead of unsigned. NFC.
This is after LLVM r237810 which made Function::getIntrinsicID() return an Intrinsic::ID.

llvm-svn: 237811
2015-05-20 17:17:45 +00:00
Justin Bogner 98ceec5725 InstrProf: Change this triple back to %itanium_abi_triple
In my rush to fix the linux bots in r237805, I accidentally committed
a change to the triple. Revert that part.

llvm-svn: 237806
2015-05-20 16:25:35 +00:00
Justin Bogner c49e5aadb9 InstrProf: Remove darwin-specific section names from this test
llvm-svn: 237805
2015-05-20 16:21:26 +00:00
Justin Bogner fb29822bf4 InstrProf: Increment the profile counter for all types of destructor
-fprofile-instr-generate does not emit counter increment intrinsics
for Dtor_Deleting and Dtor_Complete destructors with assigned
counters. This causes unnecessary [-Wprofile-instr-out-of-date]
warnings during profile-use runs even if the source has never been
modified since profile collection.

Patch by Betul Buyukkurt. Thanks!

llvm-svn: 237804
2015-05-20 16:16:23 +00:00
Justin Bogner 1cd11f159e CodeGen: Remove some trailing whitespace. NFC
llvm-svn: 237802
2015-05-20 15:53:59 +00:00
Alexey Bataev d7589ffe1d [OPENMP] Fix codegen for ordered loop directives.
loops with ordered clause must be generated the same way as dynamic loops, but with static scheduleing.

llvm-svn: 237788
2015-05-20 13:12:48 +00:00
Alexey Bataev 15413ea02b [MSVC] Handle out-of-line definition of static data member correctly (fix for http://llvm.org/PR21164), by Alexey Frolov
There are 3 cases of defining static const member:

initialized inside the class, not defined outside the class.
initialized inside the class, defined outside the class.
not initialized inside the class, defined outside the class.
Revision r213304 was supposed to fix the linkage problem of case (1), but mistakenly it made case (2) behave the same.
As a result, out-of-line definition of static data member is not handled correctly.
Proposed patch distinguishes between cases (1) and (2) and allows to properly emit static const members under –fms-compatibility option.

This fixes http://llvm.org/PR21164.
Differential Revision: http://reviews.llvm.org/D9850

llvm-svn: 237787
2015-05-20 11:57:02 +00:00
Manuel Klimek 9eff8b1426 Allow skipping imports in the module visitor.
Skip imports when we know that we do not need to visit any imports
because we've already deserialized the redecls from a module.

llvm-svn: 237782
2015-05-20 10:29:23 +00:00
Michael Kuperstein 7619004211 [X86] Add _mm256_set_m128 and its 5 variants.
Differential Revision: http://reviews.llvm.org/D9855

llvm-svn: 237778
2015-05-20 07:46:52 +00:00
Yaron Keren 627ba89bb1 Fix CGRecordLayouts description to say it maps clang types not llvm types
and de-duplicate data fields names from comments according to the coding
standard.

llvm-svn: 237776
2015-05-20 07:15:28 +00:00
David Majnemer e95f3bd0fd [clang-cl] Map /GA to -ftls-model=local-exec
The /GA switch informs the compiler that it may assume that all TLS
access refers to the executable's index: 0.

llvm-svn: 237771
2015-05-20 04:39:56 +00:00
Alexey Bataev db39021cee [OPENMP] -fopenmp enables OpenMP support (fix for http://llvm.org/PR23492)
-fopenmp turns on OpenMP support and links libiomp5 as OpenMP library. Also there is -fopenmp={libiomp5|libgomp} option that allows to override effect of -fopenmp and link libgomp library (if -fopenmp=libgomp is specified).
Differential Revision: http://reviews.llvm.org/D9736

llvm-svn: 237769
2015-05-20 04:24:19 +00:00
Alexey Bataev 16dc7b68c4 Fix for aggregate copying of variable length arrays.
Patch fixes codegen for aggregate copying of VLAs. Currently method CodeGenFunction::EmitAggregateCopy() does not support copying of VLAs. Patch checks if the size of the type is 0, then checks if the type is actually a variable-length array. Then it calculates total length for this array and calculates total size of the array in bytes:

<total number of elements in array> * aligned_sizeof(ElementType) (if copy assignment is requested).
If simple copying is requested, size is calculated like:

<total number of elements in array> * aligned_sizeof(ElementType) - aligned_sizeof(ElementType) + sizeof(ElementType).
memcpy() is used with this calculated size of the VLA.
Differential Revision: http://reviews.llvm.org/D9851

llvm-svn: 237768
2015-05-20 03:46:04 +00:00
David Blaikie bf178d3eb7 [opaque pointer type] Pass the explicit call type when creating calls from LazyRuntimeFunctions
The implicit conversion was causing issues for a helper being added that
would take an llvm::Function rather than an llvm::Value to make the
CallInst. Since we'll eventually need to specify the type of the call
explicitly anyway, fix these up to avoid the future ambiguity.

llvm-svn: 237729
2015-05-19 21:31:34 +00:00
Richard Smith 54ef4c3bb3 Revert r237609 for now.
glibc's headers use __need_* macros to selectively export parts of themselves
to each other. This requires us to enter those files repeatedly when building
a glibc module.

This can be unreverted once we have a better mechanism to deal with that
non-modular aspect of glibc (possibly some way to mark a header as "textual if
this macro is defined").

llvm-svn: 237718
2015-05-19 19:58:11 +00:00
Jonathan Roelofs 99bdd98a2b Fix 'CFG graph' typo. NFC
Patch by Jon Eyolfson!

llvm-svn: 237713
2015-05-19 18:51:56 +00:00
Anders Waldenborg b09075a240 clang-format: Add space in function pointers with SpaceBeforeParens=Always
"void (*my_function)(void)" should become "void (*my_function) (void)" when
SpaceBeforeParens is set to 'Always'

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

llvm-svn: 237704
2015-05-19 16:54:26 +00:00
Michael Kuperstein 877f3cbe84 [X86] Add _mm_broadcastsd_pd intrinsic
_mm_broadcastsd_pd is basically an alias for _mm_movedup_pd, however the alias is only available from AVX2 forward.

llvm-svn: 237698
2015-05-19 14:49:14 +00:00
Michael Kuperstein 6168183e04 [X86] Added _mm256_bslli_epi128 and _mm256_bsrli_epi128.
These two intrinsics are alternative names for _mm256_slli_si256 and _mm256_srli_si256, respectively.

llvm-svn: 237693
2015-05-19 13:05:46 +00:00
Alexey Bataev 1d9c15cf18 [OPENMP] Fixed codegen for copying/initialization of array variables/parameters.
This modification generates proper copyin/initialization sequences for array variables/parameters. Before they were considered as pointers, not arrays.

llvm-svn: 237691
2015-05-19 12:31:28 +00:00
Daniel Jasper 9310166a63 clang-format: Improve *-detection.
Before:
  S << a *(10);

After:
  S << a * (10);

This fixes llvm.org/PR16500.

llvm-svn: 237690
2015-05-19 12:29:27 +00:00
Daniel Jasper d6e09e85f9 clang-format: Improve for-loop formatting.
Before:
  for (SmallVectorImpl<TemplateIdAnnotationn *>::iterator I =
           Container.begin(),
                                                          E = Container.end();
       I != E; ++I)

After:
  for (SmallVectorImpl<TemplateIdAnnotationn *>::iterator
           I = Container.begin(),
           E = Container.end();
       I != E; ++I)

This fixes llvm.org/PR23544.

llvm-svn: 237688
2015-05-19 11:51:39 +00:00
Daniel Jasper fa3f8fbed8 clang-format: Support #include_next
Before:
  #include_next < test.h >

After:
  #include_next <test.h>

This fixes llvm.org/PR23500

llvm-svn: 237686
2015-05-19 11:22:29 +00:00
Daniel Jasper f5e5ee6d69 clang-format: Correctly detect casts to qualified types.
Before:
  ns::E f() { return (ns::E) - 1; }

After:
  ns::E f() { return (ns::E)-1; }

This fixes llvm.org/PR23503.

llvm-svn: 237684
2015-05-19 11:18:39 +00:00
Daniel Jasper ed41f774fc clang-format: Fix regression caused by r237244.
Before:
  [call aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.
          aaaaaaaa];

After:
  [call aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa
          .aaaaaaaa];

This merely papers over the fact that we aren't parsing ObjC method calls
correctly. Also, the indentation is weird.

llvm-svn: 237681
2015-05-19 11:06:33 +00:00
Alexey Bataev ccb59ec9b5 [OPENMP] Prohibit VLAs in 'private/firstprivate' clauses of 'task' directive.
Currently runtime does not allow to support variably modified types for 'private' and 'firstprivate' clauses in 'task' directives.

llvm-svn: 237674
2015-05-19 08:44:56 +00:00
Alexey Bataev 7a3e5853df [OPENMP] Prohibit variably modified types in 'copyprivate' clause.
Runtime does not allow to work with VLAs in copyprivate clause.

llvm-svn: 237672
2015-05-19 08:19:24 +00:00
Alexey Bataev f120c0d6f2 [OPENMP] Fixed analysis of function arguments and their data sharing attributes.
Added proper analysis for types of function arguments.

llvm-svn: 237670
2015-05-19 07:46:42 +00:00
NAKAMURA Takumi 4bd67d8f46 SemaExprCXX.cpp: Try to fix \param in r237608. [-Wdocumentation]
llvm-svn: 237668
2015-05-19 06:47:23 +00:00
Richard Smith 86dec39c0a PR20073: promote "dereference of 'void*'" from Extension to ExtWarn.
llvm-svn: 237652
2015-05-19 01:41:12 +00:00
David Majnemer fa7bc78e0a [AST] Put VarDeclBitfields on a diet
VarDeclBitfields contained bits which are never present in parameters.
Split these out so that ParmVarDeclBitfields wouldn't grow past 32-bits
if another field was added.

llvm-svn: 237648
2015-05-19 00:57:16 +00:00
Richard Smith 82e57fb1e8 [modules] Support for merging a parsed definition of a static data member of a class template into an imported but hidden definition.
llvm-svn: 237647
2015-05-19 00:49:29 +00:00
David Blaikie 7d9e79249d Fix indentation
llvm-svn: 237631
2015-05-18 22:51:39 +00:00
Reid Kleckner ac385068f9 Revert changes to DefaultABIInfo accidentally introduced in r208733
Also add trivial handling of transparent unions.

PPC32, MSP430, and XCore apparently all rely on DefaultABIInfo. This
should worry you, because DefaultABIInfo is not implementing the rules
of any particular ABI.

Fixes PR23097, patch by Andy Gibbs.

llvm-svn: 237630
2015-05-18 22:46:30 +00:00
David Blaikie 43f9bb7371 API update for streamlining of IRBuilder::CreateCall to just use ArrayRef/initializer_list+braced init
llvm-svn: 237625
2015-05-18 22:14:03 +00:00
Ismail Pazarbasi 8904d6bb17 Added missing 'override' to `ReadMismatchingDeleteExpressions`
llvm-svn: 237613
2015-05-18 20:46:12 +00:00
Richard Smith c7e6ff02d5 [modules] Support for merging a parsed class template specialization definition into an imported but hidden definition.
llvm-svn: 237612
2015-05-18 20:36:47 +00:00
Richard Trieu db36469554 Create new diagnostic group -Wmove
-Wmove includes the three existing warnings for std::move calls, self move,
reduntant move, and pessimizing move.  -Wmove is included in -Wmost, so that
it can be discoverable to people using that or -Wall.

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

llvm-svn: 237610
2015-05-18 20:25:44 +00:00
Richard Smith 2d4a11fba6 [modules] When a file is listed as a non-textual header in a module map, don't
enter it more than once, even if it doesn't have #include guards -- we already
know that it is intended to have the same effect every time it's included, and
it's already had that effect. This particularly helps with local submodule
visibility builds, where the include guard macro may not be visible in the
includer, but will become visible the moment we enter the included file.

llvm-svn: 237609
2015-05-18 20:02:41 +00:00
Ismail Pazarbasi e5768d1717 Detect uses of mismatching forms of 'new' and 'delete'
Emit warning when operand to `delete` is allocated with `new[]` or
operand to `delete[]` is allocated with `new`.

rev 2 update:
`getNewExprFromInitListOrExpr` should return `dyn_cast_or_null`
instead of `dyn_cast`, since `E` might be null.

Reviewers: rtrieu, jordan_rose, rsmith

Subscribers: majnemer, cfe-commits

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

llvm-svn: 237608
2015-05-18 19:59:11 +00:00
Richard Trieu 1d4911bc99 Have -Wredundant-move ignore reference types.
Don't give a warning when the type being moved is a reference type.  Also
uncomment two lines in the test case.

llvm-svn: 237607
2015-05-18 19:54:08 +00:00
Daniel Jasper 3c883d1dcc clang-format: Fix another regression caused by r237565.
Before:
  class C : test {
    class D : test{void f(){int i{2};
  }
  }
  ;
  }
  ;

After:
  class C : test {
    class D : test {
      void f() { int i{2}; }
    };
  };

llvm-svn: 237569
2015-05-18 14:49:19 +00:00
Daniel Jasper cec9ffd2a2 clang-format: Fix regression introduced by r237565.
Before:
  class C : public D {
    SomeClass SC { 2 };
  };

After:
  class C : public D {
    SomeClass SC{2};
  };

llvm-svn: 237568
2015-05-18 14:12:24 +00:00
Daniel Jasper 47bbda0939 clang-format: Improve detection of macros annotating functions.
Before:
  ASSERT("aaaaaaaaaaaaaaa")
      << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      << bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

After:
  ASSERT("aaaaaaaaaaaaaaa") << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                            << bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

Also cleanup implementation a bit and only mark closing parenthesis of
these annotations.

llvm-svn: 237567
2015-05-18 13:47:23 +00:00
Daniel Jasper adba2aadf2 clang-format: Allow braced initializers in template arguments of class
specializations.

Before:
  template <class T>
      struct S < std::is_arithmetic<T> {
  } > {};

After:
  template <class T> struct S<std::is_arithmetic<T>{}> {};

llvm-svn: 237565
2015-05-18 12:52:00 +00:00
Daniel Jasper f090f031bc clang-format: Support function annotations in macros.
Before:
  DEPRECATED("Use NewClass::NewFunction instead.") string
      OldFunction(const string &parameter) {}

After:
  DEPRECATED("Use NewClass::NewFunction instead.")
  string OldFunction(const string &parameter) {}

llvm-svn: 237562
2015-05-18 09:47:22 +00:00
Alexey Bataev 8fc69dcf42 [OPENMP] Fix for '#pragma omp task' codegen.
Internal task structure must be generated like
typedef struct kmp_task {
  void *              shareds;
  kmp_routine_entry_t routine;
  kmp_int32           part_id;
  kmp_routine_entry_t destructors;
} kmp_task_t;

struct kmp_task_t_with_privates {
  kmp_task_t task_data;
  .kmp_private. privates;
};
to avoid possible additional alignment bytes in first fields (shareds, routine, part_id and destructors). Runtime library is not aware of such kind additional alignment bytes.

llvm-svn: 237561
2015-05-18 07:54:53 +00:00
Richard Smith bca31b731b [modules] Move implicit creation of ImportDecls for #includes transformed into module imports from the frontend into Sema where it belongs.
llvm-svn: 237555
2015-05-18 05:35:52 +00:00
David Majnemer 8db9176d68 [clang-cl] Enable C++14 when targeting 2015 compatibility
llvm-svn: 237553
2015-05-18 04:49:30 +00:00
Richard Smith 63b6fcef96 [modules] Refactor and simplify #include handling.
Fix a tiny bug where we'd try to load a module file for the module we're in
the middle of building.

llvm-svn: 237552
2015-05-18 04:45:41 +00:00
NAKAMURA Takumi 74a0022fde clang/test/CodeGenOpenCL/opencl_types.cl: Tweak expressions according to r237548.
With MS mangler, the signature is:

  x86: define void @"\01?bad1@@$$J0YAXPAPAUocl_image1d@@PAPAUocl_image2d@@1@Z"  (%opencl.image1d_t** %b, %opencl.image2d_t** %c, %opencl.image2d_t** %d) nounwind
  x64: define void @"\01?bad1@@$$J0YAXPEAPAUocl_image1d@@PEAPAUocl_image2d@@1@Z"(%opencl.image1d_t** %b, %opencl.image2d_t** %c, %opencl.image2d_t** %d) nounwind

llvm-svn: 237551
2015-05-18 03:58:27 +00:00
Richard Smith a0aafa3853 [modules] If we see a #include that maps to a module, but use of precompiled modules is disabled, track submodule visibility anyway if -fmodules-local-submodule-visibility is enabled. This, in effect, gives modules semantics but without precompilation.
llvm-svn: 237550
2015-05-18 03:52:30 +00:00
Nico Weber effdb198c2 Wrap to 80 columns. No behavior change.
llvm-svn: 237549
2015-05-18 02:41:17 +00:00
David Majnemer 5a7cfea6b4 [MS ABI] Give __attribute__((overloadable)) functions pretty names
It turns out that there is a mangling for 'extern "C"', it's only used
by MSVC in /clr mode.  Co-opt this mangling so that extern "C" functions
marked overloadable get demangled nicely.

llvm-svn: 237548
2015-05-18 00:05:29 +00:00
David Majnemer ab4b4a1968 [MS ABI] Function encodings are always encoded in template arguments
llvm-svn: 237547
2015-05-18 00:05:25 +00:00
Nico Weber 5fb3a4277a Fix confusing indent. No behavior change.
llvm-svn: 237546
2015-05-18 00:00:29 +00:00
Daniel Jasper 0928553eec clang-format: Properly align ObjC string literals.
Before:
  NSString s = @"a"
               "b"
               "c";
  NSString s = @"a"
               @"b"
                @"c";

After:
  NSString s = @"a"
                "b"
                "c";
  NSString s = @"a"
               @"b"
               @"c";

This fixes llvm.org/PR23536.

llvm-svn: 237538
2015-05-17 08:13:23 +00:00
Daniel Jasper 2fd16632bc clang-format: Improve line wrapping around << operators.
Generally, clang-format tries to keep label-value pairs on a single
line for stream operators. However, we should not do that if there is
just a single such pair, as that doesn't help much.

Before:
  llvm::errs() << "aaaaaaaaaaaa: " << aaaaaaa(aaaaaaaaa,
                                              aaaaaaaaa);

After:
  llvm::errs() << "aaaaaaaaaaaa: "
               << aaaaaaa(aaaaaaaaa, aaaaaaaaa);

Also remove old test case that was testing actual behavior any more.

llvm-svn: 237535
2015-05-17 07:27:09 +00:00
Davide Italiano 24e89664cd [Sema] Improve llvm_unreachable() message.
llvm-svn: 237532
2015-05-17 02:27:10 +00:00
Nico Weber 28e0f243cf Don't leak TemplateIds when a plugin parses late-parsed templates at TU end.
In -fdelayed-template-parsing mode, templates that aren't used are not parsed
at all.  For some diagnostic plugins, this is a problem since they want to
analyse the contents of the template function body.  What has been suggested
on cfe-dev [1] is to explicitly parse interesting templates in
HandleTranslationUnit(); IWYU does this for example [2].

This is workable, but since the delayed parsing doesn't run below a call to
ParseTopLevelDecl(), no DestroyTemplateIdAnnotationsRAIIObj object is on the
stack to clean up TemplateIds that are created during parsing.  To fix this,
let ~Parser() clean them up in delayed template parsing mode instead of
leaking (or asserting in +Assert builds).

(r219810, relanded in r220400, fixed the same problem in incremental processing
mode; the review thread of r219810 has a good discussion of the problem.)

To test this, give the PrintFunctionNames plugin a flag to force parsing
of a template and add a test that uses it in -fdelayed-template-parsing mode.
Without the Parser.cpp change, that test asserts.

1: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-August/038415.html
2: https://code.google.com/p/include-what-you-use/source/detail?r=566 
llvm-svn: 237531
2015-05-17 01:07:16 +00:00
Nico Weber d73258a029 Wrap a few comments to 80 columns.
llvm-svn: 237529
2015-05-16 23:49:53 +00:00
Benjamin Kramer b4569fb51f [Sema] Fold array into for-range loop. No functional change intended.
llvm-svn: 237525
2015-05-16 16:16:31 +00:00
Richard Smith 2b63d15f49 [modules] Retain the name as written for umbrella headers and directories, rather than converting to an absolute path. No observable change expected, but this allows us to correctly compute the module for an umbrella header, which later changes will require.
llvm-svn: 237508
2015-05-16 02:28:53 +00:00
Richard Trieu d3967635bc Fix typo from r237482. "to reference of type" --> "to reference to type"
llvm-svn: 237507
2015-05-16 01:39:39 +00:00
Richard Trieu f956a49e6d When emitting a dropped qualifier error, show which qualifiers are dropped.
llvm-svn: 237505
2015-05-16 01:27:03 +00:00
Bill Schmidt 41e14c4dfa [PPC64] Add vector pack/unpack support from ISA 2.07
This patch adds support for the following new instructions in the
Power ISA 2.07:

  vpksdss
  vpksdus
  vpkudus
  vpkudum
  vupkhsw
  vupklsw

These instructions are available through the vec_packs, vec_packsu,
vec_unpackh, and vec_unpackl built-in interfaces.  These are
lane-sensitive instructions, so the built-ins have different
implementations for big- and little-endian, and the instructions must
be marked as killing the vector swap optimization for now.

The first three instructions perform saturating pack operations.  The
fourth performs a modulo pack operation, which means it can be
represented with a vector shuffle, and conversely the appropriate
vector shuffles may cause this instruction to be generated.  The other
instructions are only generated via built-in support for now.

I noticed during patch preparation that the macro __VSX__ was not
previously predefined when the power8-vector or direct-move features
are requested.  This is an error, and I've corrected that here as
well.

Appropriate tests have been added.

There is a companion patch to llvm for the rest of this support.

llvm-svn: 237500
2015-05-16 01:02:25 +00:00
NAKAMURA Takumi e712f0a183 clang/test/SemaCXX/attr-no-sanitize.cpp: Don't mix stdout and stderr for FileCheck.
MSVCRT's stdio doesn't do line buffering.

llvm-svn: 237492
2015-05-16 00:09:39 +00:00
Richard Trieu 0ff51f39de Reverse the order of types in the reference dropping qualifiers error.
The error has the form ... 'int' ... 'const int' ... dropped qualifiers.  At
first glance, it appears that the const qualifier is added.  Reverse the types
so that the second type is less qualified than the first.

llvm-svn: 237482
2015-05-15 22:07:49 +00:00
Peter Collingbourne 9441094249 Use llvm::StringSwitch<std::string> to take advantage of implicit asserting conversion to std::string.
llvm-svn: 237475
2015-05-15 20:11:18 +00:00
Richard Smith 4241314164 [modules] Add local submodule visibility support for declarations.
With this change, enabling -fmodules-local-submodule-visibility results in name
visibility rules being applied to submodules of the current module in addition
to imported modules (that is, names no longer "leak" between submodules of the
same top-level module). This also makes it much safer to textually include a
non-modular library into a module: each submodule that textually includes that
library will get its own "copy" of that library, and so the library becomes
visible no matter which including submodule you import.

llvm-svn: 237473
2015-05-15 20:05:43 +00:00
Peter Collingbourne 915df9968b Implement no_sanitize attribute.
Differential Revision: http://reviews.llvm.org/D9631

llvm-svn: 237463
2015-05-15 18:33:32 +00:00
NAKAMURA Takumi d16af5dfda CGAtomic.cpp: Fix bogus \brief(s). Did you mean "\param"? [-Wdocumentation]
llvm-svn: 237447
2015-05-15 13:47:52 +00:00
Serge Pavlov e7ad831241 Limit set of types instantiated in FindInstantiatedDecl.
Starting from r236426 FindInstantiatedDecl may instantiate types that
are referenced before definition. This change limit the set of types
that can be instantiated by this function.

llvm-svn: 237434
2015-05-15 10:10:28 +00:00
Daniel Jasper 3ca283ada3 clang-format: Slightly change format decisions around macro annotations.
Before:
  bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      GUARDED_BY(aaaaaaaaaaaa) = aaaaaaaaaaaaaaaaaaaaaaaaa;

After:
  bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa GUARDED_BY(aaaaaaaaaaaa) =
      aaaaaaaaaaaaaaaaaaaaaaaaa;

llvm-svn: 237430
2015-05-15 09:58:11 +00:00
Daniel Jasper 731dde91db clang-format: Don't use column layout in lists that have separating
comments. At some point, we might to want to a layout with a different
number of columns instead, but at the moment, this causes more
confusion than it's worth.

llvm-svn: 237427
2015-05-15 09:41:59 +00:00
Daniel Jasper cdb58b2e45 clang-format: Add missing space before ObjC selector.
Before:
  [self aaaaa:(1 + 2)bbbbb:3];

After:
  [self aaaaa:(1 + 2) bbbbb:3];

llvm-svn: 237424
2015-05-15 09:05:31 +00:00
Alexey Bataev f0ab553fea [OPENMP] Fixed bug in atomic update/capture/write constructs.
Fixed a bug with codegen for destination atomic l-value with padding and junk in this padding bytes.

llvm-svn: 237422
2015-05-15 08:36:34 +00:00
NAKAMURA Takumi 1a6756bba0 Revert r237385, "[CodeGen] Reuse stack space from unused function results"
It broke clang stage2, at least tblgen.

llvm-svn: 237418
2015-05-15 03:49:05 +00:00
Richard Smith 4caa449ade Refactor: when exposing a definition in some module, provide listeners with the
module rather than requiring them to work it out themselves.

llvm-svn: 237416
2015-05-15 02:34:32 +00:00
Pirama Arumuga Nainar e9bcddd5cb Add flag to enable native half type
Summary:
r235215 enables support in LLVM for legalizing f16 type in the IR.  AArch64
already had support for this.  r235215 and some backend patches brought support
for ARM, X86, X86-64, Mips and Mips64.

This change exposes the LangOption 'NativeHalfType' in the command line, so the
backend legalization can be used if desired.  NativeHalfType is enabled for
OpenCL (current behavior) or if '-fnative-half-type' is set.

Reviewers: olista01, steven_wu, ab

Subscribers: cfe-commits, srhines, aemerson

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

llvm-svn: 237406
2015-05-14 23:44:18 +00:00
David Blaikie f0f00dc33b Fix Clang -Wsequence-point
llvm-svn: 237401
2015-05-14 22:47:19 +00:00
Justin Bogner 682bfbf35f InstrProf: Only disable coverage in built-in macros, not all system macros
The issue I was trying to solve in r236547 was about built-in macros,
but I disabled coverage in all system macros. This is actually a bit
of overkill, and makes the display of coverage around system macros
degrade unnecessarily. Instead, limit this to builtins specifically.

llvm-svn: 237397
2015-05-14 22:14:10 +00:00
Ted Kremenek c004b4d3a1 Tweak availability checking to look through typedef declarations.
llvm-svn: 237396
2015-05-14 22:07:25 +00:00
Diego Novillo c324b92c35 Revert "Detect uses of mismatching forms of 'new' and 'delete'"
This reverts commit 742dc9b6c9686ab52860b7da39c3a126d8a97fbc.

This is generating multiple segfaults in our internal builds.
Test case coming up shortly.

llvm-svn: 237391
2015-05-14 20:57:48 +00:00
Nemanja Ivanovic e97e111af4 Testing for the fix for bug 23429.
Follow-up to commit for revision 236848.
Just a test case for the macro definition under the right CPU/Arch.
One combination was actually missed in the initial fix:
  - powerpc64-unknown-unknown -mcpu=pwr8 (rather than -mcpu=power8).

llvm-svn: 237386
2015-05-14 20:02:24 +00:00
Sergey Dmitrouk 3e96fc08da [CodeGen] Reuse stack space from unused function results
Summary:
Space on stack allocated for unused structures returned by functions was unused
even when it's lifetime didn't intersect with lifetime of any other objects that
could use the same space.

The test added also checks for named and auto objects.  It seems to make sense
to have this all in one place.

Reviewers: aadg, rsmith, rjmccall, rnk

Reviewed By: rnk

Subscribers: asl, cfe-commits

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

llvm-svn: 237385
2015-05-14 19:58:03 +00:00
Richard Smith a462b4c9ac DR295: cv-qualifiers on function types are ignored in C++.
llvm-svn: 237383
2015-05-14 19:10:42 +00:00
Richard Smith 2d5814c2d4 Update cxx_dr_status to latest issues list.
llvm-svn: 237382
2015-05-14 19:07:47 +00:00
Ikhlas Ajbar 03404c14fe Remove unused function HasPICArg().
llvm-svn: 237374
2015-05-14 17:42:20 +00:00
Vladimir Sukharev 85a19e92d7 [ARM] Fix of architecture naming typo
Inspired by James Greenhalgh's catch

Subscribers: cfe-commits

Relates to: http://reviews.llvm.org/rL237349

llvm-svn: 237370
2015-05-14 16:39:01 +00:00
Ismail Pazarbasi 538ef53c13 Detect uses of mismatching forms of 'new' and 'delete'
Emit warning when operand to `delete` is allocated with `new[]` or
operand to `delete[]` is allocated with `new`.

Reviewers: rtrieu, jordan_rose, rsmith

Subscribers: majnemer, cfe-commits

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

llvm-svn: 237368
2015-05-14 16:14:57 +00:00
Ikhlas Ajbar 522e6196f7 Factor out SmallDataThreshold
This patch factors out SmallDataThreshold code.

llvm-svn: 237364
2015-05-14 13:52:08 +00:00
Vladimir Sukharev c6dab75bd4 [ARM] Add v8.1a architecture
Add support for ARMv8.1a architecture. 

Briefly it is described on http://community.arm.com/groups/processors/blog/2014/12/02/the-armv8-a-architecture-and-its-ongoing-development

Reviewers: 	jmolloy, rengolin

Subscribers: cfe-commits

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

llvm-svn: 237349
2015-05-14 08:25:18 +00:00
Kevin Qin 78b8653a84 [AArch64 ACLE] Allow to define poly64_t as 'unsigned long long' on LLP64 system.
This fixes PR23414 as well.

llvm-svn: 237348
2015-05-14 08:18:05 +00:00
NAKAMURA Takumi 55deb26613 clang/test/Frontend/dependency-gen-escaping.c: Appease win32 hosts. Investigating.
FIXME: Do we really emit single \ or escaped \\ along the context with -fms-compatibility -MG?
llvm-svn: 237347
2015-05-14 07:37:35 +00:00
Yaron Keren 129dfbff4a Revert r237339 as sanitizer-ppc64-linux1 does not like it.
Complains:

/home/buildbots/sanitizerslave1/sanitizer-ppc64-1/build/llvm/tools/clang/tools/c-index-test/c-index-test.c:829:30: error: format specifies type 'long' but the argument has type 'long long' [-Werror,-Wformat]
                     I, TAK, clang_Cursor_getTemplateArgumentValue(Cursor, I));
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'm not sure now how this should be fixed. %lld is non-standard
and not accepted by mingw on Windows while PRId64 is bad for this bot.

Is long long longer than 64 bits here? if not, why is PRId64
incompatible with it? something seems wrong.

Probably all the datatypes should be replaced to unsigned or uint64_t
depending upin requirements instead of the non standard long long.

llvm-svn: 237346
2015-05-14 06:53:31 +00:00
David Majnemer 02ddd7f529 [MS ABI] Add support for /Zc:sizedDealloc
llvm-svn: 237344
2015-05-14 05:55:00 +00:00
Yaron Keren e7aad46665 Replace non-standard %lld printf usage with PRId64.
See also r180024.

llvm-svn: 237339
2015-05-14 05:40:50 +00:00
David Majnemer a84a082384 Fix buildbots
llvm-svn: 237338
2015-05-14 05:24:59 +00:00
David Majnemer 1b5baffd73 [MS ABI] __declspec(thread) behaves like thread_local in MSVC 2015
MSVC 2015 changed __declspec(thread) to make it behave like C++11's
thread_local keyword instead of acting similarly to __thread.

llvm-svn: 237337
2015-05-14 05:19:23 +00:00
David Majnemer dd0bed1b2d [AST] hasAttr followed by getAttr isn't efficient
Just use getAttr because we are interested in the attribute's contents.

llvm-svn: 237336
2015-05-14 05:19:20 +00:00
David Majnemer 87b853c5f0 [clang-cl] Add /Qvec and /Qvec- to control vectorization
llvm-svn: 237335
2015-05-14 05:19:17 +00:00
NAKAMURA Takumi 01477e5d6a clang/test/Frontend/dependency-gen-escaping.c: Tweak r237296, to let '/' and '\\' distinguishd, to unbreak "--host=linux --target=msvc".
llvm-svn: 237333
2015-05-14 04:25:54 +00:00
Richard Smith 31d5184dc5 Generalize future keyword compat diagnostics.
This, in preparation for the introduction of more new keywords in the
implementation of the C++ language, generalizes the support for future keyword
compat diagnostics (e.g., diag::warn_cxx11_keyword) by extending the
applicability of the relevant property in IdentifierTable with appropriate
renaming.

Patch by Hubert Tong!

llvm-svn: 237332
2015-05-14 04:00:59 +00:00
Richard Smith dbbc523639 [modules] Rearrange preprocessor module visibility handling, no observable change intended.
llvm-svn: 237331
2015-05-14 02:25:44 +00:00
Richard Smith 08abfa3aa9 Add missing #include, found by modules build.
llvm-svn: 237326
2015-05-14 01:08:58 +00:00
Richard Smith d0782a69ff [modules] Work around PR23521 to fix -O0 modules bootstrap.
llvm-svn: 237325
2015-05-14 01:08:08 +00:00
Richard Smith 23d8d0338e [modules] Fix a #include cycle when building a module for our builtin headers.
xmmintrin.h includes emmintrin.h and vice versa if SSE2 is enabled. We break
this cycle for a modules build, and instead make the xmmintrin.h module
re-export the immintrin.h module. Also included is a fix for an assert in the
serialization code if a module exports another module that was declared later
in the same module map.

llvm-svn: 237321
2015-05-14 00:45:20 +00:00
Richard Smith a0334a9277 Fix a #include cycle in the libclang headers. "Eventually" is now.
llvm-svn: 237320
2015-05-14 00:22:12 +00:00
Paul Robinson fcdf3e9fe7 Break \# in a depfile the same way as gcc.
Backslash followed by # in a filename should have both characters
escaped, if you do it the way GNU Make wants.  GCC doesn't, so we do
it the way GCC does rather than the way GNU Make wants.

llvm-svn: 237304
2015-05-13 22:33:50 +00:00
Peter Collingbourne 470d94247d Make GNUInline consistent with whether we use traditional GNU inline semantics.
Previously we were setting LangOptions::GNUInline (which controls whether we
use traditional GNU inline semantics) if the language did not have the C99
feature flag set. The trouble with this is that C++ family languages also
do not have that flag set, so we ended up setting this flag in C++ modes
(and working around it in a few places downstream by also checking CPlusPlus).

The fix is to check whether the C89 flag is set for the target language,
rather than whether the C99 flag is cleared. This also lets us remove most
CPlusPlus checks. We continue to test CPlusPlus when deciding whether to
pre-define the __GNUC_GNU_INLINE__ macro for consistency with GCC.

There is a change in semantics in two other places
where we weren't checking both CPlusPlus and GNUInline
(FunctionDecl::doesDeclarationForceExternallyVisibleDefinition and
FunctionDecl::isInlineDefinitionExternallyVisible), but this change seems to
put us back into line with GCC's semantics (test case: test/CodeGen/inline.c).

While at it, forbid -fgnu89-inline in C++ modes, as GCC doesn't support it,
it didn't have any effect before, and supporting it just makes things more
complicated.

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

llvm-svn: 237299
2015-05-13 22:07:22 +00:00
Paul Robinson 64441def58 Fix dependency file escaping.
When writing a dependency (.d) file, if space or # is immediately
preceded by one or more backslashes, escape the backslashes as well as
the space or # character. Otherwise leave backslash alone.
This straddles the fence between BSD Make (which does no escaping at
all, and does not support space or # in filespecs) and GNU Make (which
does support escaping, but will fall back to the filespec as-written
if the escaping doesn't match an existing file).

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

llvm-svn: 237296
2015-05-13 21:18:15 +00:00
Aaron Ballman d43f0c5e82 Made considerable updates to the documentation explaining how to add a new attribute to clang. Cleans up some of the existing wording, as well as adding new information and better explanations.
llvm-svn: 237268
2015-05-13 18:06:48 +00:00
Yaron Keren f428fcfaa0 Silence Visual C++ warning C4189: 'Result' : local variable is initialized but not referenced.
Sadly, LLVM_ATTRIBUTE_UNUSED does nothing with Visual C++ which means
we'll have to workaround such cases again and again.

llvm-svn: 237267
2015-05-13 17:56:46 +00:00
Daniel Jasper c4144ea418 clang-format: Improve nested block / lambda indentation when wrapping
before binary/ternary operators.

Basically, it doesn't seem right to indent a nested block aligned to a
binary or ternary operator.

Before:
  int i = aaaaaa ? 1  //
                 : [] {
                   return 2;  //
                 }();
  llvm::errs() << "number of twos is "
               << std::count_if(v.begin(), v.end(), [](int x) {
                 return x == 2;  // force break
               });

After:
  int i = aaaaaa ? 1  //
                 : [] {
                     return 2;  //
                   }();
  llvm::errs() << "number of twos is "
               << std::count_if(v.begin(), v.end(), [](int x) {
                    return x == 2;  // force break
                  });

llvm-svn: 237263
2015-05-13 16:09:21 +00:00
Daniel Jasper 3a26a8db5d clang-format: Fix incorrect */& classification.
Before:
  void f() { f(new a(), c *d); }

After:
  void f() { f(new a(), c * d); }

llvm-svn: 237249
2015-05-13 12:54:30 +00:00
Daniel Jasper e60cba1337 clang-format: Fix semicolon less macro-detection.
It was fooled by the comment.

Before:
  SOME_UNRELATED_MACRO
      /*static*/ int i;

After:
  SOME_UNRELATED_MACRO
  /*static*/ int i;

llvm-svn: 237246
2015-05-13 11:35:53 +00:00
Daniel Jasper a7b142603d clang-format: [ObjC] Further improve wrapping of methods calls without inputs.
Before:
  [aaaaaaaaaaaaaaaaaaaaaaa
      .aaaaaaaa[aaaaaaaaaaaaaaaaaaaaa] aaaaaaaaaaaaaaaaaaaaaa];

After:
  [aaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaa[aaaaaaaaaaaaaaaaaaaaa]
      aaaaaaaaaaaaaaaaaaaaaa];

llvm-svn: 237244
2015-05-13 10:23:03 +00:00
Alexey Bataev d130fd17f1 [OPENMP] Fixed codegen for firstprivate variables, also marked as lastprivate.
In some rare cases shared copies of lastprivate/firstprivate variables were not updated after the loop directive.

llvm-svn: 237243
2015-05-13 10:23:02 +00:00
Daniel Jasper a2a4d9c049 clang-format: [ObjC] Make IndentWrappedFunctionNames work with ObjC functions
llvm-svn: 237241
2015-05-13 09:38:25 +00:00
Daniel Jasper 0ad2814c89 clang-format: Prefer formatting local lambdas like functions.
Before:
  auto my_lambda =
      [](const string &some_parameter) { return some_parameter.size(); };

After:
  auto my_lambda = [](const string &some_parameter) {
    return some_parameter.size();
  };

llvm-svn: 237235
2015-05-13 08:47:16 +00:00
Daniel Jasper 60c270764e clang-format: Support column layout with comment after {.
Before:
  vector<int> iiiiiiiiiiiiiii = {                      //
      1111111111, 2222222222, 33333333333, 4444444444, //
      111111111, 222222222, 3333333333, 444444444,     //
      11111111, 22222222, 333333333, 44444444};

After:
  vector<int> iiiiiiiiiiiiiii = {                      //
      1111111111, 2222222222, 33333333333, 4444444444, //
      111111111,  222222222,  3333333333,  444444444,  //
      11111111,   22222222,   333333333,   44444444};

llvm-svn: 237233
2015-05-13 08:16:00 +00:00
Eric Fiselier 7aa0d4aac3 Have '__have_extension(cxx_variadic_templates)' return true for any C++ standard.
llvm-svn: 237202
2015-05-12 22:37:23 +00:00
Richard Smith b2974fd3ce Add missing #includes, found by modules build.
llvm-svn: 237194
2015-05-12 21:48:00 +00:00
Richard Trieu 1d3b58e317 Add a new error for unexpected semi-colon before closing delimiter.
Previously, if a semi-colon is unexpectedly added before a closing ')', ']' or
'}', two errors and one note would emitted, and the parsing would get confused
to which scope it was in.  This change consumes the semi-colon, recovers
parsing better, and emits only one error with a fix-it.

llvm-svn: 237192
2015-05-12 21:36:35 +00:00
Justin Bogner 3dda83f03a InstrProf: Update name of compiler-rt routine for setting filename
Patch by Teresa Johnson.

llvm-svn: 237187
2015-05-12 21:23:16 +00:00
Douglas Katzman 78d7c54f7c clang-format AllocateTarget. NFC
llvm-svn: 237183
2015-05-12 21:18:10 +00:00
Richard Smith c62fe69cc8 List Alexey Bataev as code owner for Clang's OpenMP support, as discussed offline.
Thanks for all your hard work getting us OpenMP feature-complete, Alexey!

llvm-svn: 237171
2015-05-12 20:29:41 +00:00
Artem Belevich ed0577cc6d Fixed double-free in case of module loading error.
GetOutputStream() owns the stream it returns pointer to and the
pointer should never be freed by us. When we fail to load and exit
early, unique_ptr still holds the pointer and frees it which leads to
compiler crash when CompilerInstance attempts to free it again.

Added regression test for failed bitcode linking.

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

llvm-svn: 237159
2015-05-12 17:44:15 +00:00
Sunil Srivastava 3acf6275e6 Changed renaming of local symbols by inserting a dot vefore the numeric suffix
details in http://reviews.llvm.org/D9483
goes with llvm checkin r237150

llvm-svn: 237151
2015-05-12 16:48:43 +00:00
Manuel Klimek 328263e4d8 Fix clang-format build from the solution; the underlying path has changed to include the VS directory structure.
llvm-svn: 237136
2015-05-12 14:41:39 +00:00
Yaron Keren eac8a1e328 Remove superfluous SmallString cast.
llvm-svn: 237123
2015-05-12 12:47:05 +00:00
Nikola Smiljanic fb891fcef6 Fix misleading parameter name for PPCallbacks::FileSkipped.
Patch thanks to Vladimir Voskresensky.

llvm-svn: 237115
2015-05-12 11:48:05 +00:00
Daniel Jasper 56807c19ac clang-format: Make member introduced in r237108 const.
llvm-svn: 237114
2015-05-12 11:14:06 +00:00
Renato Golin cb3b0c6eeb Change TargetParser enum names to avoid macro conflicts (clang)
sys/time.h on Solaris (and possibly other systems) defines "SEC" as "1"
using a cpp macro.  The result is that this fails to compile.

Fixes https://llvm.org/PR23482

llvm-svn: 237113
2015-05-12 10:34:10 +00:00
Daniel Jasper 99b5a4648c clang-format: Fix */& detection for lambdas in macros.
Before:
  #define MACRO() [](A * a) { return 1; }

After:
  #define MACRO() [](A *a) { return 1; }

llvm-svn: 237109
2015-05-12 10:20:32 +00:00
Daniel Jasper 5fc133e71e clang-format: Fix hanging nested blocks in macros.
Before:
  #define MACRO()                     \
    Debug(aaa, /* force line break */ \
          {                           \
      int i;                          \
      int j;                          \
          })

After:
  #define MACRO()                     \
    Debug(aaa, /* force line break */ \
          {                           \
            int i;                    \
            int j;                    \
          })

llvm-svn: 237108
2015-05-12 10:16:02 +00:00
Manuel Klimek 3d3ea84a4f Refactor clang-format's formatter.
Summary:
a) Pull out a class LevelIndentTracker whose responsibility is to keep track
   of the indent of levels across multiple annotated lines.
b) Put all responsibility for merging lines into the LineJoiner; make the
   LineJoiner iterate over the lines so we never operate on a line that might
   be merged later; this makes the interface safer to use.
c) Move formatting of the end-of-file whitespace into formatFirstToken.

Fix bugs that became obvious after the refactoring:
1. We would not format lines with offsets correctly inside nested blocks if
   only the outer expression was affected:
   int x = s({ // clang-format only this line
     class X {
       public:
    // ^ this starts at the non-modified indnent level; previously we would
    //   not fix this, now we correctly outdent it.
       void f();
     };
   });
2. We would incorrectly align comments across lines that do not have comments
   for lines with nested blocks:
   int expression; // with comment
   int x = s({
     int y; // comment
     int z; // we would incorrectly align this comment with the comment on
            // 'expression'
   });

llvm-svn: 237104
2015-05-12 09:23:57 +00:00
Alexey Bataev 0c024df9d1 [OPENMP] Allow using of threadprivate variables as loop-control variables in lop based directives.
llvm-svn: 237102
2015-05-12 09:02:07 +00:00
Alexey Bataev 040d540940 [OPENMP] Fixed support for 'schedule' clause with non-constant chunk size.
'schedule' clause for combined directives requires additional processing. Special helper variable is generated, that is captured in the outlined parallel region for 'parallel for' region. This captured variable is used to store chunk expression from the 'schedule' clause in this 'parallel for' region.

llvm-svn: 237100
2015-05-12 08:35:28 +00:00
Justin Bogner 2fd95f6b92 Driver: Fix a -Wshadow issue from r237091
The MachO toolchain has an isTargetIOSBased method, but it isn't
virtual so it isn't very meaningful to call it. After thinking about
this, I guess that putting this logic in the MachO class is a bit of a
layering violation anyway. Do this more like how we handle
AddLinkRuntimeLibArgs instead.

llvm-svn: 237095
2015-05-12 06:30:48 +00:00
Justin Bogner c7701240ed Re-apply "Driver: Make profiling flags work with -nostdlib on Darwin"
This time without a stray "true" in an argument list.

This reverts r237077, restoring r237074.

llvm-svn: 237091
2015-05-12 05:44:36 +00:00
Kostya Serebryany 123e3eb0be revert r237081 -- bad idea (-lcrypt may not be present)
llvm-svn: 237086
2015-05-12 03:10:42 +00:00
Kostya Serebryany 5c79fda912 add -lcrypto to clang and clang-format fuzzers (lib/Fuzzer will soon require it)
llvm-svn: 237081
2015-05-12 01:29:04 +00:00
Eric Christopher 9e172d20f0 Remove the code that pulled soft float attributes out of the feature
strings and remove the setting of TargetOptions::UseSoftFloat to
match the code change in llvm r237079.

llvm-svn: 237080
2015-05-12 01:26:21 +00:00
Justin Bogner 7b6c0e02ac Revert "Driver: Make profiling flags work with -nostdlib on Darwin"
This revert r237074. These tests are failing all over the place.

llvm-svn: 237077
2015-05-12 01:04:33 +00:00
Justin Bogner f44ddae71e Driver: Make profiling flags work with -nostdlib on Darwin
Compiler-rt's Profiling library isn't part of the stdlib, so -nostdlib
shouldn't prevent it from being linked. This makes Darwin behave like
other toolchains, and link in the profile runtime irrespective of
-nostdlib, since the resulting program can't be run unless you link
this.

I've also added a test to show that other toolchains already behave
like this.

llvm-svn: 237074
2015-05-12 00:31:33 +00:00
Steven Wu 18bbe191cd Allow empty assembly string literal with -fno-gnu-inline-asm
Empty assembly string will not introduce assembly code in the output
binary and it is often used as a trick in the header to disable
optimizations. It doesn't conflict with the purpose of the option so it
is allowed with -fno-gnu-inline-asm flag.

llvm-svn: 237073
2015-05-12 00:16:37 +00:00
Eric Christopher 5eaf3815c0 Update initialization of a class variable and comment.
llvm-svn: 237071
2015-05-12 00:04:20 +00:00
James Dennett 570043310e Typo fix: s/initialzier/initializer/ in a doc comment.
No functional change.

llvm-svn: 237068
2015-05-11 23:25:54 +00:00
Richard Smith b0b68010c5 PR20625: Instantiate static constexpr member function of a local struct in a function template earlier.
This is necessary in order to allow the use of a constexpr member function, or
a member function with deduced return type, of a local class within a
surrounding instantiated function template specialization.

Patch by Michael Park!

This re-commits r236063, which was reverted in r236134, along with a fix for a
delayed template parsing bug that was exposed by this change.

llvm-svn: 237064
2015-05-11 23:09:06 +00:00
Peter Collingbourne bf59c34bfd Move sanitizer parser and group expander from Driver to Basic.
No functional change.

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

llvm-svn: 237056
2015-05-11 21:39:20 +00:00
Peter Collingbourne 3eea677f3a Unify sanitizer kind representation between the driver and the rest of the compiler.
No functional change.

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

llvm-svn: 237055
2015-05-11 21:39:14 +00:00
Steven Wu 6b72a6753b Allow AsmLabel with -fno-gnu-inline-asm
Summary:
AsmLabel is heavily used in system level and firmware to redirect
function and access platform specific labels. They are also extensively
used in system headers which makes this option unusable for many
users. Since AsmLabel doesn't introduce any assembly code into the
output binary, it shouldn't be considered as inline-asm.

Reviewers: bob.wilson, rnk

Reviewed By: rnk

Subscribers: cfe-commits

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

llvm-svn: 237048
2015-05-11 21:14:09 +00:00
Artem Belevich e958275250 [cuda] Fixed test case failure on s390x
llvm-svn: 237007
2015-05-11 18:35:58 +00:00
Richard Barton ad25da87b5 Revert "Allow -target= and --target options"
After mailing list discussion on 11-13 March we would prefer to stick to a
single spelling of the long option.

This reverts commit 30035fe1a7c759c89ee62eb46efce6b3790fcc08.

llvm-svn: 237003
2015-05-11 17:05:05 +00:00
Douglas Katzman f36dddf426 [Sparc] Add support for 'sparcel' to clang.
Differential Revision: http://reviews.llvm.org/D8784

llvm-svn: 237001
2015-05-11 15:21:44 +00:00
Daniel Jasper 015c7a91f1 clang-format: Support aligning ObjC string literals.
Before:
  NSString s = @"aaaa"
      @"bbbb";

After:
  NSString s = @"aaaa"
               @"bbbb";

llvm-svn: 237000
2015-05-11 15:15:48 +00:00
Aaron Ballman 416b127456 Disable __has_cpp_attribute when not compiling in C++ mode. As this feature test macro only supports C++ style attributes, it doesn't apply to code compiled as C code, and can lead to diagnostics when given a scoped attribute.
This addresses PR23435.

llvm-svn: 236996
2015-05-11 14:09:50 +00:00
Daniel Jasper d9ff035de8 clang-format: Appease the buildbots by including climits.
llvm-svn: 236995
2015-05-11 13:52:13 +00:00
Daniel Jasper d57843d4e3 clang-format: Improve column layout.
Specifically, calculate the deviation between the shortest and longest
element (which is used to prevent excessive whitespace) per column, not
overall. This automatically handles the corner cases of a single column
and a single row so that the actualy implementation becomes simpler.

Before:
  vector<int> x = {1,
                   aaaaaaaaaaaaaaaaaaaaaa,
                   2,
                   bbbbbbbbbbbbbbbbbbbbbb,
                   3,
                   cccccccccccccccccccccc};

After:
  vector<int> x = {1, aaaaaaaaaaaaaaaaaaaaaa,
                   2, bbbbbbbbbbbbbbbbbbbbbb,
                   3, cccccccccccccccccccccc};

llvm-svn: 236992
2015-05-11 13:35:40 +00:00
Daniel Jasper 790d4f975e clang-format: Don't merge subsequent lines into _asm blocks.
Before:
  _asm {
  } int i;

After:
  _asm {
  }
  int i;

llvm-svn: 236985
2015-05-11 11:59:46 +00:00
Daniel Jasper ec05fc7b16 clang-format: [JS] Clean up export declaration parsing.
NFC intended.

llvm-svn: 236982
2015-05-11 09:14:50 +00:00
Elena Demikhovsky 23fccde1b1 AVX-512: Changed CC parameter in "cmp" intrinsic
from i8 to i32 according to the Intel Spec

llvm-svn: 236980
2015-05-11 09:03:41 +00:00
Daniel Jasper 668c7bb34f clang-format: [JS] Parse exported functions as free-standing.
Before:
  export function foo() {} export function bar() {}

After:
  export function foo() {
  }
  export function bar() {
  }

llvm-svn: 236978
2015-05-11 09:03:10 +00:00
Daniel Marjamaki ecb0e1bc60 Refactor MacroInfo so range for loops can be used to iterate its tokens.
Differential Revision: http://reviews.llvm.org/D9079

llvm-svn: 236975
2015-05-11 08:25:54 +00:00
Manuel Klimek d3585dbd1a Refactor the formatter of clang-format.
Pull various parts of the UnwrappedLineFormatter into their own
abstractions. NFC.

There are two things left for subsequent changes (to keep this
reasonably small)
- the UnwrappedLineFormatter now has a bad name
- the UnwrappedLineFormatter::format function is still too large

llvm-svn: 236974
2015-05-11 08:21:35 +00:00
David Majnemer b710a938d6 Give isCompatibleWithMSVC a better interface
We now use an enum which maps the marketing name (almost always a year)
to the major version number.

llvm-svn: 236967
2015-05-11 03:57:49 +00:00
David Majnemer 30f058aa9d [MS ABI] Import move assignment operators
MSVC 2015 changed behavior from 2013; it imports move assignment
operators.

llvm-svn: 236966
2015-05-11 03:00:22 +00:00
Jonathan Roelofs 6800293701 Fix indentation problem introduced in r236964. NFC
llvm-svn: 236965
2015-05-11 02:13:24 +00:00
Jonathan Roelofs e868b624da Fix formatting of a few code blocks. NFC
llvm-svn: 236964
2015-05-11 02:05:20 +00:00
David Majnemer e60813f91f [MS ABI] Form member pointers from virtual funcs overriding vbases
We didn't supporting taking the address of virtual member functions
which overrode a method in a virtual base.  We simply need to encode the
virtual base index in the member pointer.

This fixes PR23452.

N.B.  There is no data member pointer side to this change because taking
the address of a virtual bases' data member gives you a member pointer
whose type is derived from the virtual bases' type, not the most derived
type.

llvm-svn: 236962
2015-05-10 21:48:08 +00:00
David Majnemer fb6ffca6f8 [MS ABI] Update EH emission for MSVC 2015 compatibility
MSVC 2015 renamed the symbol found by name lookup for 'std::terminate'
so we cannot rely on using '?terminate@@YAXXZ'.  Furthermore, it seems
that 2015 will be the first release of MSVC which permits inlining a
function which is noexcept into a function which isn't.  This is
implemented by creating a cleanup for the invoker which jumps to
__std_terminate.  Clang's implementation of this aspect of the MSVC
scheme is slightly less efficient in this respect because we use a
catch handler configured as a catch-all handler instead.

llvm-svn: 236961
2015-05-10 21:38:26 +00:00
Daniel Jasper 173504e494 clang-format: Improve wrapping of << operators.
Before:
  llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
                     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
                      aaaaaaaaaaaaaaaa) << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

After:
  llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
                      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
                      aaaaaaaaaaaaaaaa)
               << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

Also, cleanup and simplify the operator wrapping logic.

llvm-svn: 236960
2015-05-10 21:15:07 +00:00
Craig Topper 382277421d De-virtualize some const versions of getCanonicalDecl by redirecting to the non-const version. Most of the Decl hierarchy already did it this way this just makes the rest consistent.
llvm-svn: 236959
2015-05-10 18:40:12 +00:00
Daniel Jasper c6366077ed clang-format: Preserve line break before } in __asm { ... }.
Some compilers ignore everything after a semicolon in such inline asm
blocks and thus, the closing brace must not be moved to the previous
line.

llvm-svn: 236946
2015-05-10 08:42:04 +00:00
Daniel Jasper f0fd1c66df clang-format: Fix bug in escaped newline calculation.
This prevents clang-format from inadvertently joining stuff into macro
definitions as reported in llvm.org/PR23466.

llvm-svn: 236944
2015-05-10 08:00:25 +00:00
Daniel Jasper 622c72ded5 Reapply r236854 and fixed r236867.
Makes emacs show a different message when clang-format encountered a
syntax error.

llvm-svn: 236943
2015-05-10 07:47:19 +00:00
NAKAMURA Takumi 7b1ee5b0f9 Prune trailing LF.
llvm-svn: 236938
2015-05-09 21:10:13 +00:00
NAKAMURA Takumi c7da6da58e Revert r236879, "Do not emit thunks with available_externally linkage in comdats"
It broke pecoff, at least i686-cygwin.

llvm-svn: 236937
2015-05-09 21:10:07 +00:00
Ikhlas Ajbar 71d19f3cd6 Factor out Hexagon code to build args.
This patch factor out the code in hexagon::Link::ConstructJob to be reused
in other functions. No functionality change intended.

llvm-svn: 236926
2015-05-09 02:13:25 +00:00
Tobias Grosser a704600295 Revert "Make emacs show when clang-format encountered a syntax error."
This reverts commit 236854, which caused clang-format to always print
'{ "IncompleteFormat": false }' at the top of an incompletely formatted file.
This output causes problems e.g. in Polly's automatic formatting checks. Daniel
tried to fix this in 236867, but this fix had to be reverted due to buildbot
failures. I revert this change as well for now as it is Friday night and
unlikely to be fixed immediately.

llvm-svn: 236908
2015-05-08 21:34:09 +00:00
Renato Golin 0600e1ebe9 Using ARMTargetParser in Clang
This is a starting point for using the TargetParser in Clang, in a simple
enough part of the code that can be used without disrupting the crazy
platform support that we need to be compatible with other toolchains.

Also adding a few FIXME on obvious places that need replacing, but those
cases will indeed break a few of the platform assumptions, as arch/cpu names
change multiple times in the driver.

Finally, I'm changing the "neon-vfpv3" behaviour to match standard NEON, since
-mfpu=neon implies vfpv3 by default in both Clang and LLVM. That option
string is still supported as an alias to "neon".

llvm-svn: 236901
2015-05-08 21:04:50 +00:00
Diego Novillo 86f884ed46 Fix BackendConsumer::EmitOptimizationMessage()
Patch from Geoff Berry <gberry@codeaurora.org>

Fix BackendConsumer::EmitOptimizationMessage() to check if the
DiagnosticInfoOptimizationBase object has a valid location before
calling getLocation() to avoid dereferencing a null pointer inside
getLocation() when no debug info is present.

llvm-svn: 236898
2015-05-08 20:59:56 +00:00
Kaelyn Takata c8c0de2a89 Add the test case from PR 14044 to ensure it doesn't regress.
The test started working at some point, presumably fixed through the
delayed typo correction work.

llvm-svn: 236883
2015-05-08 17:39:48 +00:00
Renato Golin 82fbfe684e Revert "clang-format: Only output IncompleteFormat if -cursor is given."
This reverts commit r236867, as it was breaking multiple buildbots. Daniel
will look into it later.

llvm-svn: 236882
2015-05-08 17:05:24 +00:00
Derek Schuff 2312bd3811 Do not emit thunks with available_externally linkage in comdats
Functions with available_externally linkage will not be emitted to object
files (they will just be undefined symbols), so it does not make sense to
put them in comdats.

Creates a second overload of maybeSetTrivialComdat that uses the GlobalObject
instead of the Decl, and uses that in several places that had the faulty
logic.

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

llvm-svn: 236879
2015-05-08 16:47:21 +00:00
Renato Golin 4045f66175 Revert "Allow case-insensitive values for -mcpu for ARM and AArch64"
This reverts commit r236859, as it broke multiple builds. I'll investigate
and reapply when safe.

llvm-svn: 236869
2015-05-08 15:44:36 +00:00
Daniel Jasper e44e5665d4 clang-format: Only output IncompleteFormat if -cursor is given.
This is only for editor integrations.

llvm-svn: 236867
2015-05-08 15:36:30 +00:00
Renato Golin 9e36fb4c18 Allow case-insensitive values for -mcpu for ARM and AArch64
GCC allows case-insensitive values for -mcpu, -march and -mtune options.
This patch implements the same behaviour for the -mcpu option.

Patch by Gabor Ballabas.

llvm-svn: 236859
2015-05-08 14:50:32 +00:00
Manuel Klimek 3dfe4a87c8 Make emacs show when clang-format encountered a syntax error.
Propagate the 'incomplete-format' state back through clang-format's command
line interace and adapt the emacs integration to show a better result.

llvm-svn: 236854
2015-05-08 13:59:15 +00:00
Daniel Jasper e4c16c7ce3 clang-format: Several improvements around formatting braced lists.
In particular:
* If the difference between the longest and shortest element, we copped
  out of column format completely. Now, we instead allow to arrange
  these in a single column, essentially enforcing a one-per-line format.
* Allow column layout even if there are braced lists. Especially, if
  there are many short lists, this can be beneficial. The bad case,
  where there is a long nested init list is usually caught as we now
  limit the length difference of the longest and shortest element.

llvm-svn: 236851
2015-05-08 13:51:14 +00:00
Nemanja Ivanovic 531a656cf0 Fix for bug 23429.
The macros for gcc atomic compare and swaps are defined for Power8 CPU's since
the functionality is provided in the back end.

llvm-svn: 236848
2015-05-08 13:07:48 +00:00
John Brawn a95c1a8315 [ARM] Give an error on invalid -march values
llvm::Triple::getARMCPUForArch now returns nullptr for invalid -march
values, instead of silently translating it to arm7tdmi. Use this to
give an error message, which is consistent with how gcc behaves.

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

llvm-svn: 236846
2015-05-08 12:52:18 +00:00
Alexey Bataev 9d541a72e8 [OPENMP] Fixed atomic construct with non-integer expressions.
Do not emit 'atomicrmw' instruction for simple atomic constructs with non-integer expressions.

llvm-svn: 236828
2015-05-08 11:47:16 +00:00
Alexey Bataev 39f915b8f4 [OPENMP] Code cleanup for capturing of variables in OpenMP regions.
llvm-svn: 236821
2015-05-08 10:41:21 +00:00
Daniel Jasper 7325aee167 clang-format: [JS] Avoid bad line-warp around "function".
Before:
  someLooooooooongFunction(
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, function(
                                              aaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {
        // code
      });

After:
  someLooooooooongFunction(
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      function(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {
        // code
      });

llvm-svn: 236813
2015-05-08 08:38:52 +00:00
Daniel Jasper 69694b0691 clang-format: [JS] Fix regex literal detection.
Before:
  var regex = /= / ;

After:
  var regex = /=/;

llvm-svn: 236811
2015-05-08 07:55:13 +00:00
Nikola Smiljanic cf385dc887 Revert "Fix path separator issue on Windows."
This reverts commit 9242ff16b0460b488691fd70b42a2bf81a531e3a.

llvm-svn: 236806
2015-05-08 06:02:37 +00:00
Nikola Smiljanic 1cf6c28a9c Fix path separator issue on Windows.
llvm-svn: 236804
2015-05-08 03:26:15 +00:00
Alexey Samsonov 8fffba1ef1 Update docs for SanitizerCoverage.
llvm-svn: 236793
2015-05-07 23:04:19 +00:00
Alexey Samsonov dfa908c8d5 [SanitizerCoverage] Implement user-friendly -fsanitize-coverage= flags.
Summary:
Possible coverage levels are:
  * -fsanitize-coverage=func - function-level coverage
  * -fsanitize-coverage=bb - basic-block-level coverage
  * -fsanitize-coverage=edge - edge-level coverage

Extra features are:
  * -fsanitize-coverage=indirect-calls - coverage for indirect calls
  * -fsanitize-coverage=trace-bb - tracing for basic blocks
  * -fsanitize-coverage=trace-cmp - tracing for cmp instructions
  * -fsanitize-coverage=8bit-counters - frequency counters

Levels and features can be combined in comma-separated list, and
can be disabled by subsequent -fno-sanitize-coverage= flags, e.g.:
  -fsanitize-coverage=bb,trace-bb,8bit-counters -fno-sanitize-coverage=trace-bb
is equivalient to:
  -fsanitize-coverage=bb,8bit-counters

Original semantics of -fsanitize-coverage flag is preserved:
  * -fsanitize-coverage=0 disables the coverage
  * -fsanitize-coverage=1 is a synonym for -fsanitize-coverage=func
  * -fsanitize-coverage=2 is a synonym for -fsanitize-coverage=bb
  * -fsanitize-coverage=3 is a synonym for -fsanitize-coverage=edge
  * -fsanitize-coverage=4 is a synonym for -fsanitize-coverage=edge,indirect-calls

Driver tries to diagnose invalid flag usage, in particular:
  * At most one level (func,bb,edge) must be specified.
  * "trace-bb" and "8bit-counters" features require some level to be specified.

See test case for more examples.

Test Plan: regression test suite

Reviewers: kcc

Subscribers: cfe-commits

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

llvm-svn: 236790
2015-05-07 22:34:06 +00:00
David Majnemer ec8e54bbef [MS ABI] Make sure we number thread_local statics seperately
The thread_local variables need their own numbers, they can't share with
the other static local variables.

llvm-svn: 236774
2015-05-07 21:19:06 +00:00
Artem Belevich 8d062ad560 Fixed test failure on machines with 32-bit size_t.
llvm-svn: 236773
2015-05-07 21:06:03 +00:00
Artem Belevich 52cc487ba8 [cuda] Include GPU binary into host object file and generate init/deinit code.
- added -fcuda-include-gpubinary option to incorporate results of
  device-side compilation into host-side one.
- generate code to register GPU binaries and associated kernels
  with CUDA runtime and clean-up on exit.
- added test case for init/deinit code generation.

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

llvm-svn: 236765
2015-05-07 19:34:16 +00:00
James Dennett dd2ffea288 Replace the broken LambdaCapture::isInitCapture API.
A LambdaCapture does not have sufficient information
to correctly determine whether it is an init-capture or not.
Doing so requires knowledge held in the LambdaExpr itself.

It the case of a nested capture of an init-capture it is not
sufficient to check (as LambdaCapture::isInitCapture did)
whether the associated VarDecl was from an init-capture.

This patch moves isInitCapture to LambdaExpr and updates
Capture->isInitCapture() to Lambda->isInitCapture(Capture).

llvm-svn: 236760
2015-05-07 18:48:18 +00:00
Alexey Samsonov 3f3b3abe2b [SanitizerCoverage] Give clang-cc1 the power to precisly specify needed sanitizier coverage mode.
Summary:
The next step is to add user-friendly control over these options
to driver via -fsanitize-coverage= option.

Test Plan: regression test suite

Reviewers: kcc

Subscribers: cfe-commits

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

llvm-svn: 236756
2015-05-07 18:31:29 +00:00
David Blaikie d3c127e232 [opaque pointer type] Correctly pass the pointee type when creating a GEP constant expression
llvm-svn: 236751
2015-05-07 17:27:56 +00:00
Yaron Keren 9f88702ac6 Update the subversion link to http://subversion.apache.org/packages.html.
llvm-svn: 236734
2015-05-07 15:15:16 +00:00
Yaron Keren 37f99ed0fb Fix clang getting started guide to require VC2013 instead of VS2012.
llvm-svn: 236733
2015-05-07 15:12:30 +00:00
Szabolcs Sipos 1d068bb254 Adding new AST matcher: gnuNullExpr
It matches GNU __null expression.

llvm-svn: 236731
2015-05-07 14:24:22 +00:00
Daniel Jasper 9c95013e8f clang-format: Improve r236597, Properly indent method calls without inputs.
Before:
  [aaaaaaaaaaaa(aaaaaa)
          aaaaaaaaaaaaaaaaaaaa];

After:
  [aaaaaaaaaaaa(aaaaaa)
      aaaaaaaaaaaaaaaaaaaa];

llvm-svn: 236730
2015-05-07 14:19:59 +00:00
Manuel Klimek ec5c3db7ac Implements a way to retrieve information about whether some lines were not formatted due to syntax errors.
llvm-svn: 236722
2015-05-07 12:26:30 +00:00
Elena Demikhovsky bd5c8b9be9 AVX-512: FP compare intrinsics - changed type of CC parameter from i8 to i32 according to the spec.
Added FP compare intrinsics for SKX.

llvm-svn: 236715
2015-05-07 11:26:36 +00:00
NAKAMURA Takumi 6fc75e8e1b Mark clang/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp as REQUIRES:asserts. It relies on label names.
llvm-svn: 236709
2015-05-07 10:11:27 +00:00
David Majnemer ee97fc7b15 Fix some glitches in the MSVCCompatibility document
- Fix the formatting of the "Exceptions and SEH" section.
- Make the "Complete" text for "Thread-safe initialization of local
  statics" green.

llvm-svn: 236706
2015-05-07 07:48:16 +00:00
Alexey Bataev 43f7439cf5 Fix for http://llvm.org/PR23392: magick/feature.c from ImageMagick-6.9.1-2 ICEs.
Fix for codegen of static variables declared inside of captured statements. Captured statements are actually a transparent DeclContexts, so we have to skip them when trying to get a mangled name for statics.
Differential Revision: http://reviews.llvm.org/D9522

llvm-svn: 236701
2015-05-07 06:28:46 +00:00
David Majnemer 79a4d58ea1 Note that we support 'throw' for the MS ABI.
llvm-svn: 236698
2015-05-07 06:16:03 +00:00
David Majnemer 8354eeed19 [MS ABI] Implement thread-safe initialization using the MSVC 2015 ABI
The MSVC 2015 ABI utilizes a rather straightforward adaptation of the
algorithm found in the appendix of N2382.  While we are here, implement
support for emitting cleanups if an exception is thrown while we are
intitializing a static local variable.

llvm-svn: 236697
2015-05-07 06:15:46 +00:00
Alexey Bataev 53223c986c [OPENMP] Generate !llvm.mem.loop_parallel_access metadata for loops with dynamic/guided scheduling.
Inner bodies of OpenMP worksharing loop-based constructs with dynamic or guided scheduling are allowed to be marked with !llvm.mem.parallel_loop_access metadata for better optimization. Worksharing constructs with static scheduling cannot be marked this way (according to OpenMP standard "A data dependence between the same logical iterations in two such loops is guaranteed").
Constructs with auto and runtime scheduling are also not marked because automatically chosen scheduling may be static also.
Differential Revision: http://reviews.llvm.org/D9518

llvm-svn: 236693
2015-05-07 04:25:17 +00:00
Alexey Bataev 4fce73aabf [OPENMP] Fixed test for reduction on 'sections' directive.
llvm-svn: 236692
2015-05-07 04:09:41 +00:00
Kostya Serebryany 9ba68b3566 fix clang-fuzzer and clang-format-fuzzer
llvm-svn: 236691
2015-05-07 04:01:39 +00:00
Richard Smith d9ba224f66 [modules] Suport for merging a parsed enum definition into an existing imported but not visible definition.
llvm-svn: 236690
2015-05-07 03:54:19 +00:00
Alexey Bataev 69a4779965 [OPENMP] Fixed codegen for 'reduction' clause.
Fixed codegen for reduction operations min, max, && and ||. Codegen for them is quite similar and I was confused by this similarity.
Also added a call to kmpc_end_reduce() in atomic part of reduction codegen (call to kmpc_end_reduce_nowait() is not required).
Differential Revision: http://reviews.llvm.org/D9513

llvm-svn: 236689
2015-05-07 03:54:03 +00:00
Kaelyn Takata fb8cf4087d When performing delayed typo correction in a for-range loop's variable
declaration, ensure the loop variable is properly marked as invalid when
it is an "auto" variable.

llvm-svn: 236682
2015-05-07 00:11:02 +00:00
Peter Collingbourne b2ed4d219b Fix public-private.modulemap test case to clear the cache on every run.
llvm-svn: 236655
2015-05-06 22:31:13 +00:00
Duncan P. N. Exon Smith d6616acb2c CGCXX: Use cast in getAddrOfCXXStructor()
All callers should be passing `CXXConstructorDecl` or
`CXXDestructorDecl` here, so use `cast<>` instead of `dyn_cast<>` when
setting up the `GlobalDecl`.

llvm-svn: 236651
2015-05-06 22:18:39 +00:00
Sergey Matveev ea558e0b33 [docs] Update SanitizerCoverage docs.
llvm-svn: 236641
2015-05-06 21:09:00 +00:00
Daniel Jasper 036181471c clang-format: Don't indent 'signals' as access specifier if it isn't one
Before:
  {
  signals.set(0);
  }

After:
  {
    signals.set(0);
  }

llvm-svn: 236630
2015-05-06 19:21:23 +00:00
Artem Belevich ba558951d8 [driver] Cosmetic change to use Input instead of Inputs[0].
Differential Revision: http://reviews.llvm.org/D9506

llvm-svn: 236621
2015-05-06 18:20:23 +00:00
Reid Kleckner d167d42888 [AArch64] Advertise that the __sync_*_compare_and_swap_1/2/4/8 builtins work
Fixes PR23428, where std::thread in libstdc++ would go haywire without
these defines.

llvm-svn: 236605
2015-05-06 15:31:46 +00:00
Daniel Jasper 1fe0d5ca59 clang-format: Merge labels and subsequent semicolons.
E.g.:

  default:;

This can be used to get around restrictions as to what can follow a
label. It fixes llvm.org/PR19648.

llvm-svn: 236604
2015-05-06 15:19:47 +00:00
Daniel Jasper 112b50e6b6 clang-format: Allow ternary expressions inside template parameters if
the template parameters aren't inside an expression context.

This fixes llvm.org/PR23270.

llvm-svn: 236603
2015-05-06 14:53:50 +00:00
Daniel Jasper e92bf6f141 clang-format: Consider operator precedence as penalty when breaking
before operators.

This fixes llvm.org/23382.

llvm-svn: 236602
2015-05-06 14:23:38 +00:00
Daniel Jasper 04785d0488 clang-format: Accept slightly more record declarations.
This fixes llvm.org/PR23397.

llvm-svn: 236599
2015-05-06 14:03:02 +00:00
Daniel Jasper 2746a308c2 clang-format: Fix bad wrapping of ObjC method exprs.
Before:
  [aaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa:
      aaaaaaaa aaa:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa];

After:
  [aaaaaaaaaaaaaaaaaaaaaaaaa
      aaaaaaaaaaaaaaaaa:aaaaaaaa
                    aaa:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa];

Note that this might now violate the column limit and we probably need an
alternative way of indenting these then. However, that is still strictly better
than the messy formatting that clang-format did before.

llvm-svn: 236598
2015-05-06 13:13:03 +00:00
Daniel Jasper eb53668c35 clang-format: Properly indent method calls without inputs.
Before:
  [aaaaaaaaaaa
          aaaaaaa];

After:
  [aaaaaaaaaaa
      aaaaaaa];

llvm-svn: 236597
2015-05-06 12:48:06 +00:00
Manuel Klimek 24a8f55857 Remove deprecated version of reformat.
llvm-svn: 236594
2015-05-06 12:12:22 +00:00
Daniel Jasper fc510b67fe clang-format: Don't allow -i when reading from stdin.
llvm-svn: 236592
2015-05-06 11:56:54 +00:00
Manuel Klimek 20e0af6b62 Remove all computation of structural errors in clang-format's line parser.
We were already ignoring those already.

llvm-svn: 236591
2015-05-06 11:56:29 +00:00
Daniel Jasper e2408e37db clang-format: Fix another assertion discovered by the fuzzer.
In the process, fix an old todo that I don't really know how to write
tests for. The problem is that Clang's lexer creates very strange token
sequences for these. However, the new approach seems generally better
and easier to read so I am submitting it nonetheless.

llvm-svn: 236589
2015-05-06 11:16:43 +00:00
Daniel Jasper 62c78f5474 clang-format: Prevent assertion discovered by fuzzer.
llvm-svn: 236578
2015-05-06 08:58:57 +00:00
Daniel Jasper 4d9ec17f1e clang-format: Prevent exponential runtime in token annotator.
llvm-svn: 236577
2015-05-06 08:38:24 +00:00
Alexey Bataev f2453a01fb [OPENMP] Fixed messages about predetermined DSA for loop control variables.
llvm-svn: 236574
2015-05-06 07:25:08 +00:00
Daniel Jasper 6d9b88dd99 clang-format: Fix bug in multiline comment wrapping.
Splitting:
  /**
   * multiline block comment
   *
   */

Before:
  /**
   * multiline block
   *comment
   *
   */

After:
  /**
   * multiline block
   * comment
   *
   */

The reason was that the empty line inside the comment (with just the "*") was
confusing the comment breaking logic.

llvm-svn: 236573
2015-05-06 07:17:22 +00:00
Alexey Bataev 1a8b3f1a4e [OPENMP] Fix for http://llvm.org/PR23387: clang fails to compile magick/attribute.c
Allow to use variables with 'register' storage class as loop control variables in OpenMP loop based constructs.

llvm-svn: 236571
2015-05-06 06:34:55 +00:00
Ahmed Bougacha 5191911a57 Revert "[analyzer] scan-build: support spaces in compiler path and arguments."
This reverts commit r236423 and its followup r236533, as indiscriminate
quoting makes for too much quoting (and clang doesn't like both '"-c"'
and -D"FOO=bar").

llvm-svn: 236562
2015-05-06 02:08:27 +00:00
Justin Bogner 6d721fa28c InstrProf: Don't start or end coverage regions inside of system macros
It doesn't make much sense to try to show coverage inside system
macros, and source locations in builtins confuses the coverage
mapping. Just avoid doing this.

Fixes an assert that fired when a __block storage specifier starts a
region.

llvm-svn: 236547
2015-05-05 21:46:14 +00:00
David Majnemer 9f77e90dcc Update testcase to match r236539
llvm-svn: 236542
2015-05-05 20:34:29 +00:00
Anton Yartsev 22f6189fb0 [analyzer] This eliminates regression caused by r236423.
Wrap an argument with quotes only if it has spaces.

llvm-svn: 236533
2015-05-05 19:43:37 +00:00
Ulrich Weigand 5722c0f192 [SystemZ] Add support for z13 low-level vector builtins
This adds low-level builtins to allow access to all of the z13 vector
instructions.  Note that instructions whose semantics can be described
by standard C (including clang extensions) do not get any builtins.

For each instructions whose semantics *cannot* (fully) be described, we
define a builtin named __builtin_s390_<insn> that directly maps to this
instruction.  These are intended to be compatible with GCC.

For instructions that also set the condition code, the builtin will take
an extra argument of type "int *" at the end.  The integer pointed to by
this argument will be set to the post-instruction CC value.

For many instructions, the low-level builtin is mapped to the corresponding
LLVM IR intrinsic.  However, a number of instructions can be represented
in standard LLVM IR without requiring use of a target intrinsic.

Some instructions require immediate integer operands within a certain
range.  Those are verified at the Sema level.

Based on a patch by Richard Sandiford.

llvm-svn: 236532
2015-05-05 19:36:42 +00:00
Ulrich Weigand 66ff51b4ea [SystemZ] Add support for z13 and its vector facility
This patch adds support for the z13 architecture type.  For compatibility
with GCC, a pair of options -mvx / -mno-vx can be used to selectively
enable/disable use of the vector facility.

When the vector facility is present, we default to the new vector ABI.
This is characterized by two major differences:
- Vector types are passed/returned in vector registers
  (except for unnamed arguments of a variable-argument list function).
- Vector types are at most 8-byte aligned.

The reason for the choice of 8-byte vector alignment is that the hardware
is able to efficiently load vectors at 8-byte alignment, and the ABI only
guarantees 8-byte alignment of the stack pointer, so requiring any higher
alignment for vectors would require dynamic stack re-alignment code.

However, for compatibility with old code that may use vector types, when
*not* using the vector facility, the old alignment rules (vector types
are naturally aligned) remain in use.

These alignment rules are not only implemented at the C language level,
but also at the LLVM IR level.  This is done by selecting a different
DataLayout string depending on whether the vector ABI is in effect or not.

Based on a patch by Richard Sandiford.

llvm-svn: 236531
2015-05-05 19:35:52 +00:00
Kaelyn Takata b8499f09fa Allow TransformTypos to ignore corrections to a specified VarDecl.
This is needed to prevent a TypoExpr from being corrected to a variable
when the TypoExpr is a subexpression of that variable's initializer.

Also exclude more keywords from the correction candidate pool when the
subsequent token is .* or ->* since keywords like "new" or "return"
aren't valid on the left side of those operators.

Fixes PR23140.

llvm-svn: 236519
2015-05-05 19:17:03 +00:00
Alexey Bataev c89567979a [OPENMP] Allow use of macros in OpenMP directives/clauses.
llvm-svn: 236493
2015-05-05 09:53:25 +00:00
Alexey Bataev a744ff58f3 [OPENMP] Fixed incorrect work with cleanups, NFC.
Destructors are never called for cleanups, so we can't use SmallVector as a member.
Differential Revision: http://reviews.llvm.org/D9399

llvm-svn: 236491
2015-05-05 09:24:37 +00:00
Alexey Bataev ce348a49b4 Revert revision 236487: [OPENMP] Fixed incorrect work with cleanups, NFC.
llvm-svn: 236490
2015-05-05 08:48:39 +00:00
Daniel Jasper 9326f91922 clang-format: [JS] support optional methods.
Optional methods use ? tokens like this:

  interface X { y?(): z; }

It seems easiest to detect and disambiguate these from ternary
expressions by checking if the code is in a declaration context. Turns
out that that didn't quite work properly for interfaces in Java and JS,
and for JS file root contexts.

Patch by Martin Probst, thank you.

llvm-svn: 236488
2015-05-05 08:40:32 +00:00
Alexey Bataev fc80e26fe6 [OPENMP] Fixed incorrect work with cleanups, NFC.
Destructors are never called for cleanups, so we can't use SmallVector as a member.
Differential Revision: http://reviews.llvm.org/D9399

llvm-svn: 236487
2015-05-05 08:38:22 +00:00
Daniel Jasper 2964749cfa clang-format: [JS] Do not collapse short interfaces.
Patch by Martin Probst.

llvm-svn: 236485
2015-05-05 08:12:50 +00:00
Alexey Bataev 1d526a613d Revert revision 236482: [OPENMP] Fixed incorrect work with cleanups, NFC.
Due to some incompatibilities with Windows.

llvm-svn: 236483
2015-05-05 06:32:45 +00:00
Alexey Bataev 70542831fc [OPENMP] Fixed incorrect work with cleanups, NFC.
Destructors are never called for cleanups, so we can't use SmallVector as a member.
Differential Revision: http://reviews.llvm.org/D9399

llvm-svn: 236482
2015-05-05 06:21:01 +00:00
Alexey Bataev f4497be0bb Revert revision 236480: [OPENMP] Fixed incorrect work with cleanups, NFC.
Due to some incompatibilities with Windows.

llvm-svn: 236481
2015-05-05 04:56:26 +00:00
Alexey Bataev 329731ea75 [OPENMP] Fixed incorrect work with cleanups, NFC.
Destructors are never called for cleanups, so we can't use SmallVector as a member.
Differential Revision: http://reviews.llvm.org/D9399

llvm-svn: 236480
2015-05-05 04:42:07 +00:00
Alexey Bataev 9e03404d8d [OPENMP] Codegen for 'firstprivate' clause in 'task' directive.
For tasks codegen for private/firstprivate variables are different rather than for other directives.

1. Build an internal structure of privates for each private variable:
struct .kmp_privates_t. {
  Ty1 var1;
  ...
  Tyn varn;
};
2. Add a new field to kmp_task_t type with list of privates.
struct kmp_task_t {
  void *              shareds;
  kmp_routine_entry_t routine;
  kmp_int32           part_id;
  kmp_routine_entry_t destructors;
  .kmp_privates_t.    privates;
};
3. Create a function with destructors calls for all privates after end of task region.
kmp_int32 .omp_task_destructor.(kmp_int32 gtid, kmp_task_t *tt) {
  ~Destructor(&tt->privates.var1);
  ...
  ~Destructor(&tt->privates.varn);
  return 0;
}
4. Perform initialization of all firstprivate fields (by simple copying for POD data, copy constructor calls for classes) + provide address of a destructor function after kmpc_omp_task_alloc() and before kmpc_omp_task() calls.
kmp_task_t *new_task = __kmpc_omp_task_alloc(ident_t *, kmp_int32 gtid, kmp_int32 flags, size_t sizeof_kmp_task_t, size_t sizeof_shareds, kmp_routine_entry_t *task_entry);

CopyConstructor(new_task->privates.var1, *new_task->shareds.var1_ref);
new_task->shareds.var1_ref = &new_task->privates.var1;
...
CopyConstructor(new_task->privates.varn, *new_task->shareds.varn_ref);
new_task->shareds.varn_ref = &new_task->privates.varn;

new_task->destructors = .omp_task_destructor.;
kmp_int32 __kmpc_omp_task(ident_t *, kmp_int32 gtid, kmp_task_t *new_task)
Differential Revision: http://reviews.llvm.org/D9370

llvm-svn: 236479
2015-05-05 04:05:12 +00:00
David Majnemer e48630fc7c [MS ABI] Cleanup selectBasePath
Handle some common cases quickly when deeper introspection into the path
has no effect on the final result.

No functional change intended.

llvm-svn: 236475
2015-05-05 01:39:20 +00:00
Kostya Serebryany 6c2479bee4 Fix buffer overflow in Lexer
Summary:
Fix PR22407, where the Lexer overflows the buffer when parsing
 #include<\
(end of file after slash)

Test Plan:
Added a test that will trigger in asan build.
This case is also covered by the clang-fuzzer bot.

Reviewers: rnk

Reviewed By: rnk

Subscribers: cfe-commits

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

llvm-svn: 236466
2015-05-04 22:30:29 +00:00
Kostya Serebryany 7862b01a63 [clang-fuzzer] make clang-fuzzer slightly faster by removing one redundant directory scan
llvm-svn: 236459
2015-05-04 21:14:45 +00:00
Reid Kleckner bc24c6ca76 Update MSVC compatibility doc note about exceptions
llvm-svn: 236458
2015-05-04 20:53:51 +00:00
Richard Smith d6e8c0d436 [modules] Don't bother registering loaded macros if there are none.
We don't yet have a reduced testcase for this.

llvm-svn: 236454
2015-05-04 19:58:00 +00:00
Jan Vesely eebeaea0ab R600: Add fma and ldexp asic specific feature macros
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 236453
2015-05-04 19:53:36 +00:00
David Majnemer ab1309252c [MS ABI] Fix a crash in vptr path calculation
I discovered a case where the old algorithm would crash.  Instead of
trying to patch the algorithm, rewrite it.  The new algorithm operates
in three phases:
1. Find all paths to the subobject with the vptr.
2. Remove paths which are subsets of other paths.
3. Select the best path where 'best' is defined as introducing the most
   covariant overriders.  If two paths introduce different overriders,
   raise a diagnostic.

llvm-svn: 236444
2015-05-04 18:47:54 +00:00
Serge Pavlov 34b14df4d4 Get rid of compiler warning.
llvm-svn: 236431
2015-05-04 17:39:55 +00:00
Serge Pavlov 4c51174677 Instantiate incomplete class used in template method.
If a class is absent from instantiation and is incomplete, instantiate it as
an incomplete class thus avoiding compiler crash.

This change fixes PR18653.

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

llvm-svn: 236426
2015-05-04 16:44:39 +00:00
Duncan P. N. Exon Smith 4a8212a488 Reapply "Frontend: Stop leaking when not -disable-free"
This reverts commit r236422, effectively reapplying r236419.  ASan
helped me diagnose the problem: the non-leaking logic would free the
ASTConsumer before freeing Sema whenever `isCurrentASTFile()`, causing a
use-after-free in `Sema::~Sema()`.

This version unconditionally frees Sema and the ASTContext before
freeing the ASTConsumer.  Without the fix, these were either being freed
before the ASTConsumer was freed or leaked after, but they were always
spiritually released so this isn't really a functionality change.

I ran all of check-clang with ASan locally this time, so I'm hoping
there aren't any more problems lurking.

Original commit message:

    Try again to plug a leak that's been around since at least r128011
    after coming across the FIXME.  Nico Weber tried something similar
    in r207065 but had to revert in r207070 due to a bot failure.

    The build failure isn't visible anymore so I'm not sure what went
    wrong.  I'm doing this slightly differently -- when not
    -disable-free I'm still resetting the members (just not leaking
    them) -- so maybe it will work out this time?  Tests pass locally,
    anyway.

llvm-svn: 236424
2015-05-04 14:59:20 +00:00
Anton Yartsev c312ef1d17 [analyzer] scan-build: support spaces in compiler path and arguments.
This fixes errors that occur if a path to the default compiler has spaces or if an argument with spaces is given to compiler (e.g. via -I). (http://reviews.llvm.org/D9357)

llvm-svn: 236423
2015-05-04 13:37:36 +00:00