Commit Graph

87 Commits

Author SHA1 Message Date
Chandler Carruth 575bc3ba62 [cleanup] Re-sort the #include lines using llvm/utils/sort_includes.py
No functionality changed, this is a purely mechanical cleanup to ensure
the #include order remains consistent across the project.

llvm-svn: 225975
2015-01-14 11:23:58 +00:00
Richard Smith a2686713ef Make DiagnosticErrorTrap work even if SuppressAllDiagnostics is enabled.
Patch by Brad King!

llvm-svn: 223525
2014-12-05 21:52:58 +00:00
Benjamin Kramer a885796d5f Make VFS and FileManager match the current MemoryBuffer API.
This eliminates converting back and forth between the 3 formats and
gives us a more homogeneous interface.

llvm-svn: 220657
2014-10-26 22:44:13 +00:00
Fariborz Jahanian 5afc869f96 Adds 'override' to overriding methods. NFC.
These were uncoveredby my yet undelivered patch.

llvm-svn: 218774
2014-10-01 16:56:40 +00:00
Craig Topper b8a7053055 Unique_ptrify PPCallbacks ownership.
Unique_ptr creation stil needs to be moved earlier at some of the call sites.

llvm-svn: 217474
2014-09-10 04:53:53 +00:00
David Blaikie 50a5f97e82 unique_ptrify SourceManager::createFileID
llvm-svn: 216715
2014-08-29 07:59:55 +00:00
David Blaikie 49cc3181a2 Overload SourceManager::overrideFileContents so that unconditionally passing ownership is explicitly done using unique_ptr.
Only those callers who are dynamically passing ownership should need the
3 argument form. Those accepting the default ("do pass ownership")
should do so explicitly with a unique_ptr now.

llvm-svn: 216614
2014-08-27 20:54:45 +00:00
Rafael Espindola d87f8d76e0 Update for LLVM api change.
llvm-svn: 216585
2014-08-27 20:03:29 +00:00
Rafael Espindola 91ac8dfa9d Create a std::unique_ptr earlier.
Thanks to David Blaikie for the suggestion.

llvm-svn: 215865
2014-08-17 23:27:13 +00:00
Rafael Espindola 04ab21d75d Convert a few ownership comments with std::unique_ptr.
llvm-svn: 215853
2014-08-17 22:12:58 +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
Benjamin Kramer 46741758c1 Update unit test for signature change.
llvm-svn: 212545
2014-07-08 16:07:39 +00:00
Alp Toker 80758084f7 Use non-intrusive refcounting for TargetOptions
llvm-svn: 212388
2014-07-06 05:26:44 +00:00
Alp Toker f994cef836 Track IntrusiveRefCntPtr::get() changes from LLVM r212366
llvm-svn: 212369
2014-07-05 03:08:06 +00:00
Ben Langmuir 7c9f6c86c9 Add vfs::recursive_directory_iterator
For now, this is only used by its unit tests.  It is similar to the API
in llvm::sys::fs::recursive_directory_iterator, but without some of the
more complex features like requesting that the iterator not recurse into
the next directory, for example.

llvm-svn: 211732
2014-06-25 20:25:40 +00:00
NAKAMURA Takumi 4669bd49a2 VirtualFileSystemTest.cpp: Get rid of initializer list on std::vector, to appease msc17.
llvm-svn: 211662
2014-06-25 04:34:10 +00:00
NAKAMURA Takumi d3235e0529 Reformat.
llvm-svn: 211661
2014-06-25 04:34:00 +00:00
Ben Langmuir efb8b6019e Fix test issues from r211623 and remove test-only API
1) missing iterator bits needed by libstdc++4.7
Using find_if was convenient, but since operator++ wasn't a good
interface anyway, I just replaced with a range-based for loop and
removed operator++ from the directory_iterator class.

2) stop relying on order of iterating real files

llvm-svn: 211633
2014-06-24 21:08:13 +00:00
Ben Langmuir c6326a46ea Disable the bits of r211623 that broke the bots
Part of my test seems to rely on iterator bits that I didn't implement,
at least in the gcc bots. Disabling while I investigate.

llvm-svn: 211625
2014-06-24 20:00:30 +00:00
Ben Langmuir 740812bb9a Add directory_iterator for (non-recursive) iteration of VFS directories
The API is based on sys::fs::directory_iterator, but it allows iterating
over overlays and the yaml-based VFS.  For now, it isn't used by
anything (except its tests).

