Commit Graph

421 Commits

Author SHA1 Message Date
Daniel Dunbar 36a3e92521 Don't accept '$' in identifiers in assembler-with-cpp mode.
llvm-svn: 67013
2009-03-15 00:11:28 +00:00
Daniel Dunbar 29de588ac2 Don't run simplify lib calls with -ffreestanding (fix for already
failing test case).

llvm-svn: 66991
2009-03-14 00:15:04 +00:00
Chris Lattner c890aa2802 wire up a new -fno-builtin option, make it control things like simplifylibcalls,
etc and make freestanding imply it.

llvm-svn: 66972
2009-03-13 22:38:49 +00:00
Chris Lattner cda4d7e196 introduce a new -fheinous-gnu-extensions flag that enables really
really horrible extensions that are disabled by default but that can
be accepted by -fheinous-gnu-extensions (but which always emit a 
warning when enabled).

As our first instance of this, implement PR3788/PR3794, which allows
non-lvalues in inline asms in contexts where lvalues are required. bleh.

llvm-svn: 66910
2009-03-13 17:38:01 +00:00
Chris Lattner 44219f3e58 implement a new -fprint-source-range-info option, which
defaults to off.  When enabled, it emits range info along
with the file/line/col information for a diagnostic.  This
allows tools that textually parse the output of clang to know
where the ranges are, even if they span multiple lines.  For 
example, with:

$ clang exprs.c -fprint-source-range-info

We now produce:

exprs.c:21:11:{21:12-21:13}: warning: use of unary operator that may be intended as compound assignment (+=)
      var =+ 5;  // expected-warning {{use of unary operator that may be intended as compound assignment (+=)}}
          ^~
exprs.c:22:11:{22:12-22:13}: warning: use of unary operator that may be intended as compound assignment (-=)
      var =- 5;  // expected-warning {{use of unary operator that may be intended as compound assignment (-=)}}
          ^~
exprs.c:36:13:{36:3-36:12}: error: assignment to cast is illegal, lvalue casts are not supported
  (float*)X = P;   // expected-error {{assignment to cast is illegal, lvalue casts are not supported}}
  ~~~~~~~~~ ^
exprs.c:41:4:{41:3-41:4}: error: called object type 'int' is not a function or function pointer
  X();  // expected-error {{called object type 'int' is not a function or function pointer}}
  ~^
exprs.c:45:15:{45:8-45:14}{45:17-45:24}: error: invalid operands to binary expression ('int *' and '_Complex float')
   P = (P-42) + Gamma*4;  // expected-error {{invalid operands to binary expression ('int *' and '_Complex float')}}
       ~~~~~~ ^ ~~~~~~~
exprs.c:61:7:{61:16-61:22}: error: invalid application of '__alignof' to bitfield
  R = __alignof(P->x);  // expected-error {{invalid application of '__alignof' to bitfield}} expected-warning {{extension used}}
      ^        ~~~~~~

Note the range info after the column in the initial diagnostic.

This is obviously really annoying if you're not a tool parsing the 
output of clang, which is why it is off by default.

llvm-svn: 66862
2009-03-13 01:08:23 +00:00
Daniel Dunbar 4f495980c4 Add Diagnostic files for Frontend and move a couple errors over.
- Notably, clang now exits with an error if it can't find a
   file. This flushed out a bug in the CGColorSpace.c test case. :)

llvm-svn: 66789
2009-03-12 10:14:16 +00:00
Gabor Greif 65fe8349c6 gnu++0x is definitely *not* the default
llvm-svn: 66736
2009-03-11 23:07:18 +00:00
Douglas Gregor fcd5db3bfa Limit the template instantiation depth to some user-configurable value
(default: 99). Beyond this limit, produce an error and consider the
current template instantiation a failure.

The stack we're building to track the instantiations will, eventually,
be used to produce instantiation backtraces from diagnostics within
template instantiation. However, we're not quite there yet.

This adds a new Clang driver option -ftemplate-depth=NNN, which should
eventually be generated from the GCC command-line operation
-ftemplate-depth-NNN (note the '-' rather than the '='!). I did not
make the driver changes to do this mapping.

llvm-svn: 66513
2009-03-10 00:06:19 +00:00
Chris Lattner 5b4725861e move -g option down into rest of codegen section
llvm-svn: 66480
2009-03-09 22:05:03 +00:00
Chris Lattner 1349ab7c9f move debug info generation flag into CompileOptions.
llvm-svn: 66478
2009-03-09 22:00:34 +00:00
Sebastian Redl ecc5444a7b Improve error messages on bad warning options.
llvm-svn: 66334
2009-03-07 12:09:25 +00:00
Sebastian Redl 4835010a29 Implement the machinery that can process TableGenerated warning options.
Manually write a table and some ad-hoc code to provide feature parity with the current code.

