Commit Graph

3758 Commits

Author SHA1 Message Date
Richard Smith e37391c4fe [modules] Round-trip -Werror flag through explicit module build.
The intent for an explicit module build is that the diagnostics produced within
the module are those that were configured when the module was built, not those
that are enabled within a user of the module. This includes diagnostics that
don't actually show up until the module is used (for instance, diagnostics
produced during template instantiation and weird cases like -Wpadded).

We serialized and restored the diagnostic state for individual warning groups,
but previously did not track the state for flags like -Werror and -Weverything,
which are implemented as separate bits rather than as part of the diagnostics
mapping information.

llvm-svn: 301992
2017-05-03 00:28:49 +00:00
Emilio Cobos Alvarez c7ed9d9f1c [libclang] Revert rL301328 and add tests for the regressions introduced.
Differential Revision: https://reviews.llvm.org/D32566

llvm-svn: 301902
2017-05-02 08:32:15 +00:00
Emilio Cobos Alvarez 485ad42521 [libclang] Expose some target information via the C API.
This allows users to query the target triple and target pointer width, which
would make me able to fix https://github.com/servo/rust-bindgen/issues/593 and
other related bugs in an elegant way (without having to manually parse the
target triple in the command line arguments).

Differential Revision: https://reviews.llvm.org/D32389

llvm-svn: 301648
2017-04-28 15:56:39 +00:00
Tim Northover cdc549329f libclang: remove unused variable.
llvm-svn: 301585
2017-04-27 20:22:40 +00:00
Argyrios Kyrtzidis 2a68486c8f [libclang] Enhance clang_Cursor_isDynamicCall and clang_Cursor_getReceiverType to handle ObjC property references
Also enhance clang_Cursor_getReceiverType to handle C++ method calls.

llvm-svn: 301568
2017-04-27 17:23:04 +00:00
Alex Lorenz cb00640c05 [libclang] Pass in the -fallow-editor-placeholders option
This will suppress any live diagnostics caused by editor placeholders in Xcode.

rdar://31833579

llvm-svn: 301542
2017-04-27 13:47:03 +00:00
Vedant Kumar 349a624ab9 Revert "Revert "PPCallbacks::MacroUndefined, change signature and add test.""
This reverts commit r301469. It isn't needed with r301470, which fixes
the API break introduced in the original commit.

llvm-svn: 301472
2017-04-26 21:05:44 +00:00
Vedant Kumar 5e511ed49c Revert "PPCallbacks::MacroUndefined, change signature and add test."
This reverts commit r301449. It breaks the build with:

  MacroPPCallbacks.h:114:50: error: non-virtual member function marked 'override' hides virtual member function

llvm-svn: 301469
2017-04-26 20:58:19 +00:00
Frederich Munch b7755111a2 PPCallbacks::MacroUndefined, change signature and add test.
Summary:
The PPCallbacks::MacroUndefined callback is currently insufficient for clients that need to track the MacroDirectives.
This patch adds an additional argument to PPCallbacks::MacroUndefined that is the undef MacroDirective.

Reviewers: bruno, manmanren

Reviewed By: bruno

Subscribers: nemanjai, cfe-commits

Differential Revision: https://reviews.llvm.org/D29923

llvm-svn: 301449
2017-04-26 19:47:31 +00:00
Alex Lorenz 3c0ede7f7a [libclang] Check for a record declaration before a template specialization
Fixes PR32539.

Patch by Emilio Cobos Álvarez!

Differential Revision: https://reviews.llvm.org/D32348

llvm-svn: 301328
2017-04-25 16:59:07 +00:00
Argyrios Kyrtzidis b4b85f2033 [index] If the 'external_source_symbol' attribute indicates 'Swift' as the language then report it accordingly
llvm-svn: 301183
2017-04-24 14:52:00 +00:00
Krasimir Georgiev bcda54b69d [clang-format] Replace IncompleteFormat by a struct with Line
Summary: This patch replaces the boolean IncompleteFormat that is used to notify the client if an unrecoverable syntax error occurred by a struct that also contains a line number.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D32298

