Commit Graph

17396 Commits

Author SHA1 Message Date
Ben Langmuir fe971d9894 When loading a module with no local entities, still bump the size of the
tables that correspond to ContinuousRangeMaps, since the keys to those
maps need to be unique, or we may map to the wrong offset.

This fixes a crash + malformed AST file seen when loading some modules
that import Cocoa on Darwin, which is a module with no contents except
imports of other modules. Unfortunately I have not been able to find a
reduced test case that reproduces this problem.

Also add an assert that we aren't mapping one key to multiple values
in CRM.  We ought to be able to say there are no duplicate keys at all,
but there are a bunch of 0 -> 0 mappings that are showing up, probably
coming from the source location table.

llvm-svn: 215810
2014-08-16 04:54:18 +00:00
Argyrios Kyrtzidis ac3997eb52 [libclang] Introduce clang_File_isEqual for comparing CXFile handles.
llvm-svn: 215796
2014-08-16 00:26:19 +00:00
Nico Weber ccec9d8cee Add a RAII class for saving and restoring instantiations and uses. No behavior change.
llvm-svn: 215780
2014-08-15 22:29:14 +00:00
James Dennett 64fa12372c Typo fix in comments: definintion -> definition
llvm-svn: 215764
2014-08-15 20:04:40 +00:00
Matt Arsenault dbb84916d9 R600: Add ldexp intrinsic
llvm-svn: 215738
2014-08-15 17:44:32 +00:00
Samuel Benzaquen 8e7f99647d Add isDeleted() matcher for FunctionDecl nodes.
Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 215714
2014-08-15 14:20:59 +00:00
Aaron Ballman 5c98a23e80 There are no overloads of this virtual function, nor are there any callers of it. NFC.
llvm-svn: 215705
2014-08-15 12:34:08 +00:00
Keno Fischer 070db177bd Make sure CallExpr::getLocStart doesn't segfault
Summary:
When the CallExpr passed to Sema::ConvertArgumentsForCall has all default parameters, and the number of actual arguments passed is zero, this function will segfault in the call to Call->getLocStart() if the Callee has an invalid getLocStart(), the reason being that since ConvertArgumentsForCall has set the correct number of arguments, but has not filled them in yet, getLocStart() will try to access the first (not yet existent) argument and thus segfaults.

This fixes that by making getLocStart return an invalid source location if the queried argument is NULL rather than segfaulting.

Reviewers: rnk

Reviewed By: rnk

Subscribers: cfe-commits

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

llvm-svn: 215686
2014-08-15 01:39:12 +00:00
DeLesley Hutchins e8d2a9d755 Thread Safety Analysis: Move -Wthread-safety-negative out of the
-Wthread-safety umbrella flag, pending updates to documentation.  The flag
works, but is likely to be confusing to existing users of -Wthread-safety.

llvm-svn: 215679
2014-08-14 21:54:34 +00:00
DeLesley Hutchins eb0ea5f40a Thread safety analysis: add -Wthread-safety-verbose flag, which adds additional notes that are helpful when compiling statistics on thread safety warnings.
llvm-svn: 215677
2014-08-14 21:40:15 +00:00
Adam Nemet 2278fcbf0c [AVX512] Add FMA intrinsics
Part of <rdar://problem/17688758>

llvm-svn: 215666
2014-08-14 17:17:57 +00:00
Artyom Skrobov a208a73390 Use the proper post-order traversal in LiveVariables analysis,
to recover the performance after r214064.

Also sorts out the naming for PostOrderCFGView, ReversePostOrderCFGView,
BackwardDataflowWorklist and ForwardDataflowWorklist, to match the accepted
terminology.

Also unifies BackwardDataflowWorklist and ForwardDataflowWorklist to share
the "worklist for prioritization, post-order traversal for fallback" logic,
and to avoid repetitive sorting.

Also cleans up comments in the affected area.

llvm-svn: 215650
2014-08-14 16:04:47 +00:00
David Majnemer ad2986efce Parse: Don't attempt to act on #pragma init_seg when not targeting MSVC
It doesn't really make sense to try and do stuff with #pragma init_seg
when targeting non-Microsoft platforms; notions like library vs user
initializers don't exist for other targets.

