Commit Graph

33040 Commits

Author SHA1 Message Date
Daniel Jasper 97da9178ce Allow a header to be part of multiple modules.
This patch changes two things:

a) Allow a header to be part of multiple modules. The reasoning is that
in existing codebases that have a module-like build system, the same
headers might be used in several build targets. Simple reasons might be
that they defined different classes that are declared in the same
header. Supporting a header as a part of multiple modules will make the
transistion easier for those cases. A later step in clang can then
determine whether the two modules are actually compatible and can be
merged and error out appropriately. The later check is similar to what
needs to be done for template specializations anyway.

b) Allow modules to be stored in a directory tree separate from the
headers they describe.

Review: http://llvm-reviews.chandlerc.com/D1951
llvm-svn: 193151
2013-10-22 08:09:47 +00:00
David Majnemer 766e259e38 Sema: Do not allow template declarations inside local classes
Summary:
Enforce the rule in C++11 [temp.mem]p2 that local classes cannot have
member templates.

This fixes PR16947.

N.B.  C++14 has slightly different wording to afford generic lambdas
declared inside of functions.

Fun fact:  Some formulations of local classes with member templates
would cause clang to crash during Itanium mangling, such as the
following:

void outer_mem() {
  struct Inner {
    template <typename = void>
    struct InnerTemplateClass {
      static void itc_mem() {}
    };
  };
  Inner::InnerTemplateClass<>::itc_mem();
}

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

Reviewed By: doug.gregor

CC: cfe-commits, ygao

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

llvm-svn: 193144
2013-10-22 04:14:18 +00:00
Reid Kleckner 9171f02528 Revert "Refactor DynTypedMatcher into a value type class, just like Matcher<T>."
This reverts commit r193100.

It was failing to compile with MSVC 2012 while instantiating
llvm::Optional<DynTypedMatcher>.

llvm-svn: 193123
2013-10-21 22:26:36 +00:00
Yaron Keren 9fb7e9065f Fix string assignment, David Blaikie suggestion.
llvm-svn: 193116
2013-10-21 20:07:37 +00:00
Samuel Benzaquen f46e5f1c9a Refactor DynTypedMatcher into a value type class, just like Matcher<T>.
Summary:
Refactor DynTypedMatcher into a value type class, just like Matcher<T>.
This simplifies its usage and removes the virtual hierarchy from Matcher<T>.
It also enables planned changes to replace MatcherInteface<T>.
Too many instantiaions of this class hierarchy has been causing Registry.cpp.o to bloat in size and number of symbols.

Reviewers: klimek

CC: cfe-commits, revane

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

llvm-svn: 193100
2013-10-21 18:40:51 +00:00
Benjamin Kramer b2ccade343 Driver: Various string-related cleanups.
Also fixes some funky formatting.

llvm-svn: 193079
2013-10-21 12:33:55 +00:00
Silviu Baranga e5690463e2 Set the default hardware division features for ARM cpus. Also set it as default for A32 armv8.
llvm-svn: 193075
2013-10-21 10:59:33 +00:00
Silviu Baranga f9671dd09d Add the __ARM_ARCH_EXT_IDIV__ predefine. It is set to 1 if we have hardware divide in the mode that we are compiling in (depending on the target features), not defined if we don't. Should be compatible with the GCC conterpart. Also adding a -hwdiv option to overide the default behavior.
llvm-svn: 193074
2013-10-21 10:54:53 +00:00
Serge Pavlov 6652921d5a Fix to PR8880 (clang dies processing a for loop).
Due to statement expressions supported as GCC extension, it is possible
to put 'break' or 'continue' into a loop/switch statement but outside its
body, for example:

    for ( ; ({ if (first) { first = 0; continue; } 0; }); )

Such usage must be diagnosed as an error, GCC rejects it. To recognize
this and similar patterns the flags BreakScope and ContinueScope are
temporarily turned off while parsing condition expression.

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

llvm-svn: 193073
2013-10-21 09:34:44 +00:00
Manuel Klimek 88033d7a97 Fixes PR17617: Crash on joining short if statements.
Now that we iterate on the formatting multiple times when we
have chains of preprocessor branches, we need to correctly reset
the token's previous and next pointer for the first / last token.

llvm-svn: 193071
2013-10-21 08:11:15 +00:00
Daniel Jasper ac42b75195 Expose -fmodule-name and -fmodule-map-file as driver options.
Review: http://llvm-reviews.chandlerc.com/D1974
llvm-svn: 193069
2013-10-21 06:34:34 +00:00
Justin Bogner 5353513058 Lex: Don't restrict legal UCNs when preprocessing assembly
The C and C++ standards disallow using universal character names to
refer to some characters, such as basic ascii and control characters,
so we reject these sequences in the lexer. However, when the
preprocessor isn't being used on C or C++, it doesn't make sense to
apply these restrictions.

Notably, accepting these characters avoids issues with unicode escapes
when GHC uses the compiler as a preprocessor on haskell sources.

Fixes rdar://problem/14742289

llvm-svn: 193067
2013-10-21 05:02:28 +00:00
David Majnemer 2b2512141f Sema: Explain our deviation from the standard by referencing the, now open, LWG issue.
llvm-svn: 193062
2013-10-21 00:25:32 +00:00
Peter Collingbourne b453cd64a7 Implement function type checker for the undefined behavior sanitizer.
This uses function prefix data to store function type information at the
function pointer.

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

llvm-svn: 193058
2013-10-20 21:29:19 +00:00
Peter Collingbourne f7ef3fd810 Revert r193022 and r193048. They broke the ubsan test suite.
llvm-svn: 193057
2013-10-20 21:29:13 +00:00
Alp Toker 67b47ac0a7 Fix crash in cleanup attr handling
ResolveSingleFunctionTemplateSpecialization() returns 0 and doesn't emit diags
unless the expression has template-ids, so we must null check the result.

Also add a better diag noting which overloads are causing the problem.

Reviewed by Aaron Ballman.

llvm-svn: 193055
2013-10-20 18:48:56 +00:00
Daniel Jasper d46e07e26e clang-format: Better understand Lambda poarameters.
Before:
  auto PointerBinding = [](const char * S) {};

After:
  auto PointerBinding = [](const char *S) {};

This fixes llvm.org/PR17618.

llvm-svn: 193054
2013-10-20 18:15:30 +00:00
Daniel Jasper dcd5da1fd9 clang-format: Fix formatting of nested blocks after comment.
Before:
  DEBUG({ // Comment that used to confuse clang-format.
  fdafas();
  });
Before:
  DEBUG({ // Comments are now fine.
    fdafas();
  });

This fixed llvm.org/PR17619.

llvm-svn: 193051
2013-10-20 17:28:32 +00:00
Daniel Jasper 2d0cd49787 clang-format: Support case ranges.
Before (note the missing space before "..." which can lead to compile
errors):
  switch (x) {
    case 'A'... 'Z':
    case 1... 5:
        break;
  }

After:
  switch (x) {
    case 'A' ... 'Z':
    case 1 ... 5:
        break;
  }

llvm-svn: 193050
2013-10-20 16:56:16 +00:00
Daniel Jasper d489dd342b clang-format: Improve formatting of ObjC dict literals.
Before:
  NSDictionary *d = @{ @"nam" : NSUserNam(), @"dte" : [NSDate date],
                       @"processInfo" : [NSProcessInfo processInfo]
  };

After:
  NSDictionary *d = @{
    @"nam" : NSUserNam(),
    @"dte" : [NSDate date],
    @"processInfo" : [NSProcessInfo processInfo]
  };

llvm-svn: 193049
2013-10-20 16:45:46 +00:00
Benjamin Kramer 80b5a9d2d0 Driver: libubsan_cxx depends on libubsan. Preserve the topological ordering, some linkers depend on it.
llvm-svn: 193048
2013-10-20 12:34:18 +00:00
Benjamin Kramer 1d5d634c82 Forgot some references to misspelled enums.
llvm-svn: 193047
2013-10-20 11:53:20 +00:00
Benjamin Kramer 2501f14197 Miscellaneous speling fixes.
llvm-svn: 193046
2013-10-20 11:47:15 +00:00
David Majnemer ad51f1bc70 Sema: Diagnose global replacement functions declared as inline
This fixes PR17591.

N.B. This actually goes beyond what the standard mandates by requiring
the restriction to hold for declarations instead of definitions.  This
is believed to be a defect in the standard and an LWG issue has been
submitted.

llvm-svn: 193044
2013-10-20 05:40:29 +00:00
Rafael Espindola 7b56f6c3c2 Simplify some implementations of get*Decl.
* NamedDecl and CXXMethodDecl were missing getMostRecentDecl.
* The const version can just forward to the non const.
* getMostRecentDecl can use cast instead of cast_or_null.

This then removes some casts from the callers.

llvm-svn: 193039
2013-10-19 16:55:03 +00:00
Rafael Espindola cb444fe739 Reduce indentation with an early exit.
llvm-svn: 193028
2013-10-19 02:28:17 +00:00
Rafael Espindola 3f9e4442c8 Add isFirstDecl to DecBase too and use it instead of getPreviousDecl() == 0.
Redeclarable already had a isFirstDecl, but it was missing from DeclBase.

