Commit Graph

2149 Commits

Author SHA1 Message Date
Chandler Carruth 07c346d220 Move two functions out of the public interface that shouldn't have ever
been there. Also delete their redundant doxyments in favor of those in
the source file. I'm putting the doxyments for private and static
helpers into the implementation file, and only the public interface
doxyments into the header. If folks have strong opinions about this type
of split, feel free to chime in, I'm happy to re-organize.

llvm-svn: 142087
2011-10-15 23:48:02 +00:00
Chandler Carruth a302885b33 Graduate the TextDiagnostic interface to its own header and source file,
making it accessible to anyone from the Frontend library. Still a good
bit of cleanup to do here, but its a good milestone. This ensures that
*all* of the functionality needed to implement the DiagnosticConsumer is
exposed via the generic interface in some form. No sneaky re-use of
static functions.

llvm-svn: 142086
2011-10-15 23:43:53 +00:00
Chandler Carruth 76576db69d Move the message printing to a class-static function so that it can be
part of the TextDiagnostic interface without requiring a full instance.

llvm-svn: 142085
2011-10-15 22:57:29 +00:00
Chandler Carruth 3fc93892ae Move the diagnostic level printing into a class static helper. This will
allow the TextDiagnosticPrinter to continue using it even if
TextDiagnostic is implemented in a separate file.

llvm-svn: 142084
2011-10-15 22:49:21 +00:00
Chandler Carruth 3b73f83d3a Rationalize the last bit of "arbitrary" state that is carried between
diagnostics to control suppression of redundant information. It now
follows the same model as all the other state, and has a bit more clear
semantics.

This is making the duality of the state a bit annoying, and I've added
a FIXME to resolve it. The problem is that I need to lift the
TextDiagnostic up into an externally visible layer before that can
happen.

llvm-svn: 142083
2011-10-15 22:39:16 +00:00
Chandler Carruth 02b88ca980 Neither 'Warning' nor 'NonNote' was a good name for this location...
It's the last include-stack-root we tried to walk up. Use a better name
and better doxyments for it.

llvm-svn: 142071
2011-10-15 12:12:44 +00:00
Chandler Carruth c9b1c180ff Nuke a bunch of FIXMEs that are now fixed. =] Also, remove the now-dead
TextDiagnosticPrinter argument to the TextDiagnostic helper class. This
cements the proper ordering of things: TextDiagnostic is now a viable
stand-alone class for emitting pretty-printed textual diagnostics to
a terminal.

llvm-svn: 142070
2011-10-15 12:07:49 +00:00
Chandler Carruth 636b2501bb Sink the include stack printing into the generic text diagnostic
utility. This is a particularly nice win because it removes a pile of
parameters from these routines. Also name them a bit better. I'm trying
to follow the pattern of 'emit' routines writing directly to what is
expected to be the final output, while 'print' routines take a output
stream argument and can be used to build up intermediate buffers, etc.

Also, fix a bug I spotted by inspection from my last commit where
'LastLoc' and 'LastNonNoteLoc' were reversed. It's really scary that
this didn't trigger a single test failure. Will be working on tests for
more of this functionality now.

llvm-svn: 142069
2011-10-15 12:07:47 +00:00
Chandler Carruth 3d262187f6 Rationalize some of how the locations of prior diagnostics are tracked
across emissions.

1) The include stack printing is conditioned on non-note diagnostics,
   not just on warning diagnostics.
2) Those should be full source locations as they're tied to a source
   manager.
3) We should pass in the prior state to the TextDiagnostic constructor,
   allow it to mutate as diagnostics are emitted, and then cache the
   final state before tearing it down.

Some of this remains incomplete, specifically #3 isn't finished for the
non-note location. That'll come when the include stack printing sinks
down a level.

