Commit Graph

1267 Commits

Author SHA1 Message Date
Daniel Dunbar a792bad824 ccc/Driver/clang-fe: Accept -fbuiltin, and forward -f[no-]builtin to clang.
llvm-svn: 67420
2009-03-20 23:49:28 +00:00
Douglas Gregor 85992cf607 InitListDesignations hasn't been used (ever). Eliminate it, and
simplify the parsing and action interface for designated
initializers.

llvm-svn: 67415
2009-03-20 23:11:49 +00:00
Chris Lattner b45c23a051 fix test/Preprocessor/macro_paste_mscomment.c.
llvm-svn: 67403
2009-03-20 21:23:42 +00:00
Chris Lattner 91d63d1248 add a new LangOptions::GNUMode bit to distinguish between GNU99 and C99 etc.
llvm-svn: 67374
2009-03-20 15:44:26 +00:00
Ted Kremenek eb996ab37d Preserve ordering between -include and -include-pth.
llvm-svn: 67354
2009-03-20 00:40:03 +00:00
Ted Kremenek a1a0e4b27e Implement "-include-pth" in low-level driver. This allows a PTH file to be used
similar to a regular file passed to "-include". When -include-pth is used, the
low-level driver queries the PTH file for the name of the original source file
that generated the PTH file and implicitly adds a '#include' for that file in
the Predefines buffer.

llvm-svn: 67352
2009-03-20 00:26:38 +00:00
Ted Kremenek 7040b57c9f Store the name of the original file used to generate the PTH file in the PTH
file itself.

llvm-svn: 67340
2009-03-19 22:10:38 +00:00
Ted Kremenek 95cd5c6b84 Per Daniel's suggestion, remove default case from switch statement to make
uncaught language cases a compile warning instead of a runtime error.

llvm-svn: 67325
2009-03-19 19:02:20 +00:00
Douglas Gregor 19367f54e2 Allow notes to be printed following a fatal error, then suppress any
diagnostics following those notes. 

Make exceeding the template instantiation depth a fatal error.

Thanks to Daniel for pointing out the problem!

llvm-svn: 67320
2009-03-19 18:55:06 +00:00
Ted Kremenek f65a0b6e21 Support langkind_cxx_pch when determining the language dialect.
llvm-svn: 67315
2009-03-19 18:21:42 +00:00
Douglas Gregor 23d75bb326 Build system changes to use TableGen to generate the various
diagnostics. This builds on the patch that Sebastian committed and
then revert. Major differences are:

  - We don't remove or use the current ".def" files. Instead, for now,
    we just make sure that we're building the ".inc" files.
  - Fixed CMake makefiles to run TableGen and build the ".inc" files
    when needed. Tested with both the Xcode and Makefile generators
    provided by CMake, so it should be solid.
  - Fixed normal makefiles to handle out-of-source builds that involve
    the ".inc" files.

I'll send a separate patch to the list with Sebastian's changes that
eliminate the use of the .def files.

llvm-svn: 67058
2009-03-16 23:06:59 +00:00
Chris Lattner 55ac42a67a simplify this code by reading the decision from LangOptions instead
of recomputing the property from command line options.

llvm-svn: 67047
2009-03-16 18:41:18 +00:00
Anders Carlsson 27de6a5e91 Handle static_asserts when instantiating structs.
llvm-svn: 67031
2009-03-15 18:44:04 +00:00
Sebastian Redl 6d4256c3c1 Convert a bunch of actions to smart pointers, and also bring PrintParserCallbacks a bit more in line with reality.
llvm-svn: 67029
2009-03-15 17:47:39 +00:00
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
Douglas Gregor 0950e41b73 Implement template instantiation for several more kinds of expressions:
- C++ function casts, e.g., T(foo)
  - sizeof(), alignof()

More importantly, this allows us to verify that we're performing
overload resolution during template instantiation, with
argument-dependent lookup and the "cached" results of name lookup from
the template definition.

llvm-svn: 66947
2009-03-13 21:01:28 +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
Ted Kremenek 7398059c84 API fix: All "bodies" for functions, Objective-C methods, blocks, are assumed to
be CompoundStmts. I think this is a valid assumption, and felt that the API
should reflect it. Others please validate this assumption to make sure I didn't
break anything.