llvm-svn: 193027
2013-10-19 02:13:21 +00:00
Rafael Espindola 0d3da83c12 Fix typo.
llvm-svn: 193026
2013-10-19 02:06:23 +00:00
Rafael Espindola 4450301eaf Simplify FunctionDecl::getBody.
llvm-svn: 193025
2013-10-19 01:37:17 +00:00
Nick Lewycky 2492169aee When building ubsan, link in ubsan parts first and sanitizer-common second, to
pick up the common bits ubsan actually needs. Also remove whole-archive when we
aren't trying to re-export the symbols.

llvm-svn: 193022
2013-10-19 00:27:23 +00:00
Kaelyn Uhrain 8aa8da85ca Allow CorrectTypo to replace CXXScopeSpecifiers that refer to classes.
Now that CorrectTypo knows how to correctly search classes for typo
correction candidates, there is no good reason to only replace an
existing CXXScopeSpecifier if it refers to a namespace. While the actual
enablement was a matter of changing a single comparison, the fallout
from enabling the functionality required a lot more code changes
(including my two previous commits).

llvm-svn: 193020
2013-10-19 00:05:00 +00:00
Kaelyn Uhrain f7b63e3e18 Be smarter about deciding to add a leading '::' to a
NestedNameSpecifier that replaces an existing specifier.

llvm-svn: 193019
2013-10-19 00:04:52 +00:00
Kaelyn Uhrain 5315a4631b Merge NamespaceSpecifierSet's AddNamespace and AddRecord as they are
essentially the same.

llvm-svn: 193018
2013-10-19 00:04:49 +00:00
DeLesley Hutchins 8121866bdb Consumed analysis: fix assert failure.
llvm-svn: 193010
2013-10-18 23:11:49 +00:00
Hans Wennborg 9c1659b5b7 clang-cl: diagnose setting asm listing filename with multiple inputs
llvm-svn: 193006
2013-10-18 22:49:04 +00:00
Richard Smith 92304e0013 Fix crash if a submodule @imports another submodule from the same module. The
test also adds FIXMEs for a number of places where imports and includes of
submodules don't work very well.

llvm-svn: 193005
2013-10-18 22:48:20 +00:00
Fariborz Jahanian 4ba4a5b02e ObjectiveC. Added support for methods annotated with format_arg
attributes when such methods are actually envoked in message
expression. // rdar://15242010

llvm-svn: 193003
2013-10-18 21:20:34 +00:00
Ariel J. Bernal 3255134ac5 Reverted r192992 broke windows and freebsd builds.
llvm-svn: 192997
2013-10-18 19:48:31 +00:00
DeLesley Hutchins 0bd25897ef Consumed analysis: assume that non-const reference parameters are initially
in the "uknown" state.  Patch by chris.wailes@gmail.com.  Reviewed by delesley.

llvm-svn: 192995
2013-10-18 19:25:18 +00:00
Ariel J. Bernal 4dc53c20fc This patch fixes replacements that are not applied when relative paths are
specified.

In particular it makes sure that  relative paths for non-virtual files aren't
made absolute.
Added unittest.

llvm-svn: 192992
2013-10-18 18:38:24 +00:00
DeLesley Hutchins 11a66c1240 Consumed analysis: All the return_typestate parameter to be attached to the
default constructor.  Patch by chris.wailes@gmail.com, reviewed by delesley.

llvm-svn: 192991
2013-10-18 18:36:21 +00:00
Daniel Jasper fbc057ea73 clang-format: Be more aggressive on incorrect code.
Before, clang-format would not adjust leading indents if it found a
structural error (e.g. unmatched {}). It seems, however, that
clang-format has gotten good enough at parsing the code structure that
this hurts in almost all cases. Commonly, while writing code, it is
very useful to be able to correclty indent incomplete if statements or
for loops.

In case this leads to errors that we don't anticipate, we need to find
out and fix those.

This fixed llvm.org/PR17594.

llvm-svn: 192988
2013-10-18 17:20:57 +00:00
Daniel Jasper 2436fe95ea clang-format: Don't force linebreak between return and multiline string.
This looks ugly and leads to llvm.org/PR17590.

Before (with AlwaysBreakBeforeMultilineStrings):
  return
      "aaaa"
      "bbbb";

After:
  return "aaaa"
         "bbbb";

llvm-svn: 192984
2013-10-18 16:47:55 +00:00
Daniel Jasper d8c36d09b1 Make clang-format slightly more willing to break before trailing annotations.
Specifically, prefer breaking before trailing annotations over breaking
before the first parameter.

Before:
  void ffffffffffffffffffffffff(
      int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) OVERRIDE;

