Commit Graph

16 Commits

Author SHA1 Message Date
Andy Gibbs fcc699aee8 Extended VerifyDiagnosticConsumer to also verify source file for diagnostic.
VerifyDiagnosticConsumer previously would not check that the diagnostic and
its matching directive referenced the same source file.  Common practice was
to create directives that referenced other files but only by line number,
and this led to problems such as when the file containing the directive
didn't have enough lines to match the location of the diagnostic in the
other file, leading to bizarre file formatting and other oddities.

This patch causes VerifyDiagnosticConsumer to match source files as well as
line numbers.  Therefore, a new syntax is made available for directives, for
example:

// expected-error@file:line {{diagnostic message}}

This extends the @line feature where "file" is the file where the diagnostic
is generated.  The @line syntax is still available and uses the current file
for the diagnostic.  "file" can be specified either as a relative or absolute
path - although the latter has less usefulness, I think!  The #include search
paths will be used to locate the file and if it is not found an error will be
generated.

The new check is not optional: if the directive is in a different file to the
diagnostic, the file must be specified.  Therefore, a number of test-cases
have been updated with regard to this.

This closes out PR15613.

llvm-svn: 179677
2013-04-17 08:06:46 +00:00
Douglas Gregor 35b04d6fd2 Rename -fmodule-cache-path <blah> to -fmodules-cache-path=<blah> for consistency.
llvm-svn: 174645
2013-02-07 19:01:24 +00:00
Douglas Gregor c50d4924eb Use @import rather than @__experimental_modules_import, since the
latter is rather a mess to type.

llvm-svn: 169919
2012-12-11 22:11:52 +00:00
Jordan Rose b13eb8dca5 Allow -verify directives to be filtered by preprocessing.
This is accomplished by making VerifyDiagnosticsConsumer a CommentHandler,
which then only reads the -verify directives that are actually in live
blocks of code. It also makes it simpler to handle -verify directives that
appear in header files, though we still have to manually reparse some files
depending on how they are generated.

This requires some test changes. In particular, all PCH tests now have their
-verify directives outside the "header" portion of the file, using the @line
syntax added in r159978. Other tests have been modified mostly to make it
clear what is being tested, and to prevent polluting the expected output with
the directives themselves.

Patch by Andy Gibbs! (with slight modifications)

The new Frontend/verify-* tests exercise the functionality of this commit,
as well as r159978, r159979, and r160053 (Andy's other -verify enhancements).

llvm-svn: 160068
2012-07-11 19:58:23 +00:00
Ted Kremenek c1e4dd0e8e Change @import to @__experimental_modules_import. We are not ready to commit to a particular syntax for modules,
and don't have time to push it forward in the near future.

llvm-svn: 151841
2012-03-01 22:07:04 +00:00
Douglas Gregor dd7cae51d8 Test module lookup within a subdirectory of a normal include directory.
llvm-svn: 149196
2012-01-29 16:43:46 +00:00
Douglas Gregor 0bf886d41a Under -fmodules, accept #public <macroname> and #private <macroname>
to make a macro public (the default for headers) or private,
respectively.

llvm-svn: 147455
2012-01-03 18:24:14 +00:00
Douglas Gregor 22d0974b40 Introduce a non-uglified syntax for module imports in Objective-C:
@import identifier [. identifier]* ;

llvm-svn: 147452
2012-01-03 18:04:46 +00:00
Douglas Gregor fe76cfd89c When building a module with an umbrella header, warn about any headers
found within that umbrella directory that were not actually included
by the umbrella header. They should either be referenced in the module
map or included by the umbrella header.

llvm-svn: 147207
2011-12-23 00:23:59 +00:00
Douglas Gregor e89dbc1d98 When inferring a module map for a framework, infer subframework
modules for each of its subframeworks.

llvm-svn: 145957
2011-12-06 19:39:29 +00:00
Douglas Gregor ebf0049901 For modules, all macros that aren't include guards are implicitly
public. Add a __private_macro__ directive to hide a macro, similar to
the __module_private__ declaration specifier.

llvm-svn: 142188
2011-10-17 15:32:29 +00:00
Douglas Gregor 71129d5e9e When building a module, use the macro definitions on the command line
as part of the hash rather than ignoring them. This means we'll end up
building more module variants (overall), but it allows configuration
macros such as NDEBUG to work so long as they're specified via command
line. More to come in this space.

llvm-svn: 142187
2011-10-17 14:55:37 +00:00
Douglas Gregor 8455e76fa1 Teach LangOptions::resetNonModularOptions to actually do what it says it does
llvm-svn: 139791
2011-09-15 14:56: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 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