Commit Graph

11138 Commits

Author SHA1 Message Date
Chandler Carruth d9e10ecb68 Fix a significant oversight in my move of MSVC includes to the driver:
actually manage the builtin header file includes as well as the system
ones.

This one is actually debatable whether it belongs in the driver or not,
as the builtin includes are really an internal bit of implementation
goop for Clang. However, they must be included at *exactly* the right
point in the sequence of header files, which makes it essentially
impossible to have this be managed by the Frontend and the rest by the
Driver. I have terrible ideas that would "work", but I think they're
worse than putting this in the driver and making the Frontend library
even more ignorant of the environment and system on which it is being
run.

Also fix the fact that we weren't properly respecting the flags which
suppress standard system include directories.

Note that this still leaves all of the Clang tests which run CC1
directly and include builtin header files broken on Windows. I'm working
on a followup patch to address that.

llvm-svn: 143801
2011-11-05 09:24:44 +00:00
Chandler Carruth 611cb64453 Add two flags to the CC1 layer that I was hoping to avoid. We need to
encode the *exact* semantics which the header search paths internally
built by the Frontend layer have had, which is both non-user-provided,
and at times adding the implicit extern "C" bit to the directory entry.

There are lots of CC1 options that are very close, but none do quite
this, and they are all already overloaded for other purposes. In some
senses this makes the command lines more clean as it clearly indicates
which flags are exclusively used to implement internal detection of
"standard" header search paths.

Lots of the implementation of this is really crufty, due to the
surrounding cruft. It doesn't seem worth investing lots of time cleaning
this up as it isn't new, and hopefully *lots* of this code will melt
away as header search inside of the frontend becomes increasingly
trivial.

llvm-svn: 143798
2011-11-05 08:30:29 +00:00
Ted Kremenek d89a827b5c serialized diagnostics: include FixIt information in serialized diagnostics.
llvm-svn: 143776
2011-11-05 03:34:23 +00:00
Ted Kremenek f264a20721 serialized diagnostics: pull emission of filenames into diagnostic block.
llvm-svn: 143765
2011-11-05 00:10:11 +00:00
Ted Kremenek 59f1025ca0 serialized diagnostics: emit source ranges.
llvm-svn: 143762
2011-11-05 00:10:01 +00:00
Ted Kremenek 337cd2a8e2 Move definition of record/block IDs for serialized diagnostics to public header.
llvm-svn: 143761
2011-11-05 00:09:57 +00:00
Chandler Carruth 814db37f7d Switch the C++ include interface in the ToolChain to use the same naming
as the system include interface before I start adding implementations of
it to individual ToolChain implementations.

llvm-svn: 143751
2011-11-04 23:49:01 +00:00
Argyrios Kyrtzidis 088789caa6 Check for invalid after calling getSLocEntry, for safety.
llvm-svn: 143748
2011-11-04 23:43:06 +00:00
Devang Patel 384dfa4f10 Enable -flimit-debug-info by default. Now, clang lazily emits debug info for structs. Original behavior can be restored using -fno-limit-debug-info.
llvm-svn: 143733
2011-11-04 20:05:58 +00:00
Argyrios Kyrtzidis d208ef95aa [arcmt] In GC, transform NSMakeCollectable to CFBridgingRelease.
llvm-svn: 143698
2011-11-04 15:58:08 +00:00
Chandler Carruth 491db32444 Sink the handling of -fobjc-arc-cxxlib to live with the other -fobjc-arc
implementation in the driver. This cleans up the signature and semantics
of the include flag adding component of the toolchain. Another step to
ready it for holding all the InitHeaderSearch logic.

llvm-svn: 143686
2011-11-04 07:34:47 +00:00
Chandler Carruth 6bfd84f25d Add a system include management interface to the toolchain, and call it
and the C++ include management routine from the proper place when
forming preprocessor options in the driver. This is the first step to
teaching the driver to manage all of the header search paths. Currently,
these methods remain just stubs in the abstract toolchain. Subsequent
patches will flesh them out with implementations for various toolchains
based on the current code in InitHeaderSearch.cpp.

llvm-svn: 143684
2011-11-04 07:12:53 +00:00
Douglas Gregor 3c2404b31b Teach the ASTImporter to import DefinitionData bits.
llvm-svn: 143631
2011-11-03 18:07:07 +00:00
Douglas Gregor 03ba1887f0 Refactor Sema::IsSimplyAccessible slightly, to work on a DeclContext rather than a class
llvm-svn: 143615
2011-11-03 16:51:37 +00:00
Argyrios Kyrtzidis e968152564 [libclang] Add infrastructure to be able to only deserialize decls in a file region and
use it for clang_getCursor.