llvm-svn: 300985
2017-04-21 14:35:20 +00:00
Eric Fiselier 3f5152d212 Fix Python 2 vs 3 incompatability with dict.items() vs iteritems()
llvm-svn: 300895
2017-04-20 21:23:58 +00:00
Eric Fiselier 58bef5d8e8 Begin making git-clang-format python3 compatible.
This patch fixes most of the python3 incompatabilities
within git-clang-format while keeping the script python2 compatible.
There is still one remaining incompatability that prevents using Python3
which is the `str` vs `byte` type change. I plan to put those fixes
up for review separately.

This patch contains fixes for the following incompatabilities:

1) Use the new style Python3 `print` function. This requires importing
   __future__.print_function.

2) Fix incompatability between the Python3 octal prefix and the
   octal prefix Git uses.

3) Replace use of dict.iteritems() with dict.viewitems() because iteritems()
   has been removed in Python3. viewitems() reviews python 2.7 but that is
   also what the script is documented as requiring.

llvm-svn: 300891
2017-04-20 21:05:58 +00:00
Kostya Serebryany 5af4515788 Fix a leak in tools/driver/cc1as_main.cpp
Summary: For some reason, the asan bot has recently started reporting this leak even though it existed for ages.

Reviewers: pcc

Reviewed By: pcc

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D32243

llvm-svn: 300755
2017-04-19 20:57:13 +00:00
Hans Wennborg 3e2576a768 clang-format-vs licence.txt: drop svn:executable
Not sure how it ended up with that property in the first place.

llvm-svn: 300245
2017-04-13 20:09:18 +00:00
Hans Wennborg 2b092273ac Follow-up to r300225: update ClangFormat.csproj too
llvm-svn: 300231
2017-04-13 18:15:00 +00:00
Hans Wennborg 8b9f1ab78d Follow-up to r300225: update ClangFormat.sln to VS2017
This got lost in the previous patch somehow.

llvm-svn: 300226
2017-04-13 17:47:47 +00:00
Hans Wennborg b5d892b5b9 Warning-free clang-format plugin install for VS 15.0
With the new release of VS, it's required that all plugins migrate to
the new VSIX manifest format. The new format is backwards compatible
with all versions newer that Visual Studio 2012, so this migration
effectively drops support for older versions of the IDE.

It's also required that these new extensions are built with Visual
Studio 2017, so unfortunately it was necessary to migrate the project
and solution. Also removed COM references to EnvDTE and
Microsoft.VisualStudio.TextManager.Interop from the csproj, as they seem
to both be unnecessary and would trigger build warnings because of
changes to GAC.

Patch by Hugo Puhlmann!

Differential Revision: https://reviews.llvm.org/D31740

llvm-svn: 300225
2017-04-13 17:42:45 +00:00
Hans Wennborg f3d30c3b19 clang-format-vs: Use a separate license.txt copy
The regular file used to display very poorly in the VSIX installer due
to long lines, wrapping etc.

llvm-svn: 300223
2017-04-13 17:37:17 +00:00
Bruno Cardoso Lopes 52dfe71645 [Driver] Add compiler option to generate a reproducer
One way to currently test the reproducers is to setup
"FORCE_CLANG_DIAGNOSTICS_CRASH=1" before invoking clang. This simulates
a crash and produces the same contents needed by the reproducers.  The
reproducers are specially useful when triaging Modules issues, not only
on crashes, but also for reproducing misleading warnings, errors, etc.

Add a '-gen-reproducer' driver option to clang (or any similar name) and
give users a flag option.

Note that clang already has a -fno-crash-diagnostics, which disables the
crash reproducers. I've decided not to propose "-fcrash-diagnostics"
since it doesn't convey the ideia of reproduction despite a crash.

rdar://problem/24114619

Differential Revision: https://reviews.llvm.org/D27604

