Commit Graph

2242 Commits

Author SHA1 Message Date
Douglas Gregor ad01b31b94 Add a "Modules" language option, which subsumes the previous
"AutoModuleImport" preprocessor option and is tied to -fmodules.

llvm-svn: 147448
2012-01-03 17:07:34 +00:00
Douglas Gregor 2f197adeeb Rename the command-line option for mapping #include/#import over to
module imports from -fauto-module-import to -fmodules. The new name
will eventually be used to enable modules, and the #include/#import
mapping is a crucial part of the feature.

llvm-svn: 147447
2012-01-03 15:21:29 +00:00
Chandler Carruth 3a5ff5cbd2 Teach the frontend to provide the builtin preprocessor defines for
-ffast-math.

llvm-svn: 147440
2012-01-03 02:46:46 +00:00
Chandler Carruth 306bd2c6aa Fix PR11685 by implementing -ffast-math and its various friends in the
Clang driver. This involves a bunch of silly option parsing code to try
to carefully emulate GCC's options. Currently, this takes a conservative
approach, and unless all of the unsafe optimizations are enabled, none
of them are. The fine grained control doesn't seem particularly useful.
If it ever becomes useful, we can add that to LLVM first, and then
expose it here.

This also fixes a few tiny bugs in the flag management around
-fhonor-infinities and -fhonor-nans; the flags now form proper sets both
for enabling and disabling, with the last flag winning.

I've also implemented a moderately terrifying GCC feature where
a language change is also provided by the '-ffast-math' flag by defining
the __FAST_MATH__ preprocessor macro. This feature is tracked and
serialized in the frontend but it isn't used yet. A subsequent patch
will add the preprocessor macro and tests for it.

I've manually tested that codegen appears to respect this, but I've not
dug in enough to see if there is an easy way to test codegen options w/o
relying on the particulars of LLVM's optimizations.

llvm-svn: 147434
2012-01-02 14:19:45 +00:00
Douglas Gregor f610267581 Eliminate ObjCForwardProtocolDecl, which is redundant now that
ObjCProtocolDecl modules forward declarations properly.

llvm-svn: 147415
2012-01-01 21:23:57 +00:00
Douglas Gregor 1fb5c3a63a Implement support for module requirements, which indicate the language
features needed for a particular module to be available. This allows
mixed-language modules, where certain headers only work under some
language variants (e.g., in C++, std.tuple might only be available in
C++11 mode).

llvm-svn: 147387
2011-12-31 04:05:44 +00:00
Benjamin Kramer cf5014771d Add a target hook for FLT_EVAL_METHOD and use it to set the value on x86 with sse disabled.
x87 math evaluates everything with 80 bits precision, so we have to set FLT_EVAL_METHOD
to "2".

llvm-svn: 147311
2011-12-28 15:47:06 +00:00
Douglas Gregor deafd0b2a4 Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDecl
covers both declarations (@class) and definitions (@interface) of an
Objective-C class.

llvm-svn: 147299
2011-12-27 22:43:10 +00:00
Rafael Espindola 65e025cad5 Remove unused variables.
llvm-svn: 147260
2011-12-25 01:18:52 +00:00
Benjamin Kramer 3c6982b911 Give C11's __STDC_VERSION__ the final value.
llvm-svn: 147222
2011-12-23 17:00:41 +00:00
Benjamin Kramer e56f393249 Mass rename C1x references to C11. The name hasn't proliferated like "C++0x" so this patch is surprisingly small.
Also drop -Wc1x-extensions in favor of -Wc11-extensions. I don't think we need to keep this around for compatibility.

llvm-svn: 147221
2011-12-23 17:00:35 +00:00
Dylan Noblesmith e99b27f35e Let CompilerInvocation initialization indicate failure
This fixes the FIXMEs in ParseAnalyzeArgs. (Also a
precursor to moving the analyzer into an AST plugin.)

For consistency, do the same with AssemblerInvocation.

llvm-svn: 147218
2011-12-23 03:05:38 +00:00
Dylan Noblesmith 1ced737ebf remove unneeded config.h includes
llvm-svn: 147195
2011-12-22 22:49:47 +00:00
Chandler Carruth 1c032e0dc0 Update the CMake build for r146959's new files.
llvm-svn: 146967
2011-12-20 08:42:15 +00:00
David Blaikie 68e081d606 Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch
llvm-svn: 146959
2011-12-20 02:48:34 +00:00
Douglas Gregor 98a52db80c Detect when mapping a #include/#import over to a submodule ends up
hitting a submodule that was never actually created, e.g., because
that header wasn't parsed. In such cases, complain (because the
module's umbrella headers don't cover everything) and fall back to
including the header.

Later, we'll add a warning at module-build time to catch all such
cases. However, this fallback is important to eliminate assertions in
the ASTWriter when this happens.

llvm-svn: 146933
2011-12-20 00:28:52 +00:00
NAKAMURA Takumi 7bfba2f0d3 Frontend/VerifyDiagnosticConsumer.cpp: Fix an expression that had side-effect.
It had been causing test "Misc/diag-verify.cpp" failure on ms cl.exe. The emission was ordered unexpectedly as below;