This fixes PR20639.

llvm-svn: 215618
2014-08-14 06:35:08 +00:00
Richard Smith b593d78155 [modules] Factor .td-generated diagnostics stuff out into its own module; this
avoids users of AllDiagnostics.h from needing to pregenerate *all* generated
headers. Hopefully this will make my modules buildbot happier...

llvm-svn: 215617
2014-08-14 04:11:33 +00:00
Rafael Espindola 9b1e0a83b1 Whitespace fix.
Sorry about the noise.

llvm-svn: 215601
2014-08-13 23:29:23 +00:00
Fariborz Jahanian 0ded42451d Objective-C. Minor refactoring of my last patch.
// rdar://16808765

llvm-svn: 215581
2014-08-13 21:24:14 +00:00
Fariborz Jahanian 30ae8d4413 Objective-C. This patch is to resolve the method used in method
expression to the best method found in global method pools. 
This is wip.  // rdar://16808765

llvm-svn: 215577
2014-08-13 21:07:35 +00:00
Yi Kong a5548431a5 AArch64: Prefetch intrinsic
llvm-svn: 215569
2014-08-13 19:18:20 +00:00
Yi Kong 26d104a9ec ARM: Prefetch intrinsics
llvm-svn: 215568
2014-08-13 19:18:14 +00:00
Rafael Espindola fa49c0bf10 Use std::unique_ptr to simplify memory management a bit.
llvm-svn: 215559
2014-08-13 16:47:00 +00:00
Benjamin Kramer 2f5db8b3db Header guard canonicalization, clang part.
Modifications made by clang-tidy with minor tweaks.

llvm-svn: 215557
2014-08-13 16:25:19 +00:00
Simon Atanasyan d95c67d425 [Driver] Support -muclibc / -mglibc command line options for a couple
of MIPS toolchains.

The uCLibc implemented for multiple architectures. A couple of MIPS toolchains
contains both uCLibc and glibc implementation so these options allow to select
used C library.

Initially -muclibc / -mglibc (as well as -mbionic) have been implemented in gcc
for various architectures so they are not MIPS specific.

llvm-svn: 215552
2014-08-13 14:34:14 +00:00
Oliver Stannard 76244be6d4 Emit diagnostic for -munaligned-access on v6m targets
Rather than silently disabling unaligned accesses for v6m targets as
in the previous patch to llvm, instead produce a warning saying that
this architecture doesn't support unaligned accesses.

Patch by Ben Foster

llvm-svn: 215531
2014-08-13 09:18:12 +00:00
Richard Smith bb853c79c0 [modules] When performing a lookup into a namespace, ensure that any later
redefinitions of that namespace have already been loaded. When writing out the
names in a namespace, if we see a name that is locally declared and had
imported declarations merged on top of it, export the local declaration as the
lookup result, because it will be the most recent declaration of that entity in
the redeclaration chain of an importer of the module.

llvm-svn: 215518
2014-08-13 01:23:33 +00:00
Alexey Samsonov de443c5002 [UBSan] Add returns-nonnull sanitizer.
Summary:
This patch adds a runtime check verifying that functions
annotated with "returns_nonnull" attribute do in fact return nonnull pointers.
It is based on suggestion by Jakub Jelinek:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140623/223693.html.

Test Plan: regression test suite

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 215485
2014-08-13 00:26:40 +00:00
Samuel Benzaquen 788674f964 Fix the \param comments to have the parameter name.
Summary: This fixes the build break introduced in rL215472

Reviewers: pcc

Subscribers: klimek, cfe-commits

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

llvm-svn: 215476
2014-08-12 21:49:59 +00:00
Samuel Benzaquen 646f23b809 Support named values in the autocomplete feature.
Summary:
This includes:
 - Passing a Sema to completeExpression to allow for named values in the
   expression.
 - Passing a map of names to values to the parser.
 - Update the Sema interface to include completion for matchers.
 - Change the parser to use the Sema for completion, instead of going
   directly to Registry.

Reviewers: pcc