llvm-svn: 300109
2017-04-12 21:46:20 +00:00
Sean Callanan b7160ca466 [clang-import-test] Lookup inside contexts
clang-import-test has until now been only able to report top-level Decls.
This is clearly insufficient; we should be able to look inside structs 
and namespaces also.  This patch adds new test cases for a variety of 
lookups inside existing ASTContexts, and adds the functionality necessar
to make most of these testcases work.  (One testcase is known to fail 
because of ASTImporter limitations when importing templates; I'll look 
into that separately.)

This patch also separates the core functionality out into 
ExternalASTMerger, an interface that allows clients like LLDB to make 
use of it.  clang-import-test now only has the machinery necessary to
set up the tests.

Differential revision: https://reviews.llvm.org/D30435

llvm-svn: 299976
2017-04-11 19:33:35 +00:00
Laszlo Nagy 6d9a7e8aaf [scan-build-py] merge runner module to analyzer
Differential Revision: https://reviews.llvm.org/D31237

llvm-svn: 299759
2017-04-07 11:04:49 +00:00
Antonio Maiorano a16ab5aee5 clang-format-vsix: Add "Format on Save" feature
This change adds a feature to the clang-format VS extension that optionally
enables the automatic formatting of documents when saving. Since developers
always need to save their files, this eases the workflow of making sure source
files are properly formatted.

Differential Revision: https://reviews.llvm.org/D29221