This also highlights how *completely* bug-ridden this code is. For
example, we currently do all these comparisons of a FullSourceLoc and
a SourceLocation... which silently does a SourceLocation to
SourceLocation comparison, completely disregarding the source manager
from whence one of the arguments came. Oops! Good thing in practice this
wasn't important, but it could in theory be suppressing caret
diagnostics in a second TU on a single clang invocation. I'm hoping to
hammer these bugs out as the refactorings occur, although for so many of
them it's really unlikely I can dream up a test case that would show the
potentially buggy behavior.

llvm-svn: 142067
2011-10-15 11:44:27 +00:00
Chandler Carruth 99eb7dc85f Sink the EmitDiagnosticLoc method down to the generic TextDiagnostic
interface now that its only caller is there.

llvm-svn: 142065
2011-10-15 11:09:23 +00:00
Chandler Carruth c38c7b1b1a Sink the non-caret diagnostic logic down and out of the diagnostic
consumer. The TextDiagnostic interface now has a generic entry point for
emitting a diagnostic which uses a minimal interface that should be
compatible with StoredDiagnostics such as are available in libclang etc.

Some unfortunate shuffling of static functions as things get relocated.
Also some unfortunate public interface points added to
TextDiagnosticPrinter, but those are the next bits to get moved so they
won't last long.

llvm-svn: 142064
2011-10-15 11:09:19 +00:00
Chandler Carruth 342327cac2 Simplify the interface of a helper method in the TextDiagnosticPrinter
to operate directly on the source location and ranges associated with
a diagnostic rather than digging them out of the diagnostic. This had
a side benefit of cleaning up its code a tiny bit by using the ArrayRef
interface.

No functionality changed.

llvm-svn: 142063
2011-10-15 10:48:19 +00:00
Chandler Carruth 09c7464312 Change 'Emit' to 'EmitCaret' which sums up what it *should* be doing.
Also note that it is actually doing much more than it should. This paves
the way for building a more generic 'Emit' routine that is the real
entry point here.

llvm-svn: 142035
2011-10-15 01:21:55 +00:00
Argyrios Kyrtzidis 1ac5da1017 Allow calling ASTUnit::LoadFromCompilerInvocationAction with a previously created ASTUnit.
llvm-svn: 142004
2011-10-14 21:22:05 +00:00
Benjamin Kramer b89514a9b8 Change operator<< for raw_ostream and NamedDecl to take a reference instead of a pointer.
Passing a pointer was a bad idea as it collides with the overload for void*.

llvm-svn: 141971
2011-10-14 18:45:37 +00:00
Daniel Dunbar b25bfde52d Frontend: Replace -nostdinc by -nostdsysteminc (which is just system include
paths). The -nostdinc behavior is now -nostdsysteminc + -nobuiltininc.

llvm-svn: 141691
2011-10-11 18:20:10 +00:00
Argyrios Kyrtzidis 7a70d2f11b For the FileChanged Preprocessor callback, when exiting a file, pass its FileID.
llvm-svn: 141681
2011-10-11 17:29:44 +00:00
Argyrios Kyrtzidis ebf0136956 [libclang] Implement ConcurrencyCheck using a recursive mutex to allow re-entrancy in the same thread.
The checks are performed only in DEBUG, it becomes no-op in release mode.

llvm-svn: 141582
2011-10-10 21:57:12 +00:00
Francois Pichet 698f019efb Revert r140009, about disabling clang's builtin in -fms-compatibility mode.
llvm-svn: 141577
2011-10-10 20:34:10 +00:00
Chad Rosier fd3c90c620 When an included non-system directory duplicates a system directory the clang
frontend removes the non-system directory to maintain gcc compatibility.  When
this happens NumAngled needs to be updated.
PR11097

llvm-svn: 141565
2011-10-10 18:44:24 +00:00
Peter Collingbourne 1deb5b61f4 OpenCL: add driver/frontend support for precompiled headers
llvm-svn: 141516
2011-10-09 22:03:19 +00:00
NAKAMURA Takumi 0010bd96c9 lib/Frontend/CompilerInstance.cpp: Suppress a "Comparision of unsigned and signed" warning on Cygwin gcc-4.3.4.
llvm-svn: 141488
2011-10-08 11:31:58 +00:00
NAKAMURA Takumi 82a351197f Whitespace
llvm-svn: 141486
2011-10-08 11:31:46 +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
Peter Collingbourne a9455ec9f8 CUDA: add -fcuda-is-device flag
This frontend-only flag is used by the IR generator to determine
whether to filter CUDA declarations for the host or for the device.