Subscribers: klimek, cfe-commits

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

llvm-svn: 215472
2014-08-12 21:11:37 +00:00
Ben Langmuir 4b8a9e951e Verify all the module map files for a pcm are the same on load
We already verified the primary module map file (either the one that
defines the top-level module, or the one that allows inferring it if it
is an inferred framework module). Now we also verify any other module
map files that define submodules, such as when there is a
module.private.modulemap file.

llvm-svn: 215455
2014-08-12 16:42:33 +00:00
Rafael Espindola cd0b380a3c Use StringRef instead of MemoryBuffer&.
This code doesn't care where the data it is processing comes from, so a
StringRef is probably the most natural interface.

llvm-svn: 215448
2014-08-12 15:46:24 +00:00
Manuel Klimek 9af34aeac1 Correctly implement -include search logic.
According to the gcc docs, -include uses the current working directory
for the lookup instead of the main source file.

This patch gets rid of NormalizeIncludePath (which relied on an
implementation detail of FileManager / FileEntry for the include path
logic to work), and instead hands the correct lookup information down to
LookupFile.

This will allow us to change the FileEntry's behavior regarding its Name
caching.

llvm-svn: 215433
2014-08-12 08:25:57 +00:00
Richard Smith 3d1a94c6a6 Reject virt-specifiers on friend declarations. Give anonymous bitfields a
location so their diagnostics have somewhere to point.

llvm-svn: 215416
2014-08-12 00:22:39 +00:00
Richard Smith 36ee9fb219 Reject varargs '...' in function prototype if there are more parameters after
it. Diagnose with recovery if it appears after a function parameter that was
obviously supposed to be a parameter pack. Otherwise, warn if it immediately
follows a function parameter pack, because the user most likely didn't intend
to write a parameter pack followed by a C-style varargs ellipsis.

This warning can be syntactically disabled by using ", ..." instead of "...".

llvm-svn: 215408
2014-08-11 23:30:23 +00:00
Richard Smith 35f986d3cd Modify behavior of -ast-dump-lookups: if -ast-dump is not also provided, dump
anyway. If -ast-dump *is* also provided, then dump the AST declarations as well
as the lookup results. This is invaluable for cross-correlating the lookup
information with the declarations actually found.

llvm-svn: 215393
2014-08-11 22:11:07 +00:00
David Blaikie 3d95d858f9 Change MemoryBuffer* to MemoryBuffer& parameter to Lexer::ComputePreamble
(dropping const from the reference as MemoryBuffer is immutable already,
so const is just redundant - and while I'd personally put const
everywhere, that's not the LLVM Way (see llvm::Type for another example
of an immutable type where "const" is omitted for brevity))

Changing the pointer argument to a reference parameter makes call sites
identical between callers with unique_ptrs or raw pointers, minimizing
the churn in a pending unique_ptr migrations.

llvm-svn: 215391
2014-08-11 22:08:06 +00:00
David Blaikie 23430ccb04 unique_ptr-ify FileSystemStatCache::setNextStatCache
And in the process, discover that FileManager::removeStatCache had a
double-delete when removing an element from the middle of the list (at
the beginning or the end of the list, there was no problem) and add a
unit test to exercise the code path (which successfully crashed when run
(with modifications to match the old API) without this patch applied)

llvm-svn: 215388
2014-08-11 21:29:24 +00:00
David Blaikie afa10d3eda unique_ptr-ify the MemoryBuffer parameter of GlobalModuleIndex
llvm-svn: 215376
2014-08-11 18:47:26 +00:00
Sylvestre Ledru b8198f0222 GCC compatibility: Ignore -fexec-charset=UTF-8 argument. It is the default in Clang. Reject other values.
Summary:
Just like with -finput-charset=UTF-8 in review http://reviews.llvm.org/D4347, I think we should just ignore it when UTF-8 is provided.


Reviewers: rnk, rafael

Reviewed By: rafael

Subscribers: rafael, cfe-commits

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

llvm-svn: 215368
2014-08-11 18:09:03 +00:00
Hans Wennborg 52c6cd1bbb Increase the size of ToolChain::FilePaths
In a Clang bootstrap build, the size was always at least 9.