After:
  void ffffffffffffffffffffffff(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
                                int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
      OVERRIDE;

llvm-svn: 192983
2013-10-18 16:34:40 +00:00
Hans Wennborg 5a366fb4dc Add another MinGW header include path
llvm-svn: 192982
2013-10-18 15:48:58 +00:00
Daniel Jasper cc3114d876 clang-format: Improve formatting of templated builder-type calls.
Before:
  aaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaa().aaaaaaaaaaaaaaaaa().has<
      bbbbbbbbbbbbbbbbbbbbb>();

After:
  aaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaa()
      .aaaaaaaaaaaaaaaaaaaaaaaaaa()
      .has<bbbbbbbbbbbbbbbbbbbbb>();

llvm-svn: 192981
2013-10-18 15:23:06 +00:00
Chad Rosier 3c03dee1d1 [AArch64] Add support for NEON scalar extract narrow instructions.
llvm-svn: 192971
2013-10-18 14:03:36 +00:00
Simon Atanasyan 2c97a81e81 [Mips] Define __mips_fpr and _MIPS_FPSET macros.
llvm-svn: 192969
2013-10-18 13:13:53 +00:00
Daniel Jasper 6633ab8ad9 clang-format: Make continuation indent width configurable.
Patch by Kim Gräsman. Thank you!

llvm-svn: 192964
2013-10-18 10:38:14 +00:00
Richard Smith 3d8e97eda2 C++ modules: don't lose track of a 'namespace std' that is imported from a module.
llvm-svn: 192951
2013-10-18 06:54:39 +00:00
Richard Smith 2b9e3e396a Basic ODR checking for C++ modules:
If we have multiple definitions of the same entity from different modules, we
nominate the first definition which we see as being the canonical definition.
If we load a declaration from a different definition and we can't find a
corresponding declaration in the canonical definition, issue a diagnostic.

This is insufficient to prevent things from going horribly wrong in all cases
-- we might be in the middle of emitting IR for a function when we trigger some
deserialization and discover that it refers to an incoherent piece of the AST,
by which point it's probably too late to bail out -- but we'll at least produce
a diagnostic.

llvm-svn: 192950
2013-10-18 06:05:18 +00:00
Alp Toker 19bff32e09 Check "late parsed" friend functions for redefinition
r177003 applied the late parsed template technique to friend functions
but omitted the corresponding check for redefinitions.

This patch adds the same check already in use for templates to the
new code path in order to diagnose and reject invalid redefinitions
that were being silently accepted.

Fixes PR17324.

Reviewed by Richard Smith.

llvm-svn: 192948
2013-10-18 05:54:24 +00:00
Alp Toker ae3a944a6e Fix missed exception spec checks and crashes
Delayed exception specification checking for defaulted members and virtual
destructors are both susceptible to mutation during iteration so we need to
swap and process the worklists.

This resolves both accepts-invalid and rejects-valid issues and moreover fixes
potential invalid memory access as the contents of the vectors change during
iteration and recursive template instantiation.

Checking can be further delayed where parent classes aren't yet fully defined.
This patch adds two assertions at end of TU to ensure no specs are left
unchecked as was happenning before the fix, plus a test case from Marshall Clow
for the defaulted member crash extracted from the libcxx headers.

Reviewed by Richard Smith.

llvm-svn: 192947
2013-10-18 05:54:19 +00:00
Richard Smith 77c5bb5e4a Fix 80-column violation.
llvm-svn: 192937
2013-10-18 01:34:56 +00:00
David Majnemer a543308ce5 [-fms-extensions] Permit 'override' in C++98 and 'sealed' as a synonym for 'final'
Summary: Some MS headers use these features.

Reviewers: rnk, rsmith

CC: cfe-commits

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

llvm-svn: 192936
2013-10-18 00:33:31 +00:00
DeLesley Hutchins 6939177cea Consumed analysis: Add param_typestate attribute, which specifies that
function parameters must be in a particular state.  Patch by
chris.wailes@gmail.com.  Reviewed by delesley@google.com.

llvm-svn: 192934
2013-10-17 23:23:53 +00:00
Fariborz Jahanian 403425bba8 ObjectiveC migrator. Minor clean up of my last patch.
No functional change.

llvm-svn: 192933
2013-10-17 23:13:13 +00:00
DeLesley Hutchins 36ea1dd4fc Consumed Analysis: Allow parameters that are passed by non-const reference
to be treated as return values, and marked with the "returned_typestate"
attribute.  Patch by chris.wailes@gmail.com; reviewed by delesley@google.com.

llvm-svn: 192932
2013-10-17 22:53:04 +00:00
Fariborz Jahanian de79e81686 ObjectiveC migrator. In infering NS_ENUM/NS_OPTIONS
macros, prefer the typedef immediately following the
enum declaration to the one preceeding it.
// rdar://15200915

llvm-svn: 192927
2013-10-17 22:23:32 +00:00
Reid Kleckner 5a823d5f05 [ms-cxxabi] Error out on virtual function memptrs
These are uncommon and this is better than miscompiling.

llvm-svn: 192923
2013-10-17 21:30:27 +00:00
Alp Toker be2a55f5ac Revert "Fix missed exception spec checks and crashes"
The changes caused the sanitizer bot to hang:
  http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/2311

Needs investigation.

This reverts commit r192914.

llvm-svn: 192921
2013-10-17 21:00:19 +00:00
Hans Wennborg cd2672c9b4 Make .asm a valid extension for assembly files
This is a common extension on Windows, and now clang will assemble them
instead of treating them as linker input which is the default for unknown
file types.

llvm-svn: 192919
2013-10-17 20:41:18 +00:00
Alp Toker de0be6232b Fix missed exception spec checks and crashes
Delayed exception specification checking for defaulted members and virtual
destructors are both susceptible to mutation during iteration so we need to
process the worklists fully.

This resolves both accepts-invalid and rejects-valid issues and moreover fixes
potential invalid memory access as the contents of the vectors change during
iteration and recursive template instantiation.

This patch also adds two assertions at end of TU to ensure no specs are left
unchecked as was happenning before the fix, plus a test case from Marshall Clow
for the defaulted member crash extracted from the libcxx headers.

Reviewed by Richard Smith.

llvm-svn: 192914
2013-10-17 19:12:03 +00:00
DeLesley Hutchins 6501320e72 Consumed analysis: fix ICE in handling of loop source locations.
llvm-svn: 192911
2013-10-17 18:19:31 +00:00
Chad Rosier e7465644c6 [AArch64] Add support for NEON scalar three register different instruction
class.  The instruction class includes the signed saturating doubling
multiply-add long, signed saturating doubling multiply-subtract long, and
the signed saturating doubling multiply long instructions.

llvm-svn: 192909
2013-10-17 18:12:50 +00:00
Hans Wennborg 2c21f74f02 clang-cl: Add support for asm listings (/FA and /Fa)
This adds support for outputing the assembly to a file during compilation.
It does this by changing the compilation pipeling to not use the integrated
assembler, and keep the intermediate assembler file.

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

llvm-svn: 192902
2013-10-17 16:16:23 +00:00
Rafael Espindola 8db352d532 Rename some functions for consistency.
Every other function in Redeclarable.h was using Decl instead of Declaration.

llvm-svn: 192900
2013-10-17 15:37:26 +00:00
Daniel Sanders 9469417064 [mips] Added -mfp64 and -mfp32 options.
These options specify 64-bit FP registers and 32-bit FP registers respectively.

When using -mfp32, the FPU has 16x double-precision registers overlapping with
the 32x single-precision registers (each double-precision register overlaps
two single-precision registers).

When using -mfp64, the FPU has 32x double-precision registers overlapping with
the 32x single-precision registers (each double-precision register overlaps
with one single-precision register and has an additional 32-bits).

MSA requires -mfp64.

llvm-svn: 192899
2013-10-17 14:55:58 +00:00
Timur Iskhodzhanov 406a479ddb Follow-up to r192822: fix Clang assertion when building with -fexceptions
llvm-svn: 192875
2013-10-17 09:11:45 +00:00
Eric Christopher 9e6f5f9ac7 Add the context that a function was created in as the context for the
function, not the context of the context.

llvm-svn: 192862
2013-10-17 01:31:21 +00:00
Reid Kleckner 00d33a5cb1 Add implementations of the MSVC barrier intrinsics
Summary:
These are deprecated in VS 2012 according to MSDN.  They don't actually
compile down to any code.  They prevent the compiler from reordering
memory accesses across the barrier, which is what a memory-clobbering
volatile asm does.

Reviewers: echristo

CC: cfe-commits

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

llvm-svn: 192860
2013-10-17 01:29:48 +00:00
Fariborz Jahanian 1b6678767d ObjectiveC migrator. Remove blank lines
when inferring property from setter/getter
methods. // rdar://15200949

llvm-svn: 192853
2013-10-16 22:35:19 +00:00
Eric Christopher 3ff21b3195 Rename HandleTargetFeatures->handleTargetFeatures to match
everything else in the class.

llvm-svn: 192851
2013-10-16 21:26:26 +00:00
Eric Christopher 2fe3b4a490 Add preprocessor support for powerpc vsx.
The test should be expanded upon for more powerpc checking.

llvm-svn: 192849
2013-10-16 21:19:26 +00:00
Eric Christopher c04fe09c1d Fix comments.
llvm-svn: 192847
2013-10-16 21:19:19 +00:00
Richard Smith 9a00bbfa4c PR17592: Ensure we diagnose shadowing a template parameter with a local extern
declaration.

llvm-svn: 192846
2013-10-16 21:12:00 +00:00
Chad Rosier 00eef17dbe [AArch64] Add support for NEON scalar negate instruction.
llvm-svn: 192845
2013-10-16 21:04:53 +00:00
Chad Rosier e904137c01 [AArch64] Add support for NEON scalar absolute value instruction.
llvm-svn: 192844
2013-10-16 21:04:49 +00:00
Fariborz Jahanian 78bff0505e ObjectiveC migrator. Don't add 'assign' for
inferred properties when type is scalar and
assumed to be 'assign. // rdar://15231241

llvm-svn: 192841
2013-10-16 20:44:26 +00:00
Eric Christopher 643bb6a176 Rework ppc options handling into a features group.
This should have no functional behavior.

llvm-svn: 192838
2013-10-16 20:40:08 +00:00
Fariborz Jahanian 4a8865b145 ObjectiveC migrator. 'atomic' is the default attribute.
Don't add it to inferred property. // rdar://14988132

llvm-svn: 192834
2013-10-16 19:48:23 +00:00
Rafael Espindola 3bfa4688ef Emit a .ident saying that clang produced this file.
Patch by Katya Romanova.

llvm-svn: 192832
2013-10-16 19:28:50 +00:00
Yunzhong Gao 6108936fa6 Enabling 3DNow! prefetch instruction support for a few AMD processors in the
clang front end. This change will allow the __PRFCHW__ macro to be set on these
processors and hence include prfchwintrin.h in x86intrin.h header. Support for
the intrinsic itself seems to have already been added in r178041.

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

llvm-svn: 192829
2013-10-16 19:07:02 +00:00
Fariborz Jahanian 33304e3087 ObjectiveC migrator. Use 'assign' for 'delegate'
properties. // rdar://15231860

llvm-svn: 192826
2013-10-16 18:52:17 +00:00
Timur Iskhodzhanov 62082b7e0b [-cxx-abi microsoft] Fix this argument/parameter offsets for virtual destructors in the presence of virtual bases
Reviewed at http://llvm-reviews.chandlerc.com/D1939

llvm-svn: 192822
2013-10-16 18:24:06 +00:00
Fariborz Jahanian 2eaec611ac ObjectiveC++: support for passing C++11 style initialized temporaries to
objc++ properties using property-dot syntax.
// rdar://14654207

llvm-svn: 192819
2013-10-16 17:51:43 +00:00
Jordan Rose ac07c8dae7 [analyzer] Don't draw edges to C++11 in-class member initializers.
Since these aren't lexically in the constructor, drawing arrows would
be a horrible jump across the body of the class. We could still do
better here by skipping over unimportant initializers, but this at least
keeps everything within the body of the constructor.

<rdar://problem/14960554>

llvm-svn: 192818
2013-10-16 17:45:35 +00:00
Benjamin Kramer 34cb04393a Driver: Factor duplicated code.
llvm-svn: 192817
2013-10-16 17:42:39 +00:00
Akira Hatanaka 3764e6c112 [mips] Enable frame-pointer elimination for -O1 and above.
llvm-svn: 192815
2013-10-16 17:13:08 +00:00
Chad Rosier 2681b3fb61 Update comment.
llvm-svn: 192807
2013-10-16 16:30:39 +00:00
Benjamin Kramer 9940a5df86 Sema: Simplify the check if a method returns an instance of the class.
Just checking if the parent of the method is the same as the return type
should be sufficient. Also fixes PR17587.

llvm-svn: 192802
2013-10-16 16:21:04 +00:00
Chad Rosier 069b90463d [AArch64] Add support for NEON scalar signed saturating accumulated of unsigned
value and unsigned saturating accumulate of signed value instructions.

llvm-svn: 192801
2013-10-16 16:09:16 +00:00
Rafael Espindola 002667c32b On 32 bit windows, mangle stdcall and fastcall decls in clang.
This removes the dependency on the llvm mangler doing it for us. In isolation,
the benefit is that the testing of what mangling is applied is all in one place:
(C, C++) X (Itanium, Microsoft) are all handled by clang.

This also gives me hope that in the future the llvm mangler (and llvm-ar) will
not depend on TargetMachine.

llvm-svn: 192762
2013-10-16 01:40:34 +00:00
Richard Smith 01a7337c6d C++ modules: merging for enumerations and enumerators with multiple definitions
(eg through template instantiations in multiple modules).

llvm-svn: 192740
2013-10-15 22:02:41 +00:00
Richard Smith 71bec06c36 Teach the AST dumper to dump the canonical declaration for a mergeable declaration.
llvm-svn: 192739
2013-10-15 21:58:30 +00:00
Eric Christopher 07429ffce5 Reflow slightly.
llvm-svn: 192736
2013-10-15 21:22:34 +00:00
Chad Rosier a70fb7b716 [AArch64] Add support for NEON scalar signed saturating absolute value and
scalar signed saturating negate instructions.

llvm-svn: 192734
2013-10-15 21:19:02 +00:00
Richard Smith ea3019d23a Add constant evaluation support for __builtin_isinf, __builtin_isfinite,
__builtin_isnan, and __builtin_isnormal. Patch by Karthik Bhat! Tests by me.

llvm-svn: 192729
2013-10-15 19:07:14 +00:00
Reid Kleckner 916ac4d233 ms-compat: Fix taking the address of a member of a dependent base
If unqualified id lookup fails while parsing a class template with a
dependent base, clang with -fms-compatibility will pretend the user
prefixed the name with 'this->' in order to delay the lookup.  However,
if there was a unary ampersand, Sema::ActOnDependentIdExpression() will
create a DependentDeclRefExpr, which is not what we wanted at all.  Fix
this by building the CXXDependentScopeMemberExpr directly instead.

In order to be fully MSVC compatible, we would have to defer all
attempts at name lookup to instantiation time.  However, until we have
real problems with system headers that can't be parsed, we'll put off
implementing that.

Fixes PR16014.

Reviewers: rsmith

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

llvm-svn: 192727
2013-10-15 18:38:02 +00:00
Argyrios Kyrtzidis ca5c7be088 [libclang] For an unscoped enum include the enumerators in the top-level code-completion hash since they enter the top-level namespace.
rdar://14703327

llvm-svn: 192720
2013-10-15 17:37:55 +00:00
Fariborz Jahanian daf4831868 ObjectiveC driver. Scrap -fno-objc-legacy-dispatch for NeXT
runtime. It will be silently ignored and regardless
of deployment target. // rdar://14803286

llvm-svn: 192719
2013-10-15 17:16:30 +00:00
Serge Pavlov e8ae13f79c Fixed code style of my change.
llvm-svn: 192708
2013-10-15 14:24:32 +00:00
David Majnemer 5f7efefe66 Sema: Cleanup formatting of C++ exceptions related code
No functional change.

llvm-svn: 192684
2013-10-15 09:50:08 +00:00
David Majnemer fad8f48cf3 Sema: Cleanup formatting of SEH related code
No functional change.

llvm-svn: 192683
2013-10-15 09:33:02 +00:00
David Majnemer 7e75550fa1 Sema: Don't crash when __try/__except/__finally appears in a template function
We wouldn't transform the compound statement in any of these forms,
causing crashes when it got time to act on them.  Additionally, we
wouldn't check to see if the handler was invalid before deciding whether
or not we should continue acting on the __try.

This fixes PR17584.

llvm-svn: 192682
2013-10-15 09:30:14 +00:00
David Majnemer ff17f83673 Sema: Consider it an error to apply __builtin_offsetof to a member in a virtual base
icc 13 and g++ 4.9 both reject this while we would crash.

Fixes PR17578.

llvm-svn: 192674
2013-10-15 06:28:23 +00:00
Ted Kremenek da2f405b09 Special case '%C' handling in ObjC format strings to handle integer literals that can represent unicode characters
Fixes <rdar://problem/13991617>.

llvm-svn: 192673
2013-10-15 05:25:17 +00:00
Richard Smith e952106164 Correctly skip type sugar when determining the width of an enum type. Derived
from a patch by Justin Bogner.

llvm-svn: 192671
2013-10-15 04:56:17 +00:00
Richard Smith c2c8bb8209 Tidy up and improve error recovery for C++11 attributes in bad places. Based on
a patch by Michael Han.

llvm-svn: 192666
2013-10-15 01:34:54 +00:00
Reid Kleckner aec4409174 [ms-cxxabi] Fix assert in unspecified inheritance memptr emission
If a class is using the unspecified inheritance model for member
pointers and later we find the class is defined to use single
inheritance, zero out the vbptr offset field of the member pointer when
it is formed.

llvm-svn: 192664
2013-10-15 01:18:02 +00:00
Fariborz Jahanian 059e05eeef ObjectiveC migrator: Support for more possibility of
migration to NS_ENUM/NS_OPTIONS macros; when
typedef'ed to NSInteger/NSUInteger preceeds well
before of the enum declaration. // rdar://15201056

llvm-svn: 192645
2013-10-15 00:00:28 +00:00
Richard Smith fb8b7b9a1c PR17567: Improve diagnostic for a mistyped constructor name. If we see something
that looks like a function declaration, except that it's missing a return type,
try typo-correcting it to the relevant constructor name.

In passing, fix a bug where the missing-type-specifier recovery codepath would
drop a preceding scope specifier on the floor, leading to follow-on diagnostics
and incorrect recovery for the auto-in-c++98 hack.

llvm-svn: 192644
2013-10-15 00:00:26 +00:00
Ted Kremenek b0cba4ce75 Add has_feature support for reflecting the presence of refined Objective-C ABI mangling for qualified id<...>. Fixes <rdar://problem/14799110>.
llvm-svn: 192643
2013-10-14 23:48:27 +00:00
Aaron Ballman dbd586fc7c Trivial formatting changes; no functional changes intended.
llvm-svn: 192640
2013-10-14 23:26:04 +00:00
Aaron Ballman 91c98e1e0b Switching some custom logic to using table-generated helper methods. This also removes an unnecessary diagnostic.
llvm-svn: 192639
2013-10-14 23:22:37 +00:00
Reid Kleckner bd5bd4b36a PR17576: Fix assertion on polymorphic classes with small alignment
We have to reserve at least the width of a pointer for the vfptr.  For
classes with small alignment, we weren't reserving enough space, and
were overlapping the first field with the vfptr.

llvm-svn: 192626
2013-10-14 21:14:05 +00:00
Warren Hunt 42be77672a Correctly check for distructors when realizing vtordisps
This patch fixes the distructor test when checking for vtordisp requirements in 
microsoft record layout.  A test case is also included.

Addresses:
http://llvm.org/bugs/show_bug.cgi?id=16406#c7

llvm-svn: 192616
2013-10-14 20:14:09 +00:00
Joerg Sonnenberger a443563ff0 For NetBSD/current on X86 do not use libgcc and default to libc++.
Adjust linkage to make more sense for older releases.

llvm-svn: 192615
2013-10-14 20:13:05 +00:00
Ted Kremenek b3a38a9405 Move comment to its proper place.
llvm-svn: 192613
2013-10-14 19:11:25 +00:00
Ted Kremenek a553fbfcd1 GetExprRange() (used by -Wconversion checking) should look through OpaqueValueExprs.
Fixes a false positive with -Wconversion involving Objective-C properties.

Fixes <rdar://problem/14415662>.

llvm-svn: 192611
2013-10-14 18:55:27 +00:00
Benjamin Kramer 9f8e2d77c1 Reduce double set lookups by using the result of insert.
No functionality change.

llvm-svn: 192598
2013-10-14 15:16:10 +00:00
Chad Rosier 193573ec89 [AArch64] Add support for NEON scalar integer compare instructions.
llvm-svn: 192597
2013-10-14 14:37:40 +00:00
Serge Pavlov c0cd80fb20 Do not use typo correction that is unaccessible.
This patch fixes PR17019. When doing typo correction, Sema::CorrectTypo uses
correction already seen for the same typo. This causes problems if that
correction is from another scope and cannot be accessed in the current.

llvm-svn: 192594
2013-10-14 14:05:48 +00:00
Andy Gibbs d9ba47271d Fixed "ArgSize may be used uninitialised" error when compiling with gcc.
llvm-svn: 192570
2013-10-14 07:02:04 +00:00
Alexander Kornienko e2e0387f3e Keep track of indentation levels in static initializers for correct indentation with tabs.
Summary:
Store IndentationLevel in ParentState and use it instead of the
Line::Level when indening.
Also fixed incorrect indentation level calculation in formatFirstToken.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 192563
2013-10-14 00:46:35 +00:00
Richard Smith d46d6dea68 Merge common pointers for redeclarations of the same template across modules.
llvm-svn: 192560
2013-10-13 23:50:45 +00:00
Richard Smith f39720b26e Don't get confused by a virt-specifier after a trailing-return-type - it's not
an accidentally-included name for the declarator.

llvm-svn: 192559
2013-10-13 22:12:28 +00:00
Benjamin Kramer e28815758e Fix typo: inccrementally
llvm-svn: 192551
2013-10-13 12:02:16 +00:00
Ismail Pazarbasi 8d0f2f3ae3 Relax header guard mismatch warning with edit distance heuristic.
If the edit distance between the two macros is more than 50%, DefinedMacro may not be header guard or can be header guard of another header file or it might be defining something completely different set by the build environment.

llvm-svn: 192547
2013-10-12 23:17:37 +00:00
Manuel Klimek b212f3baa1 Automatically munch semicolons after blocks.
While it is mostly a user error to have the extra semicolon,
formatting it graciously will correctly format in the cases
where we do not fully understand the code (macros).

llvm-svn: 192543
2013-10-12 22:46:56 +00:00
Daniel Jasper 53bd167c60 clang-format: Fix assertion on unterminated #ifs.
llvm-svn: 192535
2013-10-12 13:32:56 +00:00
Pekka Jaaskelainen 1db1da25bf Callback support for OpenCL extension pragmas.
Patch from Rami Ylimäki and Mikael Lepistö!

llvm-svn: 192531
2013-10-12 09:29:48 +00:00
Daniel Jasper fba84ff00d clang-format: No space in "<::" in C++11 mode.
llvm-svn: 192524
2013-10-12 05:16:06 +00:00
DeLesley Hutchins 33a293433f Consumed analysis: replace the consumes attribute with a set_typestate
attribute.  Patch by chris.wailes@gmail.com; reviewed and edited by delesley.

llvm-svn: 192515
2013-10-11 23:03:26 +00:00
DeLesley Hutchins 8d41d99502 Consumed analysis: switch from tests_consumed/unconsumed to a general
tests_typestate attribute.  Patch by chris.wailes@gmail.com.

llvm-svn: 192513
2013-10-11 22:30:48 +00:00
Richard Trieu 0825469126 Improve the error message for attempting to build a for range loop using a
function parameter that has array type.  Such a parameter will be treated as
a pointer type instead, resulting in a missing begin function error is a
suggestion to dereference the pointer.  This provides a different,
more informative diagnostic as well as point to the parameter declaration.

llvm-svn: 192512
2013-10-11 22:16:04 +00:00
DeLesley Hutchins fbdee4e3c2 Consumed analysis: check destructor calls.
This allows the callable_when attribute to be attached to destructors.
Original patch by chris.wailes@gmail.com, reviewed and edited by delesley.

llvm-svn: 192508
2013-10-11 21:55:33 +00:00
Alexander Kornienko 384b40b90d Don't break string literals inside preprocessor directives.
Summary:
This way we avoid breaking code which uses unknown preprocessor
directives with long string literals. The specific use case in
http://llvm.org/PR17035 isn't very common, but it seems to be a good idea to
avoid this kind of problem anyway.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 192507
2013-10-11 21:43:05 +00:00
Fariborz Jahanian 11dd4b1b56 ObjectiveC migrator. also support migration to
NS_ENUM/NS_OPTIONS macros when typedef declaration
precedes enum declaration. // rdar://15200915 

llvm-svn: 192506
2013-10-11 21:34:56 +00:00
Manuel Klimek 71814b4465 Support formatting of preprocessor branches.
We now correctly format:
  void SomeFunction(int param1,
  #ifdef X
                    NoTemplate param2,
  #else
                    template <
  #ifdef A
                        MyType<Some> >
  #else
                        Type1, Type2>
  #endif
                    param2,
  #endif
                    param3) {
    f();
  }

llvm-svn: 192503
2013-10-11 21:25:45 +00:00
Reid Kleckner 4c42732cf8 Only use the MS record layout when using the MS C++ ABI
We're not ready to use it everywhere we use a win32 triple yet.

llvm-svn: 192502
2013-10-11 21:10:11 +00:00
Manman Ren f5d9d348f7 Turn struct-path aware TBAA on by default.
Use -no-struct-path-tbaa to turn it off.
This is the same as r191695, which was reverted because it depends on a
commit that has issues.

llvm-svn: 192497
2013-10-11 20:48:38 +00:00
Reid Kleckner fe56be5819 Use castAs instead of cast in thunk generation
Calling convention attributes can add sugar to methods that we have to
look through.  This fixes an assertion failure in the provided test
case.

llvm-svn: 192496
2013-10-11 20:46:27 +00:00
Reid Kleckner f5370dddff Fix unused variable warning in MS record layout.
llvm-svn: 192495
2013-10-11 20:41:08 +00:00
Warren Hunt 8f8bad723d Adds Microsoft compatiable C++ record layout code to clang.
llvm-svn: 192494
2013-10-11 20:19:00 +00:00
Daniel Jasper 877615ccfd clang-format: Don't remove 'unknown' tokens.
In certain macros or incorrect string literals, the token stream can
contain 'unknown' tokens, e.g. a single backslash or a set of empty
ticks. clang-format simply treated them as whitespace and removed them
prior to this patch.

This fixes llvm.org/PR17215

llvm-svn: 192490
2013-10-11 19:45:02 +00:00
Eric Christopher 2df080e802 Remove extra braces.
llvm-svn: 192473
2013-10-11 18:16:51 +00:00
Fariborz Jahanian 1d27ffd697 ObjectiveC migrator: fixes a bug when in NS_ENUM/NS_OPTIONS
migration, the typedef has annotations.
// rdar://15200602

llvm-svn: 192468
2013-10-11 17:35:22 +00:00
Robert Lytton cf1dd692ae XCore target: add an xcore toolchain implementation
llvm-svn: 192437
2013-10-11 10:29:40 +00:00
Robert Lytton 2d1969584a XCore : Fix bug in XCoreABIInfo::EmitVAArg()
Incorrect handling of 'double' and 'long long int'

llvm-svn: 192436
2013-10-11 10:29:34 +00:00
Douglas Gregor 71fe0e8a83 Diagnose by-copy captures of abstract classes.
Fixes <rdar://problem/14468891>.

llvm-svn: 192419
2013-10-11 04:25:21 +00:00
Nick Lewycky 3a410fe085 Add -fno-function-sections and -fno-data-sections. Since
-f{function,data}-sections had no tests at all, add some, and verify that the
-fno variants work as well.

llvm-svn: 192413
2013-10-11 03:35:10 +00:00
Nick Lewycky 609dd6671d Fix typo in comment. No functionality change.
llvm-svn: 192412
2013-10-11 03:33:53 +00:00
Kevin Qin f22bf50443 Implemented aarch64 SIMD copy related ACLE intrinsic :
vget_lane, vset_lane, vcopy_lane, vcreate, vdup_n, vdup_lane, vmov_n.

llvm-svn: 192411
2013-10-11 02:34:30 +00:00
Fariborz Jahanian 9218f5178d ObjectiveC migrator. When migrating to NS_ENUM/NS_OPTIONS,
don't leave a blank line behind replacing the typedef
decl. // rdar://15200949

llvm-svn: 192407
2013-10-10 23:57:58 +00:00
Fariborz Jahanian 8bcf182b9d ObjectiveC. ObjectiveC's collection selector expression in
the fereach loop must be a non-const lvalue expression as
it will be assigned to at the beginning of the loop.
// rdar://15123684

llvm-svn: 192399
2013-10-10 21:58:04 +00:00
Mark Lacey 2345575db3 Make CodeGenTypes data members private.
No functionality differences.

llvm-svn: 192390
2013-10-10 20:57:00 +00:00
Fariborz Jahanian 7c87b43d28 ObjectiveC migrator: For 'default' and 'shared' family of
methods, infer their self's type as their result type.
// rdar://15145218

llvm-svn: 192377
2013-10-10 18:23:13 +00:00
Hans Wennborg d219231de5 Locate VS InstallDir in the presence of newer runtime
This fixes getSystemRegistryString() in WindowsToolChain.cpp to
make sure that the VS version that it picks has an InstallDir.
Previously we would look for the highest version os VS and check
for InstallDir afterwards.

Patch by Yaron Keren!

llvm-svn: 192374
2013-10-10 18:03:08 +00:00
Hao Liu 1eade6d927 Implement AArch64 vector load/store multiple N-element structure class SIMD(lselem).
Including following 14 instructions:
4 ld1 insts: load multiple 1-element structure to sequential 1/2/3/4 registers.
ld2/ld3/ld4: load multiple N-element structure to sequential N registers (N=2,3,4).
4 st1 insts: store multiple 1-element structure from sequential 1/2/3/4 registers.
st2/st3/st4: store multiple N-element structure from sequential N registers (N = 2,3,4).

llvm-svn: 192362
2013-10-10 17:01:49 +00:00
Tim Northover 72ace5cf12 Revert "Implement AArch64 vector load/store multiple N-element structure class SIMD(lselem). "
This reverts commit r192351. The LLVM side broke the build and the Clang tests
will inevitably fail without it.

llvm-svn: 192356
2013-10-10 16:00:08 +00:00
Rafael Espindola 16311a9206 Revert "Use aliases for more constructors and destructors."
This reverts commit r192300.

The change itself looks correct, but it found issues on how we handle aliases
in llvm.

llvm-svn: 192353
2013-10-10 15:04:21 +00:00
Hao Liu c319193636 Implement AArch64 vector load/store multiple N-element structure class SIMD(lselem).
Including following 14 instructions:
4 ld1 insts: load multiple 1-element structure to sequential 1/2/3/4 registers.
ld2/ld3/ld4: load multiple N-element structure to sequential N registers (N=2,3,4).
4 st1 insts: store multiple 1-element structure from sequential 1/2/3/4 registers.
st2/st3/st4: store multiple N-element structure from sequential N registers (N = 2,3,4).

E.g. ld1(3 registers version) will load 32-bit elements {A, B, C, D, E, F} sequentially into the three 64-bit vectors list {BA, DC, FE}.
E.g. ld3 will load 32-bit elements {A, B, C, D, E, F} into the three 64-bit vectors list {DA, EB, FC}.

llvm-svn: 192351
2013-10-10 14:59:36 +00:00
Alexander Kornienko 60d1b046dd Correctly detect colon in bit fields. Fixes PR17333.
Summary: Colon was incorrectly detected as a start of inheritance list. Fixed.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 192349
2013-10-10 13:36:20 +00:00
Benjamin Kramer 5fc787fc2e Parser: Avoid a crash-on-invalid when trying to diagnose function calls with -> in it.
Use the existing convenience function.

llvm-svn: 192347
2013-10-10 12:24:40 +00:00
Benjamin Kramer 915d169c6a Sema: Taking the address of a dtor is illegal per C++ [class.dtor]p2.
Emit a proper error instead of crashing in CodeGen. PR16892.

llvm-svn: 192345
2013-10-10 09:44:41 +00:00
Simon Atanasyan a61b7ecb2f [Mips] Support FSF Mips toolchain directories tree in the Clang driver.
The patch reviewed by Rafael Espindola.
http://llvm-reviews.chandlerc.com/D1843

llvm-svn: 192343
2013-10-10 07:57:44 +00:00
Ted Kremenek e65ab9e80e Fix getIntegerTypeOrder() to properly handle enums by first unwrapping their underlying integer type. This is a precondition for calling getIntegerRank().
Fixes an assertion failure in a test case involving vectors.

Fixes <rdar://problem/15091442>

Please somebody check this.

llvm-svn: 192334
2013-10-10 00:54:01 +00:00
Hans Wennborg 935d01d80a Use KEY_WOW64_32KEY when reading the registry in WindowsToolChain.cpp (PR17033)
This exposes a 32-bit view of the registry even when Clang is built as a 64-bit
program. Since Visual Studio is a 32-bit application, this is necessary for us
to find it.

llvm-svn: 192331
2013-10-09 23:41:48 +00:00
Ted Kremenek 197fee407e Refine string literal concatenation warning within an NSArray literal to not warn when the literal comes from a macro expansion. Fixes <rdar://problem/15147688>.
llvm-svn: 192328
2013-10-09 22:34:33 +00:00
Sean Callanan c665c9ecf4 This patch addresses a problem encountered by the
ASTImporter when importing the following types:

typedef struct {
} A;

typedef struct {
  A a;
} B;

Suppose we have imported B, but we did not at that
time need to complete it.  Then later we want to
import A.  The struct is anonymous, so the first
thing we want to do is make sure no other anonymous
struct already matches it.  So we set up an
StructuralEquivalenceContext and compare B with A.

This happens at ASTImporter.cpp:2179.

Now, in this scenario, B is not complete.  So we go
and import its fields, including a, which causes A
to be imported.  The ASTImporter doesn’t yet have A
in its list of already-imported things, so we
import A.

After the StructuralEquivalenceContext is finished
determining that A and B are different, the
ASTImporter concludes that A must be imported
because no equivalent exists, so it imports a second
copy of A.  Now we have two different structs
representing A.  This is really bad news.

The patch allows the StructuralEquivalenceContext to
use the original version of B when making its
comparison, obviating the need for an import and
cutting this loop.

llvm-svn: 192324
2013-10-09 21:45:11 +00:00
Fariborz Jahanian 20a1124ce5 ObjectiveC migrator. Introduce a new objcmt-atomic-property option
and use it to infer all properties as 'atomic'.
// rdar://14988132

llvm-svn: 192317
2013-10-09 19:06:08 +00:00
DeLesley Hutchins 3277a6129b Consumed analysis: improve loop handling. The prior version of the analysis
marked all variables as "unknown" at the start of a loop.  The new version
keeps the initial state of variables unchanged, but issues a warning if the
state at the end of the loop is different from the state at the beginning.
This patch will eventually be replaced with a more precise analysis.

Initial patch by chris.wailes@gmail.com.  Reviewed and edited by
delesley@google.com.

llvm-svn: 192314
2013-10-09 18:30:24 +00:00
Ariel J. Bernal e7288fe233 Revert commit r192299 until find a way to account for simlinks in OS X.
llvm-svn: 192313
2013-10-09 18:27:27 +00:00
Timur Iskhodzhanov b648732230 Initialize vtorDisp in class constructors and destructors
Reviewed at http://llvm-reviews.chandlerc.com/D1867

llvm-svn: 192312
2013-10-09 18:16:58 +00:00
Hans Wennborg 1e109804f5 Tighten diagnostics for calling conventions on variadic functions
Follow-up from r192240.

This makes it an error to use callee-cleanup conventions on variadic
functions, except for __fastcall and __stdcall, which we ignore with
a warning for GCC and MSVC compatibility.

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

llvm-svn: 192308
2013-10-09 18:10:25 +00:00
Fariborz Jahanian de557f84dd ObjectiveC migrator. Introduce a new print policy for
suppression of strong lifetime qualifiers when
inferring property. // rdar://15082812

llvm-svn: 192305
2013-10-09 17:37:28 +00:00
Rafael Espindola a25c79e704 Use aliases for more constructors and destructors.
With this patch we produce alias for cases like

template<typename T>
struct foobar {
  foobar() {
  }
};
template struct foobar<void>;

It is safe to use aliases to weak symbols, as long and the alias itself is also
weak.

llvm-svn: 192300
2013-10-09 16:13:15 +00:00
Ariel J. Bernal ee863cedc2 This patch fixes replacements that are not applied when relative paths are
specified.

In particular it makes sure that relative paths for non-virtual files aren't
made absolute.
Added unittest test.

llvm-svn: 192299
2013-10-09 16:09:23 +00:00
Daniel Jasper d3e014d404 clang-format: Fix template declaration line breaking with comment.
Before, clang-format would always insert a linebreak before the comment
in code like:
  template <typename T> // T can be A, B or C.
  struct S {};

llvm-svn: 192297
2013-10-09 15:06:17 +00:00
Simon Atanasyan 068e0fd52e [Mips] Group MIPS-related options checking function in one place.
llvm-svn: 192293
2013-10-09 12:12:39 +00:00
Simon Atanasyan 6736ad1222 [Mips] Make the isMipsR2Arch() function simpler - remove checking for
MIPS-arch.

llvm-svn: 192292
2013-10-09 12:12:34 +00:00
Simon Atanasyan e0cc7c72be [Mips] Do not check for options from the OPT_mips_CPUs_Group. All these
options are aliases now.

llvm-svn: 192290
2013-10-09 12:12:24 +00:00
Timur Iskhodzhanov e1ebc5fb66 Code cleanup: rename VTableContext to ItaniumVTableContext, VTableBuilder to ItaniumVTableBuilder and clang-format code around
llvm-svn: 192288
2013-10-09 11:33:51 +00:00
Timur Iskhodzhanov ad9d3b8fd1 Reland 192220 "Abstract out parts of thunk emission code, add support for simple thunks when using -cxx-abi microsoft" with relaxed assertions
llvm-svn: 192285
2013-10-09 09:23:58 +00:00
David Majnemer 767c1f8428 Make wording for certain invalid unary expressions more consistent.
An invalid decltype expression like 'decltype int' gives:
error: expected '(' after 'decltype'

This makes it so 'sizeof int' gives a similar one:
error: expected parentheses around type name in sizeof expression

llvm-svn: 192258
2013-10-09 00:22:23 +00:00
Reid Kleckner be7a446637 -Wmicrosoft: Don't warn on non-inline pure virtual method definitions
MSVC and clang with -fms-extensions allow pure virtual methods to be
defined inline after the "= 0" tokens.  Clang warns on these because it
is not standard, but incorrectly warns on out-of-line definitions, which
are standard.

With this change, clang will only warn on inline definitions of pure
virtual methods.

Fixes some self-host warnings on out-of-line definitions of pure virtual
destructors.

llvm-svn: 192244
2013-10-08 22:45:29 +00:00
Chad Rosier 0a903478c6 [AArch64] Add support for NEON scalar floating-point reciprocal estimate,
reciprocal exponent, and reciprocal square root estimate instructions.

llvm-svn: 192243
2013-10-08 22:09:29 +00:00
Hans Wennborg 9112ac2136 Turn error about fastcall variadic function into warning in MS mode (PR12535)
MSVC allows this and silently falls back to __cdecl for variadic functions.
This patch turns Clang's error into a warning in MS mode and adds a test
to make sure we generate correct code.

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

llvm-svn: 192240
2013-10-08 21:52:56 +00:00
Fariborz Jahanian 3c593d63a1 ObjectiveC migrator: Add support for inferring
properties of function pointer type.
// rdar://15082812

llvm-svn: 192237
2013-10-08 21:32:16 +00:00
Chad Rosier 0babda4b9c [AArch64] Add support for NEON scalar signed/unsigned integer to floating-point
convert instructions.

llvm-svn: 192232
2013-10-08 20:43:46 +00:00
Fariborz Jahanian 02461d0218 ObjectiveC migration. Add support for inferring
properties of block pointer types. Also, remove
strong lifetime attribute from property type
in this migration. This is wip.
// rdar://15082818

llvm-svn: 192226
2013-10-08 20:14:24 +00:00
Timur Iskhodzhanov c7113073dd Revert 192220 as it fails on an assertion
llvm-svn: 192225
2013-10-08 20:09:50 +00:00
Timur Iskhodzhanov 1ffb3916ce Abstract out parts of thunk emission code, add support for simple thunks when using -cxx-abi microsoft
Reviewed at http://llvm-reviews.chandlerc.com/D1787

llvm-svn: 192220
2013-10-08 19:15:38 +00:00
Ted Kremenek 256b29cbaa Remove transient code I did not mean to check in.
llvm-svn: 192211
2013-10-08 18:04:56 +00:00
Serge Pavlov 8f91b35d1b Fixed grammar. Thanks to Jordan Rose.
llvm-svn: 192204
2013-10-08 17:09:03 +00:00
Ted Kremenek c37877d7a4 Convert anachronistic use of 'void *' to 'DeclContext *' in Scope that was a holdover from the long-dead Action interface.
llvm-svn: 192203
2013-10-08 17:08:03 +00:00
Benjamin Kramer 3b05e20031 Fix an edge case in the template differ with default arguments.
In the test case one type is coming from a typedef with no default arg, the
other has the default arg. Taking the default arg from the typedef crashes, so
always use the real template paramter declaration. PR17510.

llvm-svn: 192202
2013-10-08 16:58:52 +00:00
Serge Pavlov aa57a64ef6 Add fixits suggesting parenthesis around type name in expressions like sizeof.
This fixes PR16992 - Fixit missing when "sizeof type" found.

llvm-svn: 192200
2013-10-08 16:56:30 +00:00
Daniel Jasper f9a5e4043c clang-format: Improve indentation when deriving from templated classes.
Before:
  struct aaaaaaaaaaaaa : public aaaaaaaaaaaaaaaaaaa< //
      aaaaaaaaaaaaaaaa> {};
  struct aaaaaaaaaaaaaaaaaaaa : public aaaaaaaaaaaaaaaaaaa<
      aaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaa> {};

After:
  struct aaaaaaaaaaaaa : public aaaaaaaaaaaaaaaaaaa< //
                             aaaaaaaaaaaaaaaa> {};
  struct aaaaaaaaaaaaaaaaaaaa
      : public aaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaaaaaa,
                                   aaaaaaaaaaaaaaaaaaaaaa> {};

llvm-svn: 192187
2013-10-08 16:24:07 +00:00
Alp Toker d4a72d5ce5 Make InstantiatingTemplate depth checks clearer
The bool conversion operator on InstantiatingTemplate never added value and
only served to obfuscate the template instantiation routines.

This replaces the conversion and its callers with an explicit isInvalid()
function to make it clear what's going on at a glance.

llvm-svn: 192177
2013-10-08 08:09:04 +00:00
Daniel Jasper ec01cd6e7f clang-format: Improve constructor initializer linewrapping.
Specifically make ConstructorInitializerAllOnOneLineOrOnePerLine work
nicely with BreakConstructorInitializersBeforeComma.

This fixes llvm.org/PR17395.

llvm-svn: 192168
2013-10-08 05:11:18 +00:00
Faisal Vali d2598e97a4 Fix linkage calculation of auto member functions returning lambdas
As described by Richard in https://groups.google.com/a/isocpp.org/d/msg/std-discussion/S1kmj0wF5-g/fb6agEYoL2IJ

we should allow:

template<typename S>
struct A {

template<typename T> static auto default_lambda() {
  return [](const T&) { return 42; };
}

template<class U = decltype(default_lambda<S>())>
  U func(U u = default_lambda<S>()) { return u; }

};

int run2 = A<double>{}.func()(3.14);

int run3 = A<char>{}.func()('a');

This patch allows the code using the same trickery that was used to allow the code in non-member functions at namespace scope.


Please see http://llvm-reviews.chandlerc.com/D1844 for richard's approval.

llvm-svn: 192166
2013-10-08 04:15:04 +00:00
Reid Kleckner 9a7f3e61a9 [ms-cxxabi] Fix the calling convention for operator new in records
Summary:
Operator new, new[], delete, and delete[] are all implicitly static when
declared inside a record.  CXXMethodDecl already knows this, but we need
to account for that before we pick the calling convention for the
function type.

Fixes PR17371.

Reviewers: rsmith

CC: cfe-commits

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

llvm-svn: 192150
2013-10-08 00:58:57 +00:00
Justin Bogner 84ff5ee448 Sema: Only merge typedef attributes if the previous decl is a typedef
In r186373, we started merging attributes on typedefs, but this causes
us to try to merge attributes even if the previous declaration was not
a typedef.

Only merge the attributes if the previous decl was also a typedef.

Fixes rdar://problem/15044218

llvm-svn: 192146
2013-10-08 00:19:09 +00:00
Manman Ren 4f755deaf6 TBAA: use the same format for scalar TBAA and struct-path aware TBAA.
An updated version of r191586 with bug fix.

Struct-path aware TBAA generates tags to specify the access path,
while scalar TBAA only generates tags to scalar types.

We should not generate a TBAA tag with null being the first field. When
a TBAA type node is null, the tag should be null too. Make sure we
don't decorate an instruction with a null TBAA tag.

Added a testing case for the bug reported by Richard with -relaxed-aliasing
and -fsanitizer=thread.

llvm-svn: 192145
2013-10-08 00:08:49 +00:00
Ted Kremenek 854cc293a7 Suppress useless -Wshadow warning when using _mm* macros from emmintrin.h
Fixes <rdar://problem/10679282>.

I'm not completely satisfied with this patch.  Sprinkling "diagnostic ignored"
_Pragmas throughout this file is gross, but I couldn't suppress
it for the entire file.

llvm-svn: 192143
2013-10-07 23:51:11 +00:00
Richard Smith fee2c8d814 Remove -ast-dump-xml.
llvm-svn: 192131
2013-10-07 20:56:34 +00:00
Fariborz Jahanian 985da6c936 ObjectiveC migrator: A typical implementation of
'default' methods in Foundation does not
infer 'instancetype' for methods' result type.
// rdar://15145218

llvm-svn: 192129
2013-10-07 20:41:53 +00:00
Richard Smith b8b41d3ea4 Add support for WG21 N3599 (literal operator template for strings) as a GNU
extension. The GCC folks have decided to support this even though the standard
committee have not yet approved this feature.

Patch by Hristo Venev!

llvm-svn: 192128
2013-10-07 19:57:58 +00:00
Fariborz Jahanian d29406233b ObjectiveC modern rewriter. Rewrite typedefs
declared locally in ObjectiveC containers.
// rdar://15143875

llvm-svn: 192127
2013-10-07 19:54:22 +00:00
Matt Arsenault 2f15263807 Fix objectsize tests after r192117
llvm-svn: 192120
2013-10-07 19:00:18 +00:00
Fariborz Jahanian 88ff20ef2a ObjectiveC: Warn when 'readonly' property has explicit
ownership attribute (such as 'copy', 'assign' etc.)
// rdar://15131088

llvm-svn: 192115
2013-10-07 17:20:02 +00:00
Jordan Rose 42b4248f05 [analyzer] ArrayRef-ize BugReporter::EmitBasicReport.
No functionality change.

llvm-svn: 192114
2013-10-07 17:16:59 +00:00
Jordan Rose 7741132f47 [analyzer] RetainCountChecker: add support for CFAutorelease.
<rdar://problems/13710586&13710643>

llvm-svn: 192113
2013-10-07 17:16:52 +00:00
Chad Rosier 027dfade54 [AArch64] Add support for NEON scalar arithmetic instructions:
SQDMULH, SQRDMULH, FMULX, FRECPS, and FRSQRTS.

llvm-svn: 192112
2013-10-07 17:07:17 +00:00
NAKAMURA Takumi f7c520ff66 Sema::tryCaptureVariable(): Prune three unused variables, HasBlocksAttr, IsBlock, and IsLambda. [-Wunused-variable]
llvm-svn: 192095
2013-10-07 09:32:50 +00:00
Manuel Klimek 91e48586ae Fix incorrect detection of class definitions with alignas specification.
llvm-svn: 192094
2013-10-07 09:15:41 +00:00
Richard Smith 0b87e0739e When merging class definitions across modules in C++, merge together fields.
This change doesn't go all the way to making fields redeclarable; instead, it
makes them 'mergeable', which means we can find the canonical declaration, but
not much else (and for a declaration that's not from a module, the canonical
declaration is always that declaration).

llvm-svn: 192092
2013-10-07 08:02:11 +00:00
Faisal Vali ad090d82f2 Refactor tryCaptureVar using ExtractMethod. No functionality change.
In chicago, Doug had requested that I go ahead and commit the refactor  as a separate change, if all the tests passed.  

Lets hope the buildbots stay quiet.

Thanks!

llvm-svn: 192087
2013-10-07 05:13:48 +00:00
Timur Iskhodzhanov 20df98c0d0 Fix PR17382 - properly group virtual method overloads in the vftable
llvm-svn: 192067
2013-10-06 15:31:37 +00:00
Daniel Jasper 320997e6b3 clang-format: Remove empty lines after visibility modifiers.
Formatting:
  class C {
  public:

    f();
  };

Now leads to:
  class C {
  public:
    f();
  };

llvm-svn: 192062
2013-10-06 11:40:08 +00:00
Sylvestre Ledru 0c4813e695 remove a dead assignment. The variables are set just right after. Found by scan-build http://buildd-clang.debian.net/scan-build/
llvm-svn: 192061
2013-10-06 09:54:18 +00:00
Mark Lacey 3825e83d6b Pass CGCXXABIs around directly.
In functions that only need to use the CGCXXABI member of a CodeGenTypes
class, pass that reference around directly rather than a reference to
a CodeGenTypes class.

This makes the actual dependence on CGCXXABI clear at the call sites.

llvm-svn: 192052
2013-10-06 01:33:34 +00:00
Aaron Ballman 4c9b7dc92e Switching the CallableWhen attribute over to using the string literal helper function instead of custom logic.
llvm-svn: 192050
2013-10-05 22:45:34 +00:00
Nick Lewycky 50e8f480ea Add support for -mcx16, and predefine __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 when
it is enabled. Also enable it on the same architectures that GCC does.

llvm-svn: 192045
2013-10-05 20:14:27 +00:00
Aaron Ballman 7fc6e1bc59 Silencing an MSVC warning; SmallSet::count returns a bool instead of a size_t.
llvm-svn: 192043
2013-10-05 19:56:07 +00:00
Craig Topper d335c9da22 Use logical/arithmetic operations instead of builtins in tbmintrin.h. This way we can remove the intrinsic support from the backend.
llvm-svn: 192036
2013-10-05 17:08:42 +00:00
Simon Atanasyan a0d895733b Remove unused param from Linux::computeSysRoot().
llvm-svn: 192034
2013-10-05 14:37:55 +00:00
Benjamin Kramer 3c529ca930 Sema: Cleanup redundant variable NumArgsToCheck
Patch by Daniel Marjamäki!

llvm-svn: 192030
2013-10-05 10:03:01 +00:00
Jiangning Liu b96ebac02b Implement aarch64 neon instruction set AdvSIMD (Across).
llvm-svn: 192029
2013-10-05 08:22:55 +00:00
DeLesley Hutchins 210791a021 Consumed Analysis: Change callable_when so that it can take a list of states
that a function can be called in.  This reduced the total number of annotations
needed and makes writing more complicated behaviour less burdensome.
Patch by chriswails@gmail.com.

llvm-svn: 191983
2013-10-04 21:28:06 +00:00
Fariborz Jahanian b809a0e280 ObjectiveC. Allow readonly properties without an explicit ownership
(assign/unsafe_unretained/weak/retain/strong/copy) in super class
to be overridden by a property with any explicit ownership in the 
subclass. // rdar://15014468

llvm-svn: 191971
2013-10-04 18:06:08 +00:00
Rafael Espindola 4b35f27206 Revert "Teach TreeTransform and family how to transform generic lambdas within templates and nested within themselves."
This reverts commit r191879. It caused llvm.org/pr17476.

llvm-svn: 191955
2013-10-04 14:28:51 +00:00
Amaury de la Vieuville 21bf6ed730 Do not emit undefined lsrh/ashr for NEON shifts
These IR instructions are undefined when the amount is equal to operand
size, but NEON right shifts support such shifts. Work around that by
emitting a different IR in these cases.

llvm-svn: 191953
2013-10-04 13:13:15 +00:00
Simon Atanasyan eeb6f27fd5 Revert r191947. The problem is not MIPS-specific and requires more
general solution.

llvm-svn: 191951
2013-10-04 11:46:54 +00:00
Timur Iskhodzhanov 555a7727c1 Simplify MicrosoftCXXNameMangler::mangleFunctionType
llvm-svn: 191950
2013-10-04 11:25:05 +00:00
Simon Atanasyan 777669be1e [Mips] For MIPS '-fPIC -static' means to compile as -fPIC but link with
-static. So do not turn off the PIC flag if -static passed to the
driver in case of MIPS target.

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

llvm-svn: 191947
2013-10-04 10:36:42 +00:00
Jiangning Liu 4617e9dc85 Implement aarch64 neon instruction set AdvSIMD (3V elem).
llvm-svn: 191945
2013-10-04 09:21:17 +00:00
Jordan Rose 6feda28756 [analyzer] Replace bug category magic strings with shared constants, take 2.
Re-commit r191910 (reverted in r191936) with layering violation fixed, by
moving the bug categories to StaticAnalyzerCore instead of ...Checkers.

llvm-svn: 191937
2013-10-04 00:25:24 +00:00
Richard Smith 25d8e737d8 Temporarily revert r191910 until the layering violation can be fixed.
llvm-svn: 191936
2013-10-03 23:38:02 +00:00
Jordan Rose 761ee868a5 [analyzer] Replace bug category magic strings with shared constants.
One small functionality change is to bring the sizeof-pointer checker in
line with the other checkers by making its category be "Logic error"
instead of just "Logic". There should be no other functionality changes.

Patch by Daniel Marjamäki!

llvm-svn: 191910
2013-10-03 16:57:20 +00:00
Jordan Rose 9db2d9adef [analyzer] Add new debug helper clang_analyzer_warnIfReached.
This will emit a warning if a call to clang_analyzer_warnIfReached is
executed, printing REACHABLE. This is a more explicit way to declare
expected reachability than using clang_analyzer_eval or triggering
a bug (divide-by-zero or null dereference), and unlike the former will
work the same in inlined functions and top-level functions. Like the
other debug helpers, it is part of the debug.ExprInspection checker.

Patch by Jared Grubb!

llvm-svn: 191909
2013-10-03 16:57:03 +00:00
Tim Northover e66c946ee4 ARM: *-*-darwin-eabi triples should use AAPCS.
llvm-svn: 191900
2013-10-03 14:23:28 +00:00
Matthew Curtis 274a9cc84b Gracefully (and correctly) handle init of multiple union members
We now emit warnings when doing so and code generation is consistent
with GCC. Note that the C99 spec is unclear as to the precise
behavior.

See also ...
Bug:
  http://llvm.org/bugs/show_bug.cgi?id=16644 and

cfe-dev discussion:
  http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-September/031918.html

llvm-svn: 191890
2013-10-03 12:14:24 +00:00
Faisal Vali 8ec4036669 Teach TreeTransform and family how to transform generic lambdas within templates and nested within themselves.
This does not yet include capturing (that is next).

Please see test file for examples.

This patch was LGTM'd by Doug:
http://llvm-reviews.chandlerc.com/D1784
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130930/090048.html

When I first committed this patch - a bunch of buildbots were unable to compile the code that VS2010 seemed to compile.  Seems like there was a dependency on Sema/Template.h which VS did not seem to need, but I have now added for the other compilers.  It still compiles on Visual Studio 2010 - lets hope the buildbots remain quiet (please!)

llvm-svn: 191879
2013-10-03 06:29:33 +00:00
Timur Iskhodzhanov 6745522f89 Extract ABI-specific parts of MangleContext into separate classes
Reviewed at http://llvm-reviews.chandlerc.com/D1807

llvm-svn: 191878
2013-10-03 06:26:13 +00:00
Faisal Vali 10a00ee485 Revert changes from the nested lambdas commit till i figure out
why the buildbots are failing.

llvm-svn: 191876
2013-10-03 05:58:37 +00:00
Faisal Vali ba78d34347 Teach TreeTransform and family how to transform generic lambdas within templates and nested within themselves.
This does not yet include capturing (that is next).

Please see test file for examples.

This patch was LGTM'd by Doug:
http://llvm-reviews.chandlerc.com/D1784

llvm-svn: 191875
2013-10-03 05:32:48 +00:00
Craig Topper d867805739 Change __builtin_ia32_bextri_u64 to take an i64imm to match up with LLVM backend changes.
An explicit cast is still needed in tbmintrin.h to convert any big integer down to i32imm.

Patch from Yunzhong Gao.

llvm-svn: 191872
2013-10-03 04:21:19 +00:00