llvm-svn: 66814
2009-03-12 18:33:24 +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 212cab3f64 Eliminate CXXClassVarDecl. It doesn't add anything
llvm-svn: 66696
2009-03-11 20:22:50 +00:00
Ted Kremenek 39df18f6da Display the exploded graph before calling BugReporter.FlushReports(). The latter
deletes all registered BugTypes from BugReporter, and thus we need to display
the graph first.

llvm-svn: 66623
2009-03-11 01:42:29 +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
Chris Lattner 4f912e6f98 implement -Wsystem-headers, eliminating the wierd thing I added for testing.
llvm-svn: 66447
2009-03-09 20:44:22 +00:00
Mike Stump 82d8d559bb Fix warnings in build on clang-x86_64-freebsd buildbot.
llvm-svn: 66344
2009-03-07 18:35:41 +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 e46de75dca capitalize for consistency, a crash in regalloc now looks like this:
Stack dump:
0.	Program arguments: clang pr3399.c -S -O3 
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Linear Scan Register Allocator' on function '@foo'
Abort

llvm-svn: 66261
2009-03-06 06:46:31 +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 eae6cb6154 rename PrettyStackTraceDecl -> PrettyStackTraceActionsDecl.
Introduce a new PrettyStackTraceDecl.
Use it to add the top level LLVM IR generation stuff in 
Backend.cpp to stack traces.  We now get crashes like:

Stack dump:
0.	Program arguments: clang t.c -emit-llvm 
1.	<eof> parser at end of file
2.	t.c:1:5: LLVM IR generation of declaration 'a'
Abort

for IR generation crashes.

llvm-svn: 66153
2009-03-05 08:00:35 +00:00
Fariborz Jahanian b8d091c4eb Implemented access check for ivars accessed inside
c-style functions declared inside objc @implementations.

llvm-svn: 66087
2009-03-04 22:30:12 +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 34a2209177 Change Parser::ParseCaseStatement to use an iterative approach to parsing
multiple sequential case statements instead of doing it with recursion.  This
fixes a problem where we run out of stack space parsing 100K directly nested
cases.

There are a couple other problems that prevent this from being useful in 
practice (right now the example only parses correctly with -disable-free and
doesn't work with -emit-llvm), but this is a start.

I'm not including a testcase because it is large and uninteresting for 
regtesting.

Sebastian, I would appreciate it if you could scrutinize the smart pointer 
gymnastics I do.

llvm-svn: 66011
2009-03-04 04:23:07 +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
Steve Naroff 371b8fb4c3 Fix <rdar://problem/6640991> Exception handling executes wrong clause (Daniel, please verify).
Also necessary to fix:

<rdar://problem/6632061> [sema] non object types should not be allowed in @catch statements
<rdar://problem/6252237> [sema] qualified id should be disallowed in @catch statements

llvm-svn: 65964
2009-03-03 19:52:17 +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
Steve Naroff 70f41d6f07 Minor name change (move the ObjC prefix to a more appropriate place).
llvm-svn: 65695
2009-02-28 16:59:13 +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
Douglas Gregor 89ee6822d8 Eliminate CXXRecordType
llvm-svn: 65671
2009-02-28 01:32:25 +00:00
Douglas Gregor deaad8cc34 Create a new TypeNodes.def file that enumerates all of the types,
giving them rough classifications (normal types, never-canonical
types, always-dependent types, abstract type representations) and
making it far easier to make sure that we've hit all of the cases when
decoding types. 

Switched some switch() statements on the type class over to using this
mechanism, and filtering out those things we don't care about. For
example, CodeGen should never see always-dependent or non-canonical
types, while debug info generation should never see always-dependent
types. More switch() statements on the type class need to be moved 
over to using this approach, so that we'll get warnings when we add a
new type then fail to account for it somewhere in the compiler.

As part of this, some types have been renamed:

  TypeOfExpr -> TypeOfExprType
  FunctionTypeProto -> FunctionProtoType
  FunctionTypeNoProto -> FunctionNoProtoType

There shouldn't be any functionality change...

llvm-svn: 65591
2009-02-26 23:50:07 +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
Chris Lattner fff06dd4f9 this got moved to top level
llvm-svn: 65553
2009-02-26 18:38:21 +00:00