llvm-svn: 141301
2011-10-06 18:29:46 +00:00
Daniel Dunbar 096ed290a1 Driver & AST: Implement support for -fpack-struct and -fpack-struct= command
line options.
 - <rdar://problem/10120602>, PR9631

llvm-svn: 141211
2011-10-05 21:04:55 +00:00
Douglas Gregor a04a46e8f4 Seriously ugly hack, part 2
llvm-svn: 141181
2011-10-05 14:59:36 +00:00
Douglas Gregor 10312ab129 Seriously ugly hack to try to get the Windows builders back online
llvm-svn: 141180
2011-10-05 14:58:46 +00:00
Douglas Gregor 54a888108a Introduce a simple file-based locking protocol for on-demand module
creation, so that only a single Clang instance will rebuild a given
module at once (and the others will wait).

We still don't clean up the lock files when we crash, which is a
rather unfortunate problem. I'll handle that next, and there is
certainly a *lot* of room for further improvements.

llvm-svn: 141179
2011-10-05 14:53:30 +00:00
Justin Holewinski 83aacf82e7 Fix include path detection on Fedora 15 with GCC 4.6.1. Patch by Arthur Haas.
llvm-svn: 141086
2011-10-04 15:35:52 +00:00
Bob Wilson 05de0298d2 Rip out flags for controlling C++ "production mode" separately.
This is old leftover cruft from the days when C++ was not yet ready
for prime time.

llvm-svn: 141063
2011-10-04 05:34:14 +00:00
Douglas Gregor 51e0b54197 When build a module on demand, run the module-building job on a
separate thread with the "suitably large" stack, so we don't blow the
stack when building modules recursively.

llvm-svn: 141051
2011-10-04 00:21:21 +00:00
John McCall 9b0a7cea0f Make -fobjc-nonfragile-abi the -cc1 default, since it's the
increasingly prevailing case to the point that new features
like ARC don't even support the fragile ABI anymore.

This required a little bit of reshuffling with exceptions
because a check was assuming that ObjCNonFragileABI was
only being set in ObjC mode, and that's actually a bit
obnoxious to do.

Most, though, it involved a perl script to translate a ton
of test cases.

Mostly no functionality change for driver users, although
there are corner cases with disabling language-specific
exceptions that we should handle more correctly now.

llvm-svn: 140957
2011-10-02 01:16:38 +00:00
Anna Zaks 8d4c8e1498 [analyzer] Add -analyzer-purge option which can take on multiple values, remove -analyzer-purge=none. (Small refactor as well: move the work of constructing AnalysisManager from the callers to the class itself.)
llvm-svn: 140838
2011-09-30 02:03:00 +00:00
Daniel Dunbar aa11138543 Basic/Diagnostics: Add an isDefaultMappingAsError method, and switch TextDiagnosticPrinter to use that instead of extracting the current mapping via getDiagnosticLevel, which fixes one class of corner cases w.r.t. printing the "-Werror" diagnostic option marker.
- The TextDiagnosticPrinter code is still fragile as it is just "reverse engineering" what the diagnostic engine is doing. Not my current priority to fix though.

llvm-svn: 140752
2011-09-29 01:01:08 +00:00
Daniel Dunbar c2e5ca6e50 Basic/Diagnostic: Factor out
DiagnosticsEngine::setDiagnosticGroup{ErrorAsFatal,WarningAsError} methods which
more accurately model the correct API -- no internal change to the diagnostics
engine yet though.
 - Also, stop honoring -Werror=everything (etc.) as a valid (but oddly behaved) option.

