Commit Graph

580 Commits

Author SHA1 Message Date
Douglas Gregor 9d7c1a2a18 Add support for viewing the module graph via Graphviz, for debugging
purposes.

llvm-svn: 141697
2011-10-11 19:27:55 +00:00
Eli Friedman df14b3a837 Initial implementation of __atomic_* (everything except __atomic_is_lock_free).
llvm-svn: 141632
2011-10-11 02:20:01 +00:00
John McCall f937c023bf Rename TagDecl::isDefinition -> isCompleteDefinition
for better self-documenting code, since the semantics
are subtly different from getDefinition().

llvm-svn: 141355
2011-10-07 06:10:15 +00:00
Eli Friedman 0dfb889575 Support for C1x _Atomic specifier (see testcase). This is primarily being committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic.
Thanks to Jeffrey Yasskin for the thorough review!

llvm-svn: 141330
2011-10-06 23:00:33 +00:00
Abramo Bagnara 635ed24e1d Added a flag to identify resolved overloaded function references.
llvm-svn: 141171
2011-10-05 07:56:41 +00:00
Argyrios Kyrtzidis 52f53fb303 Improve location fidelity of objc decls.
-Add the location of the class name to all objc container decls, not just ObjCInterfaceDecl.
-Make objc decls consistent with the rest of the NamedDecls and have getLocation() point to the
 class name, not the location of '@'.

llvm-svn: 141061
2011-10-04 04:48:02 +00:00
Argyrios Kyrtzidis b8c3aaf479 Allow getting all source locations of selector identifiers in a ObjCMethodDecl.
Instead of always storing all source locations for the selector identifiers
we check whether all the identifiers are in a "standard" position; "standard" position is

  -Immediately before the arguments: -(id)first:(int)x second:(int)y;
  -With a space between the arguments: -(id)first: (int)x second: (int)y;
  -For nullary selectors, immediately before ';': -(void)release;

In such cases we infer the locations instead of storing them.

llvm-svn: 140989
2011-10-03 06:37:04 +00:00
Argyrios Kyrtzidis a6011e25a1 Allow getting all source locations of selector identifiers in a ObjCMessageExpr.
Instead of always storing all source locations for the selector identifiers
we check whether all the identifiers are in a "standard" position; "standard" position is

  -Immediately before the arguments: [foo first:1 second:2]
  -With a space between the arguments: [foo first: 1 second: 2]
  -For nullary selectors, immediately before ']': [foo release]

In such cases we infer the locations instead of storing them.

llvm-svn: 140987
2011-10-03 06:36:51 +00:00
Argyrios Kyrtzidis dfd6570643 Pass from the parser the locations of selector identifiers when creating
objc method decls.

They are not stored in the AST yet.

llvm-svn: 140984
2011-10-03 06:36:36 +00:00
Argyrios Kyrtzidis 3849394b81 Don't keep NumSelectorArgs in the ObjCMethodDecl, the number can be derived from the selector.
llvm-svn: 140983
2011-10-03 06:36:29 +00:00
Argyrios Kyrtzidis 201d377109 Mark a TagDecl when it is free standing (e.g. "struct foo;")
llvm-svn: 140894
2011-09-30 22:11:31 +00:00
Daniel Dunbar e8c12a2979 Basic/Diagnostic: Add a DiagSate::getOrAddMappingInfo method.
- Also, spell const_iterator as const_iterator.

llvm-svn: 140765
2011-09-29 01:42:25 +00:00
Daniel Dunbar a3637e6894 Basic/Diagnostics: Add a DiagnosticMappingInfo helper class, and switch to
storing mappings with that instead of straying some magic constants about the
source.

llvm-svn: 140760
2011-09-29 01:30:00 +00:00
Argyrios Kyrtzidis c934ee30bd Add a comment in ASTReader::ReadPragmaDiagnosticMappings that the user bit
is set by the setDiagnosticMapping call.

llvm-svn: 140578
2011-09-26 23:06:41 +00:00
David Blaikie 9c902b5502 Rename Diagnostic to DiagnosticsEngine as per issue 5397
llvm-svn: 140478
2011-09-25 23:23:43 +00:00
Douglas Gregor 27f58c2e66 Fix up assertion a bit more
llvm-svn: 140424
2011-09-23 22:07:41 +00:00
David Blaikie aa347f9392 Removing a bunch of dead returns/breaks after llvm_unreachables.
llvm-svn: 140407
2011-09-23 20:26:49 +00:00
Douglas Gregor 4c2e38fe1e Eliminate an MSVC comparison warning, from Aaron Ballman
llvm-svn: 140388
2011-09-23 16:57:55 +00:00
David Blaikie 83d382b1ca Switch assert(0/false) llvm_unreachable.
llvm-svn: 140367
2011-09-23 05:06:16 +00:00
Argyrios Kyrtzidis e523e389b2 Do manual binary search for preprocessing entities because their end locations
may be unordered and MSVC's debug-mode doesn't like it.

