Commit Graph

55 Commits

Author SHA1 Message Date
Alexey Samsonov d1127d2d1f Avoid having "using namespace" for both "clang" and "llvm" namespaces.
This is fragile, as there are classes with the same name in both
namespaces (e.g. llvm::Module and clang::Module).

llvm-svn: 219855
2014-10-15 22:00: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
Rafael Espindola d87f8d76e0 Update for LLVM api change.
llvm-svn: 216585
2014-08-27 20:03:29 +00:00
NAKAMURA Takumi 036f713f17 [CMake] LexTests: Prune redundant libdep(s).
llvm-svn: 213853
2014-07-24 11:44:03 +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
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
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
Benjamin Kramer f3ca269839 Decouple ExprCXX.h and DeclCXX.h and clean up includes a bit.
Required pulling LambdaExpr::Capture into its own header.
No functionality change.

llvm-svn: 208470
2014-05-10 16:31:55 +00:00
Alp Toker 0804343733 Eliminate ASTContext's DelayInitialization flag
Having various possible states of initialization following construction doesn't
add value here.

Also remove the unused size_reserve parameter.

llvm-svn: 207897
2014-05-03 03:46:04 +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
Chandler Carruth 5553d0d4ca Sort all the #include lines with LLVM's utils/sort_includes.py which
encodes the canonical rules for LLVM's style. I noticed this had drifted
quite a bit when cleaning up LLVM, so wanted to clean up Clang as well.

llvm-svn: 198686
2014-01-07 11:51:46 +00:00
NAKAMURA Takumi ac85179219 [CMake] Update target_link_libraries() and LLVM_LINK_COMPONENTS for each CMakeLists.txt.
llvm-svn: 196916
2013-12-10 12:40:37 +00:00
Manuel Klimek 1f76c4e810 Use the same SourceManager for ModuleMaps and compilations.
This allows using virtual file mappings on the original SourceManager to
map in virtual module.map files. Without this patch, the ModuleMap
search will find a module.map file (as the FileEntry exists in the
FileManager), but will be unable to get the content from the
SourceManager (as ModuleMap previously created its own SourceManager).

Two problems needed to be fixed which this patch exposed:

1. Storing the inferred module map
When writing out a module, the ASTWriter stores the names of the files
in the main source manager; when loading the AST again, the ASTReader
errs out if such a file is found missing, unless it is overridden.
Previously CompilerInstance's compileModule method would store the
inferred module map to a temporary file; the problem with this approach
is that now that the module map is handled by the main source manager,
the ASTWriter stores the name of the temporary module map as source to
the compilation; later, when the module is loaded, the temporary file
has already been deleted, which leads to a compilation error. This patch
changes the inferred module map to instead inject a virtual file into
the source manager. This both saves some disk IO, and works with how the
ASTWriter/ASTReader handle overridden source files.