llvm-svn: 211623
2014-06-24 19:37:16 +00:00
Rafael Espindola 71de0b61cb Update for llvm api change.
llvm-svn: 210921
2014-06-13 17:20:50 +00:00
Rafael Espindola 8e650d7bf0 Refer to error_code with the std prefix.
llvm-svn: 210817
2014-06-12 20:37:59 +00:00
Rafael Espindola 1f24317d87 Fix msvc unittest build.
Looks like msvc has an asymmetrical operator ==.

llvm-svn: 210768
2014-06-12 11:35:17 +00:00
Rafael Espindola 96b033006d Use std::error_code instead of llvm::error_code.
This is an update for a llvm api change.

llvm-svn: 210688
2014-06-11 19:05:55 +00:00
Craig Topper 416fa34b87 [C++11] Use 'nullptr'. Unittests edition.
llvm-svn: 210423
2014-06-08 08:38:12 +00:00
Alp Toker 1d257e1d0a Remove the last remaining llvm/Config/config.h includes
This corrects long-standing misuses of LLVM's internal config.h.

In most cases the public llvm-config.h header was intended and we can now
remove the old hacks thanks to LLVM r210144.

The config.h header is private, won't be installed and should no longer be
included by clang or other modules.

llvm-svn: 210145
2014-06-04 03:28:55 +00:00
Rafael Espindola 3ae0620a45 There is no std::errc:success, remove the llvm one.
llvm-svn: 209959
2014-05-31 03:20:52 +00:00
Rafael Espindola fd148d0b6f Use make_error_code in preparation for making errc an enum class.
llvm-svn: 209956
2014-05-31 02:23:01 +00:00
Alp Toker b671e34c36 SourceManager: Use setMainFileID() consistently
Eliminate createMainFileID() / createMainFileIDForMemBuffer() utility
functions. These didn't add much convenience and conflated two distinct
operations.

This change makes things easier to follow by providing a consistent interface
and getting rid of a bunch of cast-to-voids.

llvm-svn: 209266
2014-05-21 01:12:41 +00:00
Alp Toker 9663780e35 Reformat code following Preprocessor constructor updates
Landing this separately to make the previous commits easy to follow at home.

llvm-svn: 207826
2014-05-02 03:43:38 +00:00
Alp Toker 1ae02f68be Factor TargetInfo pointer/DelayInitialization bool pair out of Preprocessor ctor
The Preprocessor::Initialize() function already offers a clear interface to
achieve this, further reducing the confusing number of states a newly
constructed preprocessor can have.

llvm-svn: 207825
2014-05-02 03:43:30 +00:00
John Thompson 2d94bbb0c0 Quick fix for layering that broke shared library build.
llvm-svn: 207011
2014-04-23 19:04:32 +00:00
John Thompson 2255f2ce90 Initial implementation of -modules-earch-all option, for searching for symbols in non-imported modules.
llvm-svn: 206977
2014-04-23 12:57:01 +00:00
Hans Wennborg 501eadb429 Check for LLVM_ON_WIN32 instead of _WIN32.
This is a follow-up to r203624 to address Anton's comment.

llvm-svn: 203668
2014-03-12 16:07:46 +00:00
Ahmed Charles b89843299a Replace OwningPtr with std::unique_ptr.
This compiles cleanly with lldb/lld/clang-tools-extra/llvm.

llvm-svn: 203279
2014-03-07 20:03:18 +00:00
Ben Langmuir 9385323747 Attempt to re-enable the VFS unittests on Windows
Using a //net/ path to hopefully avoid problems with non-absolute paths
on Windows.

llvm-svn: 203010
2014-03-05 21:32:20 +00:00
NAKAMURA Takumi 6a927ecb7a Disable BasicTests/VFS on win32 for now. Investigating.
Failing Tests (5):
    Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.CaseInsensitive
    Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.MappedFiles
    Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.MultiComponentPath
    Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.TrailingSlashes
    Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.UseExternalName

llvm-svn: 202952
2014-03-05 09:10:04 +00:00
Ben Langmuir d066d4c849 Reapply fixed "Honour 'use-external-names' in FileManager"
Was r202442

There were two issues with the original patch that have now been fixed.
1. We were memset'ing over a FileEntry in a test case. After adding a
   std::string to FileEntry, this still happened to not break for me.