llvm-svn: 140337
2011-09-22 21:17:02 +00:00
Argyrios Kyrtzidis e9a24435c6 Don't use TemplateArgumentListInfo inside AST nodes because it may leak.
Use ASTTemplateArgumentListInfo instead.

llvm-svn: 140331
2011-09-22 20:07:09 +00:00
Argyrios Kyrtzidis de6aa08013 Rename ExplicitTemplateArgumentList -> ASTTemplateArgumentListInfo, no functionality change.
llvm-svn: 140330
2011-09-22 20:07:03 +00:00
David Blaikie 9c70e04bec ArrayRef-ifying Function/BlockDecl's setParams
llvm-svn: 140268
2011-09-21 18:16:56 +00:00
Benjamin Kramer 5ce7f109cf Fix MSVC9 build by providing a full comparator object to lower_bound.
llvm-svn: 140238
2011-09-21 06:42:26 +00:00
Argyrios Kyrtzidis b573542e10 [PCH] Don't store the source range for each preprocessed entity since
we already have the range in the PPEntityOffsets array.

llvm-svn: 140209
2011-09-20 23:27:41 +00:00
Argyrios Kyrtzidis 86ec600f57 [PCH] Merge ASTReader::LoadPreprocessedEntity with ReadPreprocessedEntity
and don't store the ID for each preprocessed entity.

llvm-svn: 140208
2011-09-20 23:27:38 +00:00
Argyrios Kyrtzidis 0d48fb89c0 The location of the name in MacroDefinition is the beginning of its range,
don't store an extra location for it.

llvm-svn: 140190
2011-09-20 22:14:48 +00:00
Argyrios Kyrtzidis 5733271925 In libclang, when visiting preprocessed entities in a source range, use
PreprocessingRecord's getPreprocessedEntitiesInRange.

Also remove all the stuff that were added in ASTUnit that are unnecessary now
that we do a binary search for preprocessed entities and deserialize only
what is necessary.

llvm-svn: 140063
2011-09-19 20:40:48 +00:00
Argyrios Kyrtzidis 7f44836998 Introduce local_begin()/local_end() methods in PreprocessingRecord which
return iterators for local, non-loaded, preprocessed entities.

llvm-svn: 140062
2011-09-19 20:40:42 +00:00
Argyrios Kyrtzidis 7c06d8666b [libclang] When getting a source location from a file:line:col triplet
check whether the requested location points inside the precompiled preamble,
in which case the returned source location will be a "loaded" one.

llvm-svn: 140060
2011-09-19 20:40:35 +00:00
Argyrios Kyrtzidis 64f6381097 Introduce PreprocessingRecord::getPreprocessedEntitiesInRange()
which will do a binary search and return a pair of iterators
for preprocessed entities in the given source range.

Source ranges of preprocessed entities are stored twice currently in
the PCH/Module file but this will be fixed in a subsequent commit.

llvm-svn: 140058
2011-09-19 20:40:25 +00:00
Argyrios Kyrtzidis e6e67deeed Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.
It already works (and is useful with) macro locs as well.

llvm-svn: 140057
2011-09-19 20:40:19 +00:00
Argyrios Kyrtzidis d67164e3cd Const-ify some methods in ASTReader.
llvm-svn: 140054
2011-09-19 20:40:02 +00:00
Argyrios Kyrtzidis b527a7cbf8 [PCH] Preload the PreloadSLocEntries through the SourceManager and
don't call ReadSLocEntryRecord() directly because the entry may have
already been loaded in which case calling ReadSLocEntryRecord()
directly would trigger an assertion in SourceManager.

llvm-svn: 140052
2011-09-19 20:39:54 +00:00
Douglas Gregor 2fd3d401f9 With modules, we can end up loading a new module after we've seen an
arbitrary amount of code. This forces us to stage the AST writer more
strictly, ensuring that we don't assign a declaration ID to a
declaration until after we're certain that no more modules will get
loaded.