2. Changing test input in test/Modules/Inputs/*
Now that the module map file is handled by the main source manager, the
VerifyDiagnosticConsumer will not ignore diagnostics created while
parsing the module map file. The module test test/Modules/renamed.m uses
-I test/Modules/Inputs and triggers recursive loading of all module maps
in test/Modules/Inputs, some of which had conflicting names, thus
leading errors while parsing the module maps. Those diagnostics already
occur on trunk, but before this patch they would not break the test, as
they were ignored by the VerifyDiagnosticConsumer. This patch thus
changes the module maps that have been recently introduced which broke
the invariant of compatible modules maps in test/Modules/Inputs.

llvm-svn: 193314
2013-10-24 07:51:24 +00:00
Alexey Samsonov 05747f3734 Fix use-after-free in PPCallbacksTest detected by ASan bootstrap bot
llvm-svn: 192572
2013-10-14 07:13:59 +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
Rafael Espindola 552c169ed3 Include Path.h instead of PathV2.h.
I am about to move PathV2.h to Path.h.

llvm-svn: 183795
2013-06-11 22:15:02 +00:00
Argyrios Kyrtzidis 065d720c31 [Lexer] Improve Lexer::getSourceText() when the given range deals with function macro arguments.
This is a modified version of a patch by Manuel Klimek.

llvm-svn: 182055
2013-05-16 21:37:39 +00:00
Douglas Gregor fb9126578e <rdar://problem/12368093> Extend module maps with a 'conflict' declaration, and warn when a newly-imported module conflicts with an already-imported module.
llvm-svn: 177577
2013-03-20 21:10:35 +00:00
Argyrios Kyrtzidis 125df0589b For ModuleLoader::makeModuleVisible() also pass the source location where the
module import occurred.

llvm-svn: 174191
2013-02-01 16:36:12 +00:00
Daniel Dunbar ae4feb62e0 [Lex] Remove DirectoryLookup.UserSpecified, which is unused.
llvm-svn: 173409
2013-01-25 01:50:28 +00:00
NAKAMURA Takumi e73d2a9fff clang/unittests: Fixup corresponding to r172290.
llvm-svn: 172295
2013-01-12 02:16:29 +00:00
Chandler Carruth fa0b3bb7ec Really sort the #include lines in unittests/...
I forgot to re-sort after fixing main module headers.

llvm-svn: 169244
2012-12-04 09:53:37 +00:00
Chandler Carruth 320d9666ee Sort the #include lines for unittests/...
I've tried to place sensible headers at the top as main-module headers.

llvm-svn: 169243
2012-12-04 09:45:34 +00:00
NAKAMURA Takumi 0e0c3aa560 clang/Lex: [CMake] Update CMakefiles since r169229.
llvm-svn: 169233
2012-12-04 07:40:33 +00:00
Argyrios Kyrtzidis f3d587ea7c Refactor recording the preprocessor conditional directive regions out of
PreprocessingRecord and into its own class, PPConditionalDirectiveRecord.

Decoupling allows a client to use the functionality of PPConditionalDirectiveRecord
without needing a PreprocessingRecord.

llvm-svn: 169229
2012-12-04 07:27:05 +00:00
Douglas Gregor 8c05893746 Fix unit tests for ModuleLoader change in r168961.
llvm-svn: 168962
2012-11-30 00:01:57 +00:00
NAKAMURA Takumi fe40a35075 clang/unittests: Fixup corresponding to Doug's r168136.
llvm-svn: 168137
2012-11-16 04:40:11 +00:00
Benjamin Kramer f9db130715 Escape trigraphs in unittest.
llvm-svn: 167359
2012-11-03 20:58:26 +00:00
Argyrios Kyrtzidis 2edbc86809 Make the FilenameRange of the InclusionDirective callback more accurate,
preserve the macro location of the range end if the filename came from a macro.

Patch by Kim Gräsman!

llvm-svn: 167239
2012-11-01 17:52:58 +00:00
Douglas Gregor 1452ff155b Teach the preprocessor to hold onto the preprocessor options.
llvm-svn: 166599
2012-10-24 17:46:57 +00:00
Douglas Gregor 40ba1a0191 Update unit tests for HeaderSearch change
llvm-svn: 166584
2012-10-24 16:24:38 +00:00
Douglas Gregor 3f7d548a16 One last unit-test fix
llvm-svn: 166513
2012-10-23 22:43:37 +00:00
Douglas Gregor edf8e38701 More unit-test fixes
llvm-svn: 166511
2012-10-23 22:38:58 +00:00
Douglas Gregor d8cfd399fa Fixup unit tests for DiagnosticOptions change
llvm-svn: 166509
2012-10-23 22:31:51 +00:00
Douglas Gregor 44d6361ed7 Fix the handling of target options in our unit tests.
llvm-svn: 166079
2012-10-17 00:11:35 +00:00
Chandler Carruth 016bbd88cf Clang side of a refactoring of the CMake unit test build strategy.
The fundamental change is to put a CMakeLists.txt file in the unittest
directory, with a single test binary produced from it. This has several
advantages.

Among other fundamental advantages, we start to get the checking logic
for when a file is missing from the CMake build, and this caught one
missing file already! More fun details in the LLVM commit corresponding
to this one.

Note that the LLVM commit and this one most both be applied, or neither.
Sorry for any skew issues.

llvm-svn: 158910
2012-06-21 09:51:42 +00:00
Fariborz Jahanian 461b7bb9e6 get rid of an unsued variable warning.
llvm-svn: 152146
2012-03-06 21:18:56 +00:00
Ted Kremenek f7639e1b4a Add new code migrator support for migrating existing Objective-C code to use
the new Objective-C NSArray/NSDictionary/NSNumber literal syntax.

This introduces a new library, libEdit, which provides a new way to support
migration of code that improves on the original ARC migrator.  We now believe
that most of its functionality can be refactored into the existing libraries,
and thus this new library may shortly disappear.

llvm-svn: 152141
2012-03-06 20:06:33 +00:00
Argyrios Kyrtzidis 647dcd80f0 [preprocessor] Enhance PreprocessingRecord to keep track of locations of conditional directives.
Introduce PreprocessingRecord::rangeIntersectsConditionalDirective() which returns
true if a given range intersects with a conditional directive block.

llvm-svn: 152018
2012-03-05 05:48:17 +00:00
Dylan Noblesmith c95d81924d Basic: import IntrusiveRefCntPtr<> into clang namespace
The class name is long enough without the llvm:: added.
Also bring in RefCountedBase and RefCountedBaseVPTR.

llvm-svn: 150958
2012-02-20 14:00:23 +00:00
Argyrios Kyrtzidis 0d9e24b1db Change Lexer::makeFileCharRange() to have it accept a CharSourceRange
instead of a SourceRange, and handle the case where the range is
a char (not token) range.

llvm-svn: 149677
2012-02-03 05:58:29 +00:00
Douglas Gregor 8992928274 Thread a TargetInfo through to the module map; we'll need it for
target-specific module requirements.

llvm-svn: 149224
2012-01-30 06:01:29 +00:00
Argyrios Kyrtzidis abff5f1271 Improve Lexer::getImmediateMacroName to take into account inner macros
of macro arguments.

For "MAC1( MAC2(foo) )" and location of 'foo' token it would return
"MAC1" instead of "MAC2".

llvm-svn: 148704
2012-01-23 16:58:33 +00:00
Argyrios Kyrtzidis 85e7671b71 Enhance Lexer::makeFileCharRange to check for ranges inside a macro argument
expansion, in which case it returns a file range in the location where the
argument was spelled.

llvm-svn: 148551
2012-01-20 16:52:43 +00:00