llvm-svn: 140747
2011-09-29 00:53:47 +00:00
Douglas Gregor 44e688d46a Introduce an opt-in warning when a module is being implicitly built
from sources.

llvm-svn: 140746
2011-09-29 00:52:27 +00:00
Douglas Gregor d0e9e3a6a5 Introduce a pure virtual clone() method to DiagnosticConsumer, so that
we have the ability to create a new, distict diagnostic consumer when
we go off and build a module. This avoids the currently horribleness
where the same diagnostic consumer sees diagnostics for multiple
translation units (and multiple SourceManagers!) causing all sorts of havok.

llvm-svn: 140743
2011-09-29 00:38:00 +00:00
Chad Rosier 011824f747 [driver] Add basic support for escaping XML characters in CC_LOG_DIAGNOSTICS
strings.
rdar://9696709

llvm-svn: 140732
2011-09-28 23:05:07 +00:00
Douglas Gregor eaed8d57dd Remove the egregious hack that made Objective-C++ ARC work with older
versions of libc++. Newer versions of libc++ know how to deal with ARC
properly. Fixes <rdar://problem/10062179>.

llvm-svn: 140651
2011-09-27 22:48:19 +00:00
Douglas Gregor c0b07286cf When 'bool' is not a built-in type but is defined as a macro, print
'bool' rather than '_Bool' within types, to make things a bit more
readable. Fixes <rdar://problem/10063263>.

llvm-svn: 140650
2011-09-27 22:38:19 +00:00
Chandler Carruth 374eaa9c4e Add back support for a manually formatted section of the diagnostic
message. Specifically, we now only line-wrap the first line of te
diagnostic message and assume the remainder is manually formatted. While
adding it back, simplify the logic for doing this.

Finally, add a test that ensures we actually preserve this feature. =D
*Now* its not dead code. Thanks to Doug for the test case.

llvm-svn: 140538
2011-09-26 16:43:25 +00:00
Chandler Carruth 577372ea15 Hoist and beef up the asserts about the level of infrastructure expected
when working with a diagnostic attached to a source location. Also
comment more thoroughly why its important to handle non-location
diagnostic messages separately.

Finally, hoist the creation of the TextDiagnostic object up to the
beginning of the location-based diagnostics. This paves the way for
sinking more and more of the logic into this class. When everything
below this constructor is sunk into the TextDiagnostic class it should
be sufficiently "feature complete" to accomplish my two goals:
1) Have the printing of a macro expansion note use the exact same code
   as any other note.
2) Be able to implement clang_formatDiagnostic in terms of this class.

llvm-svn: 140526
2011-09-26 11:38:46 +00:00
Chandler Carruth 2be992d570 Switch the emission of diagnostics without a source location to
a dedicated path. The logic for such diagnostics is much simpler than
for others.

This begins to make an important separation in this routine. We expect
most (and most interesting) textual diagnostics to be made in the
presence of at least *some* source locations and a source manager.
However the DiagnosticConsumer must be prepared to diagnose errors even
when the source manager doesn't (yet) exist or when there is no location
information at all. In order to sink more and more logic into the
TextDiagnostic class while minimizing its complexity, my plan is to
force the DiagnosticConsumer to special case diagnosing any locationless
messages and then hand the rest to the TextDiagnostic class. I'd
appreciate any comments on this design. It requires a bit of code
duplication in order to keep interfaces simple. Alternatively, if we
really need TextDiagnostic to be capable of handling diagnostics even in
the absence of a viable SourceManager, then this split isn't necessary.

llvm-svn: 140525
2011-09-26 11:25:30 +00:00
Chandler Carruth c0fe585e0c Extract the actual printing of the message string into a helper
function. Doing this conveniently requires moving the word wrapping to
use a StringRef which seems generally an improvement. There is a lot
that could be simplified in the word wrapping by using StringRef that
I haven't looked at yet...

llvm-svn: 140524
2011-09-26 11:19:35 +00:00
Chandler Carruth bae3c7c833 Group the helpers for word wrapping with the primary routine. No
functionality changed.