First)  error: 'error' diagnostics seen but not expected:
Second) error: 'error' diagnostics expected but not seen:

llvm-svn: 146830
2011-12-17 13:00:31 +00:00
Ted Kremenek 4548e04458 Refactor SerializeDiagnosticsPrinter to using DiagnosticRenderer. This gives us comparative diagnostics
to TextDiagnosticPrinter.

This certainly can be cleaned up a bit.

llvm-svn: 146820
2011-12-17 05:26:11 +00:00
Ted Kremenek c4bbd8531e Refactor 'TextDiagnostic' to have a parent class 'DiagnosticRenderer' which handles
the policy of how diagnostics are lowered/rendered, while TextDiagnostic handles
the actual pretty-printing.

This is a first part of reworking SerializedDiagnosticPrinter to use the same
inclusion-stack/macro-expansion logic as TextDiagnostic.

llvm-svn: 146819
2011-12-17 05:26:04 +00:00
Richard Smith f6f003af6a C++11 constexpr: Add note stacks containing backtraces if constant evaluation
fails within a call to a constexpr function. Add -fconstexpr-backtrace-limit
argument to driver and frontend, to control the maximum number of notes so
produced (default 10). Fix APValue printing to be able to pretty-print all
APValue types, and move the testing for this functionality from a unittest to
a -verify test now that it's visible in clang's output.

llvm-svn: 146749
2011-12-16 19:06:07 +00:00
Anna Zaks cf2f8aab62 Fixup to the relaxed diagnostic verification option r146633.
We should exit when matching the '+' even if nothing was found to
prevent searching for all UNIT_MAX items.

llvm-svn: 146747
2011-12-16 18:28:45 +00:00
Argyrios Kyrtzidis a0caa29d6f Revert r146646 that was a mistake, and make the intended change in the right file.
Log:
[libclang] Try to unbreak mingw build.

llvm-svn: 146647
2011-12-15 05:53:37 +00:00
Argyrios Kyrtzidis d99472f4cd [libclang] Try to unbreak mingw build.
llvm-svn: 146646
2011-12-15 05:48:43 +00:00
Eli Friedman a109e92a66 <climits> has UINT_MAX, not <limits>.
llvm-svn: 146638
2011-12-15 04:24:37 +00:00
Anna Zaks f8548b080d Another fixit for r146633 (to make debian-fnt bot happy), try including limits instead.
llvm-svn: 146637
2011-12-15 03:27:51 +00:00
Anna Zaks 2c74eedbba Fixit for r146633. Make sure UINT_MAX is defined on all platforms.
(Attempt to turn debian-fnt buildbot back to green.)

llvm-svn: 146635
2011-12-15 02:58:00 +00:00
Anna Zaks a2510070ee Add support for matching one or more (aka regex +) diagnostic messages with -verify.
Ex:
// expected-warning + {{tainted}

llvm-svn: 146633
2011-12-15 02:28:16 +00:00
Richard Trieu 553b2b2e5d Modify how the -verify flag works. Currently, the verification string and
diagnostic message are compared.  If either is a substring of the other, then
no error is given.  This gives rise to an unexpected case:

  // expect-error{{candidate function has different number of parameters}}

will match the following error messages from Clang:

  candidate function has different number of parameters (expected 1 but has 2)
  candidate function has different number of parameters

It will also match these other error messages:

  candidate function
  function has different number of parameters
  number of parameters

This patch will change so that the verification string must be a substring of
the diagnostic message before accepting.  Also, all the failing tests from this
change have been corrected.  Some stats from this cleanup:

87 - removed extra spaces around verification strings
70 - wording updates to diagnostics
40 - extra leading or trailing characters (typos, unmatched parens or quotes)
35 - diagnostic level was included (error:, warning:, or note:)
18 - flag name put in the warning (-Wprotocol)

llvm-svn: 146619
2011-12-15 00:38:15 +00:00
Chad Rosier 1332d9b26a Per discussion on the list, remove BitcodeVerify pass to reimplement as a free function.
llvm-svn: 146530
2011-12-14 00:29:23 +00:00
Chad Rosier c4399f779b Add frontend flags to enable bitcode verifier pass.
llvm-svn: 146441
2011-12-12 23:05:47 +00:00
Tony Linthicum 76329bf83f Hexagon backend support
llvm-svn: 146413
2011-12-12 21:14:55 +00:00
Douglas Gregor c1aaf8cacb When we have an umbrella directory in a module map, recursively walk
the subdirectories to find headers in submodules.

llvm-svn: 146398
2011-12-12 19:13:53 +00:00
Daniel Dunbar 19939cc380 Driver: Handle -f{no-}honor-infinities, -f{no-}honor-nans, and
-ffinite-math-only.
 - No test case yet, I don't know how to construct a situation where this
   matters.

llvm-svn: 146297
2011-12-09 23:41:18 +00:00
Chandler Carruth f887db09e8 Move ChainedIncludesSource into the Frontend library. This never really
belonged in the Serialization library, it's setting up a compilation,
not just deserializing.

This should fix PR11512, making Serialization actually be layered below
Frontend, a long standing layering violation in Clang.