llvm-svn: 66276
2009-03-06 17:41:35 +00:00
Chris Lattner 855d149ec5 To the user, this is just a compiler of course, duh.
llvm-svn: 66251
2009-03-06 05:38:25 +00:00
Chris Lattner d735e6f166 clean up the OVERVIEW line in clang --help.
llvm-svn: 66250
2009-03-06 05:38:04 +00:00
Chris Lattner 07e85f3fc5 Start making use of "pretty stack dumps" to get
better crash info when clang crashes.  Step #2 of many.

llvm-svn: 66078
2009-03-04 21:41:39 +00:00
Chris Lattner 20fc207f52 minor cleanups
llvm-svn: 66077
2009-03-04 21:40:56 +00:00
Chris Lattner 5c3529634a implement support for propagating *features* down to the code generator
and defining target-specific macros based on them (like __SSE3__ and 
friends).  After extensive discussion with Daniel, this work will need
driver support, which will translate things like -msse3 into a -mattr 
feature.  Until this work is done, the code in clang.cpp is disabled and
the X86TargetInfo ctor still defaults to SSE2.  With these two things
changed, this code will work.  PR3634

llvm-svn: 65966
2009-03-03 19:56:18 +00:00
Chris Lattner e6e4c0381a start wiring up support for target-specific -mfoo options like -msse
llvm-svn: 65881
2009-03-02 22:11:07 +00:00
Daniel Dunbar 51adf5824e Rename lib/Driver (etc) to lib/Frontend in prep for the *actual*
driver taking lib/Driver.

llvm-svn: 65811
2009-03-02 06:16:29 +00:00
Gabor Greif fda885d048 Adapt help string to what the code is doing (default is lang_gnu99). Thanks rdivacky!
llvm-svn: 65689
2009-02-28 09:22:15 +00:00
Daniel Dunbar 26d5f05bf5 Add -emit-llvm-only option (generate LLVM IR & run passes, but discard
output).
 - For timing IRgen phase.

llvm-svn: 65580
2009-02-26 22:39:37 +00:00
Daniel Dunbar 3283ff5088 Put compiler headers in <prefix>/lib/clang/1.0/include (vs
<prefix>/Headers, gross).

llvm-svn: 65247
2009-02-21 20:52:41 +00:00
Chris Lattner 06ef388a61 fix a bug introduced in my previous patch: moving clang headers to the
"after" group instead of the system group makes it so #include <limits.h>
picks up the *system* limits.h file before clang's.  This causes a failure
on linux and is definitely not what we want.

llvm-svn: 65026
2009-02-19 06:48:28 +00:00
Chris Lattner cb60143ec3 always search for "builtin" headers at the end of the search path,
and never remap them with -isysroot.  This fixes PR3614.

llvm-svn: 65012
2009-02-19 04:55:19 +00:00
Chris Lattner f53a9612d1 add a bunch of timers for -E and other modes. This requires
llvm r64874 or later.

llvm-svn: 64875
2009-02-18 01:51:21 +00:00
Chris Lattner deffa13399 move llvm backend specific #includes into Backend.cpp instead of Clang.cpp
llvm-svn: 64872
2009-02-18 01:23:44 +00:00
Chris Lattner baba6fc1c4 indentation and formatting
llvm-svn: 64871
2009-02-18 01:20:05 +00:00
Chris Lattner 5df3d46a9b clang will hopefully never support ratfor.
llvm-svn: 64870
2009-02-18 01:17:01 +00:00
Chris Lattner a1580a603a wire up a minimal -ftime-report, which prints the optimizer/codegen
times.  Daniel, plz add driver support.

llvm-svn: 64869
2009-02-18 01:12:43 +00:00
Daniel Dunbar d97b07e7d4 Backend: Accept -mcpu and -mattr for use by TargetMachine.
llvm-svn: 64798
2009-02-17 19:47:34 +00:00
Ted Kremenek b535181199 Static Analyzer driver/options (partial) cleanup:
- Move all analyzer options logic to AnalysisConsumer.cpp.
- Unified specification of stores/constraints/output to be:
   -analyzer-output=...
   -analyzer-store=...
   -analyzer-constraints=...
  instead of -analyzer-range-constraints, -analyzer-store-basic, etc.