llvm-svn: 140523
2011-09-26 10:58:00 +00:00
Argyrios Kyrtzidis 4cdfcae75d Don't map a file:line:col triplet that is inside the preamble range to
a "loaded" location of the precompiled preamble.

Instead, handle specially locations of preprocessed entities:
-When looking up for preprocessed entities, map main file locations inside the
 preamble range to a preamble loaded location.
-When getting the source range of a preprocessing cursor, map preamble loaded
 locations back to main file locations.

Fixes rdar://10175093 & http://llvm.org/PR10999

llvm-svn: 140519
2011-09-26 08:01:41 +00:00
Benjamin Kramer e2125d8278 Don't print a stray ] at the end of diagnostics.
Also remove an obsolete utostr call.

llvm-svn: 140511
2011-09-26 02:14:13 +00:00
Chandler Carruth d16b42ef92 Remove support for splitting word-wrapped diagnostic messages on newline
characters. I could find no newline character in a diagnostic message,
and adding an assert to this code never fires in the testsuite.

I think this code is essentially dead, and was previously used for
a different purpose. If I just don't understand how it is we can end up
with a newline here please let me know (with a test case?) and I'll
revert.

llvm-svn: 140497
2011-09-26 01:44:29 +00:00
Chandler Carruth b1e536bb3a Move the word wrapped printing routine down to all the other helper
printing routines, clean up its doxyments and switch it to a camelCase
name as well. No functionality changed here.

llvm-svn: 140496
2011-09-26 01:44:27 +00:00
Chandler Carruth cf259a47e2 Switch some of my recently added helper functions to use the proper
style, and add doxyments.

llvm-svn: 140495
2011-09-26 01:30:09 +00:00
Chandler Carruth 0059a9bee0 Rewrite the printing of diagnostic options, categories, etc to actually
use the ostream interface and avoid lots of temporary strings.

llvm-svn: 140494
2011-09-26 01:21:58 +00:00
David Blaikie b5784324b3 Rename DiagnosticInfo to Diagnostic as per issue 5397
llvm-svn: 140493
2011-09-26 01:18:08 +00:00
Chandler Carruth 292e76939b Delete an extraneous line I missed.
llvm-svn: 140491
2011-09-26 00:45:02 +00:00
Chandler Carruth 6074084fa8 A direct extraction of the rest of the option printing into a helper.
This needs to be cleaned up to better use the ostream object, WIP.

llvm-svn: 140490
2011-09-26 00:44:09 +00:00
David Blaikie 69609dcead Rename VerifyDiagnosticsClient to VerifyDiagnosticConsumer as per issue 5397
llvm-svn: 140489
2011-09-26 00:38:03 +00:00
Chandler Carruth b59f9cb9ce Start a more correct pattern for factoring out the name printing. Slowly
I'm planning to switch a bunch of these over to use a raw_ostream
instead of += on a string object.

llvm-svn: 140488
2011-09-26 00:37:30 +00:00
Chandler Carruth 09c65ce3a3 Revert r140484. That was *not* ready to be committed! Only halfway done,
and completely broken at that.

Sorry, must remember to stash rather than commit. =]

llvm-svn: 140487
2011-09-26 00:26:47 +00:00
Chandler Carruth 6849652cf8 Fix a formatting goof.
llvm-svn: 140486
2011-09-26 00:21:50 +00:00
David Blaikie 8b00dcb03b Rename ChainedDiagnosticClient to ChainedDiagnosticConsumer as per issue 5397
llvm-svn: 140485
2011-09-26 00:21:47 +00:00
Chandler Carruth b7e3f42a01 Extract the diagnostic message formatting into a helper routine.
llvm-svn: 140484
2011-09-26 00:21:47 +00:00
David Blaikie f18d91a4b2 Rename StoredDiagnosticClient to StoredDiagnosticConsumer as per issue 5397
llvm-svn: 140483
2011-09-26 00:01:39 +00:00
Chandler Carruth 0216058a97 Extract the logic for printing a colorful level name into a helper
function.