llvm-svn: 215362
2014-08-11 16:15:57 +00:00
Daniel Jasper 5082ce0ab8 Properly #include ASTConsumer.h instead of forward declaration.
Otherwise, this can lead to compile failures if a user/subclass of
FrontendAction doesn't #include this file, even if CreateASTConsumer
isn't used directly.

llvm-svn: 215353
2014-08-11 11:37:33 +00:00
David Majnemer 8f0ed91490 Sema: Handle declspecs without declarators in records properly in C mode
We had two bugs:
- We wouldn't properly warn when a struct/union/enum was mentioned
  inside of a record definition if no declarator was provided.  We
  should have mentioned that this declaration declares nothing.
- We didn't properly support Microsoft's extension where certain
  declspecs without declarators would act as anonymous structs/unions.
  * We completely ignored the case where such a declspec could be a
    union.
  * We didn't properly handle the case where a record was defined inside
    another record:
      struct X {
        int a;
        struct Y {
          int b;
        };
      };

llvm-svn: 215347
2014-08-11 07:29:54 +00:00
NAKAMURA Takumi 69f3528c6a Revert r215331, "unique_ptrify CompilerInstance::OutputFile(s) and remove a unique_ptr around a non-owning raw_ostream in CodeGenAction::CreateASTConsumer"
It cannot be compiled on Visual Studio 2012.

  clang\include\clang/Frontend/CompilerInstance.h(153):
error C2248: 'std::unique_ptr<_Ty>::unique_ptr' : cannot access private member declared in class 'std::unique_ptr<_Ty>'
            with
            [
                _Ty=llvm::raw_ostream
            ]
            D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\memory(1447) : see declaration of 'std::unique_ptr<_Ty>::unique_ptr'
            with
            [
                _Ty=llvm::raw_ostream
            ]
            This diagnostic occurred in the compiler generated function 'clang::CompilerInstance::OutputFile::OutputFile(const clang::CompilerInstance::OutputFile &)'

llvm-svn: 215346
2014-08-11 06:53:11 +00:00
David Blaikie 3b0e32bf61 unique_ptrify CompilerInstance::OutputFile(s) and remove a unique_ptr around a non-owning raw_ostream in CodeGenAction::CreateASTConsumer
llvm-svn: 215331
2014-08-10 23:35:58 +00:00
David Blaikie 6153581a40 Out-of-line CompilerInstance::takeSema to avoid a header dependence from CompilerInstance.h on Sema.h
Hopefully this fixes the libstdc++ build on some of the buildbots after
r215321.

llvm-svn: 215325
2014-08-10 20:12:39 +00:00
David Blaikie 6beb6aa8f0 Recommit 213307: unique_ptr-ify ownership of ASTConsumers (reverted in r213325)
After post-commit review and community discussion, this seems like a
reasonable direction to continue, making ownership semantics explicit in
the source using the type system.

llvm-svn: 215323
2014-08-10 19:56:51 +00:00
David Blaikie 4422df6fa3 Remove unused CompilerInstance::takeCodeCompletionConsumer
llvm-svn: 215322
2014-08-10 19:23:01 +00:00
David Blaikie ec99b5ee0d unique_ptr-ify CompilerInstance::takeSema
llvm-svn: 215321
2014-08-10 19:14:48 +00:00
David Blaikie 6f7382ddd1 std::unique_ptr-ify the result of ASTUnit::LoadFromASTFile
llvm-svn: 215320
2014-08-10 19:08:04 +00:00
David Blaikie f62d4e772d unique_ptr-ify FrontendAction::takeCurrentASTUnit
llvm-svn: 215319
2014-08-10 17:03:42 +00:00
David Blaikie dd0e1e8d14 unique_ptr-ify FileSystemStatCache::takeNextStatCache
llvm-svn: 215318
2014-08-10 16:57:11 +00:00
David Blaikie 2721c32e47 unique_ptr-ify ASTReaderListener in the ASTReader
llvm-svn: 215317
2014-08-10 16:54:39 +00:00