llvm-svn: 299543
2017-04-05 14:13:45 +00:00
Hans Wennborg 9d7df75c9c clang-format vs plugin support for Visual Studio 2017
With the release of Visual Studio 2017, we need to at the very least
claim support for it in the current manifest file. With the changes
introducted in this patch we can install the extension again, but a
warning message will be shown stating that it's not supported
(https://twitter.com/parsley72/status/846558416751411200).

To get the rid of the warning more work is necessary, as VS 2017 changed
some things about extensions, see more here:
https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-migrate-extensibility-projects-to-visual-studio-2017.
While working on those changes, it has been suggested in the
mail list that this first patch is integrated in the meantime.

Patch by Hugo Puhlmann!

Differential Revision: https://reviews.llvm.org/D31522

llvm-svn: 299210
2017-03-31 12:50:42 +00:00
Simon Pilgrim 2c51880a82 Spelling mistakes in comments. NFCI. (PR27635)
llvm-svn: 299083
2017-03-30 14:13:19 +00:00
Krasimir Georgiev c4d5c25737 [libclang] Bury dead TemporaryFiles
Summary:
AllocatedCXCodeCompleteResults::TemporaryFiles have turned into zombies.
Seven years ago they used to do their job during [[ 313e26c4e8/tools/CIndex/CIndexCodeCompletion.cpp (diff-02d3e692ad507b10af9458b775c5750bL261) | file remapping]], but now they are created just to be torn down in the destructor.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D31288

llvm-svn: 298697
2017-03-24 09:49:54 +00:00
Jonathan Roelofs 7121c00966 Actually install scan-build / ccc-analyzer / c++-analyzer on windows
Before, we were only installing the wrappers... oops.

llvm-svn: 298549
2017-03-22 21:13:49 +00:00
Benjamin Kramer f6021ecddc Apply clang-tidy's performance-unnecessary-value-param to parts of clang.
No functionality change intended.

llvm-svn: 298443
2017-03-21 21:35:04 +00:00
Argyrios Kyrtzidis 4e5a65fc83 [c-index-test] Fix memory leak in c-index-test tool.
llvm-svn: 298441
2017-03-21 21:34:05 +00:00
Argyrios Kyrtzidis 3b25c91a9e [index/AST] Determine if a typedef shares a name and spelling location with its underlying tag type
In such a case, as when using the NS_ENUM macro, for indexing purposes treat the typedef as 'transparent',
meaning we treat its references as symbols of the underlying tag symbol.
Also provide a libclang API to check for such typedefs.

llvm-svn: 298392
2017-03-21 16:56:02 +00:00
Laszlo Nagy 57db7c6860 [scan-build-py] reuse command line output parameter for report directory
Differential Revision: https://reviews.llvm.org/D30861

llvm-svn: 298355
2017-03-21 10:15:18 +00:00
Laszlo Nagy 0d9be63001 [scan-build-py] use python tempfile for tempdir
Differential Revision: https://reviews.llvm.org/D30862

llvm-svn: 298238
2017-03-20 09:03:24 +00:00
Reid Kleckner a902600881 Create msbuild only when using MSVC
Patch by: Mateusz Mikula

Reviewers: rnk

Reviewed By: rnk

Subscribers: asl, mgorny, cfe-commits

Tags: #clang-c

Differential Revision: https://reviews.llvm.org/D29772

llvm-svn: 297998
2017-03-16 21:21:00 +00:00
Richard Smith 3a36ac1af5 Add -cc1 flag -ast-dump-all to perform an AST dump including entities that haven't yet been deserialized.
llvm-svn: 297412
2017-03-09 22:00:01 +00:00
Laszlo Nagy 908ed4c90a [scan-build-py] move argument parsing into separate module
Forgot to add the new module.

llvm-svn: 297308
2017-03-08 21:22:32 +00:00
Laszlo Nagy 5270bb978f [scan-build-py] move argument parsing into separate module
Differential Revision: https://reviews.llvm.org/D30601

llvm-svn: 297307
2017-03-08 21:18:51 +00:00
Laszlo Nagy ed739d902d [scan-build-py] fix some line separator issues
Differential Revision: https://reviews.llvm.org/D30600

llvm-svn: 297266
2017-03-08 09:27:53 +00:00
Eric Fiselier 20f25cb6df [coroutines] Add DependentCoawaitExpr and fix re-building CoroutineBodyStmt.
Summary:
The changes contained in this patch are:

1. Defines a new AST node `CoawaitDependentExpr` for representing co_await expressions while the promise type is still dependent.
2. Correctly detect and transform the 'co_await' operand to  `p.await_transform(<expr>)`  when possible.
3. Change the initial/final suspend points to build during the initial parse, so they have the correct operator co_await lookup results.
4.  Fix transformation of the CoroutineBodyStmt so that it doesn't re-build the final/initial suspends.


@rsmith: This change is a little big, but it's not trivial for me to split it up. Please let me know if you would prefer this submitted as multiple patches.



Reviewers: rsmith, GorNishanov

Reviewed By: rsmith

Subscribers: ABataev, rsmith, mehdi_amini, cfe-commits

Differential Revision: https://reviews.llvm.org/D26057

llvm-svn: 297093
2017-03-06 23:38:15 +00:00
Laszlo Nagy 2e9c9220b6 [scan-build-py] create decorator for compiler wrapper methods
Differential Revision: https://reviews.llvm.org/D29260

llvm-svn: 296937
2017-03-04 01:08:05 +00:00
Vassil Vassilev 3dd966b0ce Add coding and shebang.
Reviewed by Artem Dergachev (D26030)!

llvm-svn: 296781
2017-03-02 18:47:22 +00:00
Nico Weber 65da45763e clang-format: Don't leave behind temp files in -i mode on Windows, PR26125, reloaded
Second attempt after http://llvm.org/viewvc/llvm-project?rev=296166&view=rev

In the first attempt, Code (the memory buffer backing the input file) was reset
before overwriteChangedFiles() was called, but overwriteChangedFiles() still
reads from it.  This time, load the whole input file into memory instead of
using mmap when formatting in-place.

(Since the test is identical to what was in the repo before chapuni's revert,
svn diff doesn't show it – see the above link for the test.)

https://reviews.llvm.org/D30385

llvm-svn: 296408
2017-02-27 22:59:58 +00:00
Argyrios Kyrtzidis 6d1a15b2d4 [index] Add 'Parameter' symbol kind and 'Local' symbol property to distinguish function-local symbols
Parameters have a 'child' relation to their function/method.
Also add an option '-include-locals' to 'c-index-test core' to enable indexing of function-local symbols.

Original patch from Nathan Hawes with some changes by me.
https://reviews.llvm.org/D30304

llvm-svn: 296282
2017-02-26 05:37:56 +00:00
NAKAMURA Takumi d274dc3896 Revert r296166, "clang-format: Don't leave behind temp files in -i mode on Windows, PR26125", and r296171.
(MemoryBuffer)Code.reset() was too early.

  ==26912== Invalid read of size 1
  ==26912==    at 0x437E1D: llvm::MemoryBuffer::init(char const*, char const*, bool) (MemoryBuffer.cpp:47)
  ==26912==    by 0x438013: (anonymous namespace)::MemoryBufferMem::MemoryBufferMem(llvm::StringRef, bool) (MemoryBuffer.cpp:86)
  ==26912==    by 0x438128: llvm::MemoryBuffer::getMemBuffer(llvm::StringRef, llvm::StringRef, bool) (MemoryBuffer.cpp:112)
  ==26912==    by 0x4E189D: clang::vfs::detail::(anonymous namespace)::InMemoryFileAdaptor::getBuffer(llvm::Twine const&, long, bool, bool) (VirtualFileSystem.cpp:443)
  ==26912==    by 0x4DF5BA: clang::vfs::FileSystem::getBufferForFile(llvm::Twine const&, long, bool, bool) (VirtualFileSystem.cpp:94)
  ==26912==    by 0x4B72EC: clang::FileManager::getBufferForFile(clang::FileEntry const*, bool, bool) (FileManager.cpp:443)
  ==26912==    by 0x4C1F81: clang::SrcMgr::ContentCache::getBuffer(clang::DiagnosticsEngine&, clang::SourceManager const&, clang::SourceLocation, bool*) const (SourceManager.cpp:98)
  ==26912==    by 0x4C50E5: clang::SourceManager::getBufferData(clang::FileID, bool*) const (SourceManager.cpp:689)
  ==26912==    by 0x58E794: clang::Rewriter::getEditBuffer(clang::FileID) (Rewriter.cpp:230)
  ==26912==    by 0x407297: clang::format::format(llvm::StringRef) (ClangFormat.cpp:311)
  ==26912==    by 0x4078D7: main (ClangFormat.cpp:363)

llvm-svn: 296237
2017-02-25 03:45:49 +00:00
Nico Weber cc0573b03f clang-format: Don't leave behind temp files in -i mode on Windows, PR26125
Fix and analysis by Wei Mao <weimao1@gmail.com> (see bug), test by me.

llvm-svn: 296166
2017-02-24 20:49:00 +00:00
Argyrios Kyrtzidis 0af90586e7 [c-index-test] For the 'core' invocation, avoid running it under a new thread.
It's unnecessary.

llvm-svn: 295934
2017-02-23 05:51:47 +00:00
Richard Smith 0aef305f35 Cleanup: use range-based for rather than separate calls to begin and end.
llvm-svn: 295524
2017-02-18 01:14:43 +00:00
Richard Smith bc491203c7 Add an explicit derived class of FunctionDecl to model deduction guides rather
than just treating them as FunctionDecls with a funny name.

No functionality change intended.

llvm-svn: 295491
2017-02-17 20:05:37 +00:00
Anastasia Stulova 58984e7087 [OpenCL] Correct ndrange_t implementation
Removed ndrange_t as Clang builtin type and added
as a struct type in the OpenCL header.

Use type name to do the Sema checking in enqueue_kernel
and modify IR generation accordingly.

Review: D28058

Patch by Dmitry Borisenkov!  
 

llvm-svn: 295311
2017-02-16 12:27:47 +00:00
Rafael Espindola 46f68f50f0 Fix the static build.
llvm-svn: 295245
2017-02-15 22:19:04 +00:00