llvm-svn: 140481
2011-09-25 23:51:01 +00:00
David Blaikie e2eefaecc8 Rename DiagnosticClient to DiagnosticConsumer as per issue 5397
llvm-svn: 140479
2011-09-25 23:39:51 +00:00
David Blaikie 9c902b5502 Rename Diagnostic to DiagnosticsEngine as per issue 5397
llvm-svn: 140478
2011-09-25 23:23:43 +00:00
Chandler Carruth 74e2c35fbc Inline this method now that its completely trivial, and prepare for
hoisting parts of the text diagnostic.

llvm-svn: 140477
2011-09-25 23:01:05 +00:00
Chandler Carruth 84f361950f Shuffle some names around. 'CaretDiagnostic' is inaccurate as this needs
to handle non-caret diagnostics as well in order to be fully useful in
libclang etc. Also sketch out some more of my plans on this refactoring.

llvm-svn: 140476
2011-09-25 22:54:56 +00:00
Chandler Carruth 3236f0d25c Actually remove the members of CaretDiagnostic no longer in use for
tracking the start and stop of macro expansion suppression. Also remove
the Columns variable which was just a convenience variable based on
DiagOpts. Instead we materialize it in the one piece of code that cared.

llvm-svn: 140475
2011-09-25 22:31:58 +00:00
Chandler Carruth cb8f82a8e5 Sink the logic for suppressing some macro expansion notes from the
TextDiagnosticPrinter into the CaretDiagnostic class. Several
interesting results from this:

- This removes a significant per-diagnostic bit of state from the
  CaretDiagnostic class, which should eventually allow us to re-use the
  object.
- It removes a redundant recursive walk of the macro expansion stack
  just to compute the depth. We don't need the depth until we're
  unwinding anyways, so we can just mark when we reach it.
- It also paves the way for several simplifications we can do to how we
  implement the suppression.

llvm-svn: 140474
2011-09-25 22:27:52 +00:00
Chandler Carruth 9d229f3eb1 Split the recursive macro expansion walk out from the routine which
emits a source snippet and caret line.

llvm-svn: 140467
2011-09-25 06:59:38 +00:00
Douglas Gregor 52da28be50 Don't translate CRLF files into LF files. Fixes PR6870, from Aaron Ballman!
llvm-svn: 140435
2011-09-23 23:43:36 +00:00
David Blaikie 7900020616 More missing header inclusions from llvm_unreachable migration.
llvm-svn: 140369
2011-09-23 05:57:42 +00:00
David Blaikie 83d382b1ca Switch assert(0/false) llvm_unreachable.
llvm-svn: 140367
2011-09-23 05:06:16 +00:00
Benjamin Kramer 559865c89d Reenable -cxx-isystem for Objective C++, until I come up with a better solution
llvm-svn: 140365
2011-09-23 02:25:14 +00:00
Benjamin Kramer 8404eb0bad Add support for CPATH and friends.
This moves the existing code for CPATH into the driver and adds the environment lookup and path splitting there.
The paths are then passed down to cc1 with -I options (CPATH), added after the normal user-specified include dirs.
Language specific paths are passed via -LANG-isystem and the actual filtering is performed in the frontend.

I tried to match GCC's behavior as close as possible

Fixes PR8971.

llvm-svn: 140341
2011-09-22 21:41:16 +00:00
Tobias Grosser 0a3a22fe66 In the OpenCL mode, the AltiVec mode must be off and checks must be strict
OpenCL is different from AltiVec in the way it supports vector literals.  OpenCL
is strict with regards to semantic checks.  For example, implicit conversions
and explicit casts between vectors of different types are disallowed.

Fixes PR10975. Submitted by: Anton Lokhmotov <Anton.lokhmotov@gmail.com>