- Updated drivers (ccc-analyzer, scan-builds, new ccc) to obey this new
  interface
- Updated test cases to conform to new driver options

llvm-svn: 64737
2009-02-17 04:27:41 +00:00
Chris Lattner 8a04c5ad03 add support for -fno-math-errno, and validate that it affects sema properly.
llvm-svn: 64708
2009-02-17 00:35:09 +00:00
Chris Lattner ba86ad178b remove extraneous .
llvm-svn: 64706
2009-02-17 00:30:31 +00:00
Daniel Dunbar 8eb018ab9c Support IRgen of sqrt -> llvm.sqrt, pow -> llvm.pow.
- Define pow[lf]?, sqrt[lf]? as builtins.

 - Add -fmath-errno option which binds to LangOptions.MathErrno

 - Add new builtin flag Builtin::Context::isConstWithoutErrno for
   functions which can be marked as const if errno isn't respected for
   math functions. Sema automatically marks these functions as const
   when they are defined, if MathErrno=0.

 - IRgen uses const attribute on sqrt and pow library functions to
   decide if it can use the llvm intrinsic.

llvm-svn: 64689
2009-02-16 22:43:43 +00:00
Daniel Dunbar f898638eee PR3589: Don't simplify libcalls with -ffreestanding.
llvm-svn: 64599
2009-02-15 20:00:15 +00:00
Douglas Gregor 69c7951c8e Add -ffreestanding to suppress the implicit declaration of library builtins like printf and malloc. Fixes PR3586
llvm-svn: 64566
2009-02-14 20:49:29 +00:00
Chris Lattner f302000e5c add support for -x c++-header, update comment.
llvm-svn: 63924
2009-02-06 06:19:20 +00:00
Chris Lattner fa81669354 default diag::err_pp_file_not_found to mapping to fatal,
implementing PR3492: #include failures should be a fatal error

llvm-svn: 63915
2009-02-06 04:16:41 +00:00
Daniel Dunbar 1e8052b36d Add -femit-all-decls codegen option.
- Emits all declarations, even unused (static) ones.
 - Useful when doing minimization of codegen problems (otherwise
   problems localized to a static function aren't minimized well).

llvm-svn: 63776
2009-02-04 21:19:06 +00:00
Mike Stump f126e59042 Use the updated CommandLine api for -fno-blocks.
llvm-svn: 63563
2009-02-02 22:57:57 +00:00
Anders Carlsson f6e6057e92 Fix typo noticed by Chris.
llvm-svn: 63449
2009-01-30 23:26:40 +00:00
Anders Carlsson db5a9b675c Turn on -flax-vector-conversions by default, issue a warning whenever one is done. Add a -fnolax-vector-conversions option. Fixes PR2862.
llvm-svn: 63447
2009-01-30 23:17:46 +00:00
Chris Lattner 83ab0a83f5 wire up -fno-show-source-location option, patch by Alexei Svitkine!
llvm-svn: 63409
2009-01-30 19:01:41 +00:00
Mike Stump c99d003b25 Add -fno-blocks support. This fixes block-no-block-def.c.
llvm-svn: 63385
2009-01-30 08:22:07 +00:00
Daniel Dunbar 38b9c05f1c Fix name of -x option for C preprocessed input; it should be
cpp-output, not c-cpp-output.

llvm-svn: 63345
2009-01-29 23:50:47 +00:00
Chris Lattner 4b6713ef20 next round of diagnostics cleanups, moving some
diags around, eliminating #defines, etc.  Patch by
Anders Johnsen!

llvm-svn: 63318
2009-01-29 17:46:13 +00:00
Chris Lattner 36790cf29a Fix -Wimplicit-function-declaration, which required some refactoring and
changes in various diagnostics code.

llvm-svn: 63282
2009-01-29 06:55:46 +00:00
Chris Lattner 0f65a585ba Fix a wart that existed from before we had EXTWARN.
llvm-svn: 63272
2009-01-29 05:23:19 +00:00
Chris Lattner 60f36223a9 move library-specific diagnostic headers into library private dirs. Reduce
redundant #includes.  Patch by Anders Johnsen!

llvm-svn: 63271
2009-01-29 05:15:15 +00:00
Ted Kremenek 3b0589e4b4 Enhance PTHManager::Create() to take an optional Diagnostic* argument that can be used to report issues such as a missing PTH file.
llvm-svn: 63231
2009-01-28 20:49:33 +00:00