llvm-svn: 139974
2011-09-17 00:05:03 +00:00
Douglas Gregor 6137d32c1b When we load the first module, make sure that we wire up the ASTConsumer to the newly-created ASTReader. This makes sure that CodeGen sees the declarations it is interested in
llvm-svn: 139824
2011-09-15 18:47:32 +00:00
Argyrios Kyrtzidis 03c40c5182 [PCH] Overhaul how preprocessed entities are [de]serialized.
-Use an array of offsets for all preprocessed entities
-Get rid of the separate array of offsets for just macro definitions;
 for references to macro definitions use an index inside the preprocessed
 entities array.
-Deserialize each preprocessed entity lazily, at first request; not in bulk.

Paves the way for binary searching of preprocessed entities that will offer
efficiency and will simplify things on the libclang side a lot.

llvm-svn: 139809
2011-09-15 18:02:56 +00:00
Douglas Gregor d7910e95bd Don't try to write a macro offset for an identifier that names a non-exported macro, for real this time
llvm-svn: 139745
2011-09-14 22:14:14 +00:00
Douglas Gregor 4fe9b18182 Revert my exported-macro hackery. Something is amiss
llvm-svn: 139734
2011-09-14 20:57:14 +00:00
Douglas Gregor d48ed128e0 Make sure that we actually keep the key length and data length in sync when dealing with non-exported macros
llvm-svn: 139731
2011-09-14 20:51:12 +00:00
Douglas Gregor 4184ab0b26 Don't try to write a macro offset for an identifier that names a non-exported macro
llvm-svn: 139728
2011-09-14 20:36:30 +00:00
Argyrios Kyrtzidis a98e861939 [PCH] Fix a regression that r139441 introduced (decls were getting passed
to the consumer without being fully deserialized).

The regression was on compiling boost.python and it was too difficult to get a reduced
test case unfortunately.

Also modify the logic of how objc methods are getting passed to the consumer;
codegen depended on receiving objc methods before the implementation decl.
Since the interesting objc methods are ones with a body and such methods only
exist inside an ObjCImplDecl, deserialize and pass to consumer all the methods
of ObCImplDecl when we see one.

Fixes http://llvm.org/PR10922 & rdar://10117105.

llvm-svn: 139644
2011-09-13 21:35:00 +00:00
Douglas Gregor c2ae880070 Switch the serialization of LangOptions over to use the .def file. We
should no longer have the serialization of LangOptions out of sync
with the structure itself (yay).

llvm-svn: 139613
2011-09-13 18:26:39 +00:00
Douglas Gregor 79a91418bd Switch LangOptions over to a .def file that describes header of the
language options. Use that .def file to declare the LangOptions class
and initialize all of its members, eliminating a source of annoying
initialization bugs.

AST serialization changes are next up.

llvm-svn: 139605
2011-09-13 17:21:33 +00:00
Argyrios Kyrtzidis 309b4c49e4 Keep the source range of attributes. Depends on a llvm tablegen commit.
llvm-svn: 139600
2011-09-13 16:05:58 +00:00
Argyrios Kyrtzidis 14c32e8894 [libclang] In ASTUnit::Parse copy the CompilerInvocation object instead of
modifying directly for the preamble.

This avoids an awful, hard to find, bug where "PreprocessorOpts.DisablePCHValidation = true"
would be persistent for subsequent reparses of the translation unit which would result
in defines, present in command-line but not in the PCH, being ignored.

Fixes rdar://9615399.

llvm-svn: 139512
2011-09-12 18:09:38 +00:00
Chris Lattner d2cd41c5bf remove pedantic ;
llvm-svn: 139472
2011-09-10 16:13:42 +00:00
Douglas Gregor abc5fbe9d6 Don't crash when we fail to load a module. It's unbecoming of a
well-bred compiler like Clang.

llvm-svn: 139442
2011-09-10 00:30:18 +00:00
Douglas Gregor 87d8124b0e Clean up our handling of Objective-C definitions in AST files. Rather
than having CodeGen check whether a declaration comes from an AST file
(which it shouldn't know or care about), make sure that the AST writer and
reader pass along "interesting" declarations that CodeGen needs to
know about.

llvm-svn: 139441
2011-09-10 00:22:34 +00:00
Douglas Gregor 98c05b286c Kill of the Decl::PCHLevel field entirely. We now only need to know
whether a Decl was deserialized from an AST file (any AST file).

llvm-svn: 139438
2011-09-10 00:09:20 +00:00