llvm-svn: 140270
2011-09-21 18:28:29 +00:00
Eric Christopher 5507159245 Remove __WCHAR_UNSIGNED__ and anything that used it.
llvm-svn: 140155
2011-09-20 18:05:01 +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 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
Francois Pichet 26e809692a Do not use builtin includes if -fms-compatibility is specified. Some MSVC header files have the same name as clang's builtins, this creates clash.
llvm-svn: 140009
2011-09-19 05:15:54 +00:00
Francois Pichet 0706d203cf Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag.
Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag.

llvm-svn: 139987
2011-09-17 17:15:52 +00:00
Francois Pichet 1b4f1637fb As per discussion with Doug Gregor on the IRC channel, introduce a new compiler switch: -fms-compatility.
Microsoft specific tweaking will now fall into 2 categories:

    - fms-extension: Microsoft specific extensions that should never change the meaning of an otherwise well formed code. Currently map to LangOptions::Microsoft. (To be clearer, I am planning to change the name to LangOptions::MicrosoftExt).

    - fms-compatibility: Really a MSVC emulation mode. Map to LangOptions::MicrosoftMode. Can change the meaning of an otherwise standard conformant program.

llvm-svn: 139978
2011-09-17 04:32:15 +00:00
Douglas Gregor 97eec24b0b Add an experimental flag -fauto-module-import that automatically turns
#include or #import direcctives of framework headers into module
imports of the corresponding framework module.

llvm-svn: 139860
2011-09-15 22:00:41 +00:00
Douglas Gregor 44bf68d819 Comment what's going on when we compile a module
llvm-svn: 139837
2011-09-15 20:53:28 +00:00
Douglas Gregor dff0e892db Detect cyclic module dependencies in a manner that is rather more
graceful than running out of stack space.

llvm-svn: 139833
2011-09-15 20:40:10 +00:00
Douglas Gregor 900d4bf80a Eliminate the list of modules from the preprocessor options. This was
used back when we had an -import-module command-line option, but it's
no longer used (or useful).

llvm-svn: 139829
2011-09-15 19:48:59 +00:00
Douglas Gregor 8a880e3ff6 Eliminate the unused -create-module cc1-level option
llvm-svn: 139827
2011-09-15 19:45:56 +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 21931efc4d Make -E work with module imports
llvm-svn: 139750
2011-09-14 23:13:09 +00:00
Douglas Gregor a739d9a023 Encode the module hash in base-36, to reduce the length of the strings a bit
llvm-svn: 139696
2011-09-14 15:55:12 +00:00
Douglas Gregor 3728ea75d9 Assert that the module hash produced after stripping away non-modular options is the same as the module hash before stripping those options.
llvm-svn: 139663
2011-09-13 23:20:27 +00:00
Douglas Gregor 1735f4e752 For modules, use a hash of the compiler version, language options, and
target triple to separate modules built under different
conditions. The hash is used to create a subdirectory in the module
cache path where other invocations of the compiler (with the same
version, language options, etc.) can find the precompiled modules.

llvm-svn: 139662
2011-09-13 23:15:45 +00:00
Douglas Gregor f1312a828a When building a module on-demand, clear out the "non-modular" language
and preprocessor options (such as macro definitions) first.

llvm-svn: 139638
2011-09-13 20:44:41 +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
Douglas Gregor 2b9b464290 When compiling a module on-demand, re-use the diagnostics client
already provided. This required a little bit of clean-up in the way
that VerifyDiagnosticsClient managed ownership of its underlying
"primary" client, because now it will no longer always take ownership.

llvm-svn: 139570
2011-09-13 01:26:44 +00:00
Douglas Gregor faeb1d4658 When an import statement fails to find a module in the module cache,
but there is a corresponding umbrella header in a framework, build the
module on-the-fly so it can be immediately loaded at the import
statement. This is very much proof-of-concept code, with details to be
fleshed out over time.

llvm-svn: 139558
2011-09-12 23:31:24 +00:00
Douglas Gregor 1e44e02292 Introduce a cc1-level option to provide the path to the module cache,
where the compiler will look for module files. Eliminates the
egregious hack where we looked into the header search paths for
modules.

llvm-svn: 139538
2011-09-12 20:41:59 +00:00