llvm-svn: 143605
2011-11-03 02:20:32 +00:00
Douglas Gregor 2e10cf9620 Add a printing policy flag to suppress printing "<anonymous>::" prior
to types. Enable this flag for code completion, where knowing whether
something is in an anonymous or inline namespace is actually not
useful, since you don't have to type it anyway. Fixes
<rdar://problem/10208818>.

llvm-svn: 143599
2011-11-03 00:16:13 +00:00
Eli Friedman 055c970839 Add an option to emulate the strange Apple gcc behavior of #pragma pack.
<rdar://problem/10374763>

llvm-svn: 143527
2011-11-02 01:53:16 +00:00
Fariborz Jahanian 3018b95093 objc: warn if a readonly property has a setter attribute too.
// rdar://10357768

llvm-svn: 143518
2011-11-01 23:02:16 +00:00
Anna Zaks 49ea5bf562 [analyzer] Make sink attribute part of the node profile.
This prevents caching out on nodes with different sink flag.
(This is a cleaner fix for radar://10376675).

llvm-svn: 143517
2011-11-01 22:41:19 +00:00
Anna Zaks 9e82c62222 [analyzer] Fix PR11282 - an assert in markAsSink
This is another fallout from the refactoring. We were
calling MarkAsSink on a cached out node.
(Fixes radar://10376675)

llvm-svn: 143516
2011-11-01 22:41:14 +00:00
Anna Zaks 6d319489df [analyzer] BranchNodeBuilder should not generate autotransitions.
This fixes radar://10367606

llvm-svn: 143514
2011-11-01 22:41:06 +00:00
Anna Zaks 1c887b35fb [analyzer] CheckerContext::getPredecessor() cleanup
Remove unnecessary calls to CheckerContext::getPredecessor() + Comments.

llvm-svn: 143513
2011-11-01 22:41:01 +00:00
Anna Zaks 658f977dba [analyzer] Remove the CheckerContext's destructor.
llvm-svn: 143512
2011-11-01 22:40:55 +00:00
Ted Kremenek 5d6044e413 Downgrade err_iboutlet_object_type to a warning. It was breaking a bunch of code. We will reconsider promoting it back to an error later.
llvm-svn: 143470
2011-11-01 18:08:35 +00:00
Argyrios Kyrtzidis 244ce8b204 Put a reference of the ASTReader in the ASTUnit.
This is intended for direct access of the ASTReader for uses that make
little sense to try to shoehorn in the ExternalASTSource interface.

llvm-svn: 143465
2011-11-01 17:14:15 +00:00
Argyrios Kyrtzidis b9689bb46f [libclang] For a class extension, give it a unique USR but for any property or ivar
it contains give it a USR based on its semantic context, which is the interface.

This follows what we already did for objc methods. rdar://10371669

llvm-svn: 143464
2011-11-01 17:14:12 +00:00
Sebastian Redl 72ef7bc2b5 Enable function call and some overload resolution with parameters of aggregate class type and initializer list arguments.
llvm-svn: 143462
2011-11-01 15:53:09 +00:00
Eli Friedman fcec630a57 Fix the representation of wide strings in the AST and IR so that it uses the native representation of integers for the elements. This fixes a bunch of nastiness involving
treating wide strings as a series of bytes.

Patch by Seth Cantrell.

llvm-svn: 143417
2011-11-01 02:23:42 +00:00
Eli Friedman 703e7153af Perform proper conversion for strings encoded in the source file as UTF-8. (For now, we are assuming the source character set is always UTF-8; this can be easily extended if necessary.)
Tests will be coming up in a subsequent commit.

Patch by Seth Cantrell.

llvm-svn: 143416
2011-11-01 02:14:50 +00:00
Eli Friedman 2ae0e1e279 Move ConvertUTF8toUTF32 out of #if 0, in preparation for a patch which needs it.
llvm-svn: 143415
2011-11-01 02:10:54 +00:00
Douglas Gregor d73f3ddb44 Rework the AST for the initializer of a delegating constructor, so
that it retains source location information for the type. Aside from
general goodness (being able to walk the types described in that
information), we now have a proper representation for dependent
delegating constructors. Fixes PR10457 (for real).

llvm-svn: 143410
2011-11-01 01:16:03 +00:00
Fariborz Jahanian d01ddd1d07 Improve text of a diagnostic.
llvm-svn: 143353
2011-10-31 17:27:06 +00:00
Anders Carlsson 2f1a6c3f01 In x86_64, when calling an Objective-C method that returns a _Complex long double, make sure to use the objc_msgSend_fp2ret function which ensures that the return value will be {0, 0} if the receiver is nil.
llvm-svn: 143350
2011-10-31 16:27:11 +00:00
Axel Naumann a24f2c8875 Add possibility to specify an include location for createFileIDForMemBuffer().
Useful to set up a virtual include hierarchy, e.g. to order diagnostics for ambiguous overloads from MemoryBuffers.

llvm-svn: 143347
2011-10-31 11:02:24 +00:00
Argyrios Kyrtzidis 3b36df5556 Fix the source range for ObjCInterfaces that are forward decls.
llvm-svn: 143343
2011-10-31 07:20:23 +00:00
Argyrios Kyrtzidis 6fb6003aad [PCH] Now that we store the location of a decl outside its record
make sure that we keep track of locations of replaced decls as well.

llvm-svn: 143341
2011-10-31 07:20:15 +00:00
Argyrios Kyrtzidis 6c798bebc1 [PCH] For ASTReader's FileDeclIDs also associate the Module that the
local DeclIDs came from.

llvm-svn: 143340
2011-10-31 07:20:08 +00:00
Argyrios Kyrtzidis 98b26201ab Introduce SourceManager::isLocalFileID/isLoadedFileID functions.
llvm-svn: 143339
2011-10-31 07:20:03 +00:00
Argyrios Kyrtzidis e54568d657 Have the ASTUnit associate the local declarations that get parsed with the file
that contains them.

llvm-svn: 143338
2011-10-31 07:19:59 +00:00
Peter Collingbourne f1d76db466 Add support for lazily linking bitcode files (using a new
-mlink-bitcode-file flag), and more generally llvm::Modules, before
running optimisations.

llvm-svn: 143314
2011-10-30 17:30:44 +00:00
Richard Smith 0b0a0b6174 constexpr function substitution:
Track the function invocation where an lvalue referring to a constexpr function
parameter originated from, and use it to substitute the correct argument and to
determine whether such an argument's lifetime has ended.

llvm-svn: 143296
2011-10-29 20:57:55 +00:00
Abramo Bagnara 254b63068a Fixed FriendDecl source locations.
llvm-svn: 143295
2011-10-29 20:52:52 +00:00
Richard Smith 7b553f1b19 Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it will
implicitly perform an lvalue-to-rvalue conversion if used on an lvalue
expression. Also improve the documentation of Expr::Evaluate* to indicate which
of them will accept expressions with side-effects.

llvm-svn: 143263
2011-10-29 00:50:52 +00:00
Ted Kremenek 4610ea2bcf Start work on SerializedDiagnosticPrinter, a new DiagnosticConsumer that serializes out the diagnostics for a given translation unit to a bit code file. This is a WIP.
The motivation for this new DiagnosticConsumer is to provide a way for tools invoking the compiler
to get its diagnostics via a libclang interface, rather than textually parsing the compiler output.
This gives us flexibility to change the compiler's textual output, but have a structured data format
for clients to use to get the diagnostics via a stable API.

I have no tests for this, but llvm-bcanalyzer so far shows that the emitted file is well-formed.

More work to follow.

llvm-svn: 143259
2011-10-29 00:12:39 +00:00
Fariborz Jahanian 244b187d22 objc-arc: desugar certain type and improve on diagnostic for
ownership qualifier cast which won't work.
// rdar://10244607

llvm-svn: 143258
2011-10-29 00:06:10 +00:00
Argyrios Kyrtzidis 7362e9bacb [PCH] Sort the file decls by file offset not raw source location.
Currently sorting by raw source location does work as intended but who knows
what may change in the future..

llvm-svn: 143256
2011-10-28 23:57:47 +00:00
Argyrios Kyrtzidis df53da8725 [PCH] In ASTWriter::associateDeclWithFile don't bother finding the file loc
if we are not interested in the decl.

llvm-svn: 143255
2011-10-28 23:57:43 +00:00
Douglas Gregor dba74af1b8 Move -Wc++11-compat out of -Wall. It causes trouble for clients that
define their own "nullptr" class in C++98 and build with -Wall.

llvm-svn: 143248
2011-10-28 23:11:43 +00:00
Argyrios Kyrtzidis d373247d74 Add an alias option for -error-on-deserialized-decl with joined '='.
llvm-svn: 143239
2011-10-28 22:54:24 +00:00
Argyrios Kyrtzidis 5fc727a0c2 [PCH] Keep track of file-level declarations that are contained by files.
Introduce a FILE_SORTED_DECLS [de]serialization record that contains
a file sorted array of file-level DeclIDs in a PCH/Module.
The rationale is to allow "targeted" deserialization of decls inside
a range of a source file.

Cocoa PCH increased by 0.8%
Difference of creation time for Cocoa PCH is below the noise level.

llvm-svn: 143238
2011-10-28 22:54:21 +00:00