2. I didn't pass the FileManager into the new compiler instance in
   compileModule. This was hidden in some cases by the fact I didn't
   clear the module cache in the test.

Also, I changed the copy constructor for FileEntry, which was memcpy'ing
in a (now) unsafe way.

llvm-svn: 202539
2014-02-28 21:16:07 +00:00
Ben Langmuir 1b8d44f59b Revert "Honour 'use-external-names' in FileManager"
Revert r202442, which broke the buildbots.

llvm-svn: 202443
2014-02-27 23:48:03 +00:00
Ben Langmuir 09e0d5c1bb Honour 'use-external-names' in FileManager
Pass through the externally-visible names that we got from the VFS down
to FileManager, and test that this is the name showing up in __FILE__,
diagnostics, and debug information.

llvm-svn: 202442
2014-02-27 23:27:54 +00:00
Ben Langmuir b59cf679e8 Add a 'use-external-names' option to VFS overlay files
When true, sets the name of the file to be the name from
'external-contents'. Otherwise, you get the virtual path that the file
was looked up by. This will not affect any non-virtual paths, or fully
virtual paths (for which there is no reasonable 'external' name anyway).

The setting is available globally, but can be overriden on a per-file
basis.

The goal is that this setting will control which path you see in debug
info, diagnostics, etc. which are sensitive to which path is used. That
will come in future patches that pass the name through to FileManager.

llvm-svn: 202329
2014-02-27 00:25:12 +00:00
Ben Langmuir 47ff9ab1be Allow multi-component paths in VFS file nodes
This allows the 'name' field to contain a path, like

{ 'type': 'directory',
  'name': '/path/to/dir',
  'contents': [ ... ] }

which not only simplifies reading and writing these files (for humans),
but makes it possible to easily modify locations via textual
replacement, which would not have worked in the old scheme.

E.g. sed s:<ROOT>:<NEW ROOT>

llvm-svn: 202109
2014-02-25 04:34:14 +00:00
Ben Langmuir 509fe8fd63 Improve some gtest assertions
As requested during review, compare pointers to NULL explicitly to make what's
going on more clear.

llvm-svn: 202090
2014-02-24 23:44:17 +00:00
Ben Langmuir 97882e7b7f Pass through context for DiagHandler in VFS
This allows the unit tests to not use global state when checking
diagnostics.

llvm-svn: 202072
2014-02-24 20:56:37 +00:00
Ben Langmuir d51ba0b39f Add a VFSFromYAML class and a parser to create it
Provides a way to create a virtual file system using a YAML file that
supports mapping a file to a path on an 'external' file system. The
external file system will typically be the 'real' file system, but for
testing it can be changed.

A future patch will add a clang option to allow the user to specify such
a file and overlay it, but for now this code is only exercised by the
unit tests.

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

llvm-svn: 201905
2014-02-21 23:39:37 +00:00
Ben Langmuir c8130a74f4 Recommit virtual file system
Previously reverted in r201755 due to causing an assertion failure.

I've removed the offending assertion, and taught the CompilerInstance to
create a default virtual file system inside createFileManager. In the
future, we should be able to reach into the CompilerInvocation to
customize this behaviour without breaking clients that don't care.

llvm-svn: 201818
2014-02-20 21:59:23 +00:00
Juergen Ributzka a32575e4f6 Reverting the virtual file system implementation, because it triggers an assertion
in our internal build bots.

This reverts commits 201618, 201635, 201636, 201639, 201685, 201691, and 201696.

llvm-svn: 201755
2014-02-20 05:24:58 +00:00
Ben Langmuir ac7a74a836 Fix some test issues in VirtualFileSystemTest
Use camel-case names, remove some dead code, and fix a copy-and-pasted test.

llvm-svn: 201691
2014-02-19 15:58:49 +00:00
Ben Langmuir 6f95efb683 Attempt to appease C++11 buildbots
Explicit operator bool doesn't not play nicely with gtest assertion
macros (i.e. it performs as advertised and I wish that gtest subverted
it for me).

llvm-svn: 201639
2014-02-19 04:17:47 +00:00
Ben Langmuir 87ba87bc4d Add an OverlayFileSystem class
Provides a way to merge multiple vfs::FileSystem objects into a single
filesystem.

llvm-svn: 201635
2014-02-19 03:29:17 +00:00