llvm-svn: 146233
2011-12-09 01:55:54 +00:00
Chandler Carruth b0ffe50da8 Move a free function from the Frontend library into the Lex library as
part of HeaderSearch. This function just normalizes filenames for use
inside of a synthetic include directive, but it is used in both the
Frontend and Serialization libraries so it needs a common home.

llvm-svn: 146227
2011-12-09 01:33:57 +00:00
Douglas Gregor 524e33e1f8 Implement umbrella directories for modules, which are similar to
umbrella headers in the sense that all of the headers within that
directory (and eventually its subdirectories) are considered to be
part of the module with that umbrella directory. However, unlike
umbrella headers, which are expected to include all of the headers
within their subdirectories, Clang will automatically include all of
the headers it finds in the named subdirectory.

The intent here is to allow a module map to trivially turn a
subdirectory into a module, where the module's structure can mimic the
directory structure.

llvm-svn: 146165
2011-12-08 19:11:24 +00:00
Douglas Gregor 73141fa98d Within the module representation, generalize the notion of an umbrella
header to also support umbrella directories. The umbrella directory
for an umbrella header is the directory in which the umbrella header
resides.

No functionality change yet, but it's coming.

llvm-svn: 146158
2011-12-08 17:39:04 +00:00
Douglas Gregor 2537a36483 Keep track of import dependencies between submodules within the module
that's currently being built. This is important for supporting
transitive dependencies ("export *" in the module map) completely.

llvm-svn: 146156
2011-12-08 17:01:29 +00:00
Argyrios Kyrtzidis 7910d7b72a Make changes to SDiagsWriter to make it work in combination with the ARC migrator:
-Allow it to be used with multiple BeginSourceFile/EndSourceFile calls; for this introduce
 a "finish" callback method in the DiagnosticConsumer. SDiagsWriter finishes up the serialization
 file inside this method.
-Make it independent of any particular DiagnosticsEngine; make it use the SourceManager of the
 Diagnostic object.
-Ignore null source ranges.

llvm-svn: 146020
2011-12-07 05:52:12 +00:00
Douglas Gregor ee78d3e020 If we can't write the temporary module map file when compiling a
module, at least have the decency to complain about it.

llvm-svn: 146002
2011-12-07 00:54:14 +00:00
Douglas Gregor 2f554c4c1b Add a FIXME to provide a sensible error message here
llvm-svn: 145983
2011-12-06 23:04:08 +00:00
Douglas Gregor 19f9f7bc6d Use absolute paths for temporary module map files
llvm-svn: 145973
2011-12-06 22:05:29 +00:00
Douglas Gregor e5626c4119 When building the main file to parse given a module map, don't skip
explicit submodules or umbrella headers from submodules. Instead,
build the entire module at once, and let the name-hiding mechanisms
hide the contents of explicit submodules at load time.

llvm-svn: 145940
2011-12-06 17:15:11 +00:00
Nick Lewycky f4d3f7a0b9 Stack realignment is a tristate. Add -mno-stackrealign to turn off all stack
realignment, even with locals with alignment exceeding the ABI guarantee.

llvm-svn: 145909
2011-12-06 03:33:03 +00:00
Joerg Sonnenberger db66ed0e4c Add -mstack-alignment=X and fix -mstackrealign handling now that the
backend options are gone.

llvm-svn: 145868
2011-12-05 23:05:23 +00:00
Douglas Gregor bcfc7d0229 When we treat an #include or #import as a module import, create an
implicit ImportDecl in the translation unit to record the presence of
the import.

llvm-svn: 145727
2011-12-02 23:42:12 +00:00
Douglas Gregor ff2be53f8f Introduce the notion of name visibility into modules. For a given
(sub)module, all of the names may be hidden, just the macro names may
be exposed (for example, after the preprocessor has seen the import of
the module but the parser has not), or all of the names may be
exposed. Importing a module makes its names, and the names in any of
its non-explicit submodules, visible to name lookup (transitively).

This commit only introduces the notion of name visible and marks
modules and submodules as visible when they are imported. The actual
name-hiding logic in the AST reader will follow (along with test cases).

llvm-svn: 145586
2011-12-01 17:11:21 +00:00
Douglas Gregor de3ef502a9 Promote ModuleMap::Module to a namespace-scope class in the Basic
library, since modules cut across all of the libraries. Rename
serialization::Module to serialization::ModuleFile to side-step the
annoying naming conflict. Prune a bunch of ModuleMap.h includes that
are no longer needed (most files only needed the Module type).

llvm-svn: 145538
2011-11-30 23:21:26 +00:00
Matt Beaumont-Gay eb44edad6d Don't collide loop variable names (to appease GCC)
llvm-svn: 145515
2011-11-30 19:41:21 +00:00
Douglas Gregor 6902197407 Implement (de-)serialization of the description of a module and its
submodules. This information will eventually be used for name hiding
when dealing with submodules. For now, we only use it to ensure that
the module "key" returned when loading a module will always be a
module (rather than occasionally being a FileEntry).

llvm-svn: 145497
2011-11-30 17:33:56 +00:00