Граф коммитов

90 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner d82df3ad43 Implement support for GCC's -dD mode, which dumps -E output *and*
macro definitions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68884 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 01:56:53 +00:00
Chris Lattner 4fa37accae use doug's new %S thing to make this work when run from different locations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68788 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 16:51:32 +00:00
Daniel Dunbar 748dd20b55 Force triple for these tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68651 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 23:02:51 +00:00
Chris Lattner fd10511b3e finish the implementation of -imacros. The driver still needs to be hooked up.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 20:53:24 +00:00
Daniel Dunbar 3bbc75302f More fixes to builtin preprocessor defines.
- Add -static-define option driver can use when __STATIC__ should be
   defined (instead of __DYNAMIC__).

 - Don't set __OPTIMIZE_SIZE__ on Os, __OPTIMIZE_SIZE__ is tied to Oz.

 - Set __NO_INLINE__ following GCC 4.2.

 - Set __GNU_GNU_INLINE__ or __GNU_STDC_INLINE__ following GCC 4.2.

 - Set __EXCEPTIONS for Objective-C NonFragile ABI.

 - Set __STRICT_ANSI__ for standard conforming modes.

 - I added a clang style test case in utils for this, but its not
   particularly portable and I don't think it belongs in the test
   suite.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68621 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 18:03:55 +00:00
Daniel Dunbar 9fd0b1f845 Set __PIC__ (more) correctly.
- Add -pic-level clang-cc option to specify the value for the define,
   updated driver to pass this.

 - Added __pic__

 - Added OBJC_ZEROCOST_EXCEPTIONS define while I was here (to match gcc).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68584 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 03:03:23 +00:00
Anders Carlsson ef88e58360 Fix broken test case. I have no idea why this ever worked.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68526 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 18:21:53 +00:00
Daniel Dunbar 82fc0cb788 Use %s in test, not hard coded name.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68521 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 17:09:43 +00:00
Chris Lattner 0b51415dcf implement rdar://6762183. I'm not sure if it is more insane that
GCC ignores macro definitions after \n's or that real code depends
on this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68511 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 06:02:44 +00:00
Anders Carlsson 4ca076fffd Define __OPTIMIZE__ and __OPTIMIZE_SIZE__ if the -O[12] and -Os flags are passed to the compiler.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68450 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 17:37:10 +00:00
Daniel Dunbar 0b5b0da158 Pull clang-cc code for generating PTH files based on the input type.
- <rdar://problem/6741594> [pth] don't abuse -x to drive pth
   generation

 - Simpler, and fixes PR3915.

Cleanup test cases for PTH:
 - Update to use -emit-pth

 - Removed PTH test of carbon.c and cocoa.mm; these didn't actually
   verify anything, and since PTH is token based the extra coverage
   (over cocoa.m) isn't particularly helpful.

 - Split PTH tests in cocoa.m to cocoa-pth.m, solely to increase
   available parallelism when running tests.

Ted, could you update the PTH test cases (include-pth.c and
cocoa-pth.m) to have some sort of positive check that the PTH is
getting used? "# of PTH cache hits" or "tokens read from PTH cache"
statistics would work great. :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68189 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 05:09:09 +00:00
Chris Lattner 4fcb4cd655 fix PR3880, fixing a comma swallowing bug handling macros that only take
... arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67706 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-25 21:08:24 +00:00
Daniel Dunbar d7d5f0223b Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 02:24:46 +00:00
Chris Lattner f1538de183 The individual pieces of an invalid paste as still candidates for expansion.
This matters in assembler mode, where this is silently allowed.
This fixes rdar://6709206.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67539 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 17:32:45 +00:00
Ted Kremenek 01c499db50 Fix include-pth.c test case to (hopefully) more resilient to where and how tests
are executed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67419 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 23:45:36 +00:00
Ted Kremenek 600cfab474 Add test case for '-include-pth'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67386 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 17:56:12 +00:00
Chris Lattner e966d9ae3e add tests for the various .S bugs I fixed on wednesday.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67381 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 16:28:22 +00:00
Chris Lattner 15154b40d4 rename this test from .S to .c so that it gets run.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67380 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 16:16:49 +00:00
Chris Lattner 688a248e03 fix PR3764 - A redefinition of a pre-processor macro fails
Redefinition checking should ignore the leading whitespace and
start of line flags on the first token of an expansion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66442 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 20:33:32 +00:00
Chris Lattner c3c489e642 convert this to use -verify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66441 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 20:31:39 +00:00
Chris Lattner 5a7a848919 rename test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66440 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 20:30:53 +00:00
Chris Lattner b627c8d683 #import is not considered an extension for ObjC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66246 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 04:28:03 +00:00
Chris Lattner c8fbd44eb0 fix PR3579: __LINE__ expands to the presumed location of the
*end* of a macro instantiation, not the start of it.  This is
really all about bug-for-bug compatibility with GCC, but not
doing this breaks the FreeBSD kernel.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64603 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-15 21:06:15 +00:00
Chris Lattner e7fb48466a track "just a little more" location information for macro instantiations.
Now instead of just tracking the expansion history, also track the full
range of the macro that got replaced.  For object-like macros, this doesn't
change anything.  For _Pragma and function-like macros, this means we track
the locations of the ')'.

This is required for PR3579 because apparently GCC uses the line of the ')'
of a function-like macro as the location to expand __LINE__ to.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64601 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-15 20:52:18 +00:00
Mike Stump 3855b9a8f0 Fix limits.h for linux, as glibc does a #include_next unless
_GCC_LIMITS_H_ is defined, when __GNUC__ is defined.

Also, we need to stay away from possible conflicts with header guards.
We should use CLANG_ to prefix all header guards.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64408 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-12 23:06:31 +00:00
Chris Lattner f73903a1de Add an implementation of -dM that follows GCC closely enough to permit
diffing the output of:
  clang -dM -o - -E -x c foo.c | sort


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63926 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 06:45:26 +00:00
Chris Lattner c8f2d9a831 smaller header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63766 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 19:47:38 +00:00
Chris Lattner be5c64d7a7 Fix PR3464 by searching for headers from the predefines
buffer as if the #include happened from the main file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63764 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 19:45:07 +00:00
Chris Lattner d62ef1a951 Ok, we need a system header for this test to pass in the clang/test directory as well as from the pp directory.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63763 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 19:44:14 +00:00
Chris Lattner cd22f81f53 fix test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63762 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 19:40:02 +00:00
Chris Lattner df23f2b38c rename again
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63761 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 19:38:30 +00:00
Chris Lattner 72650adf04 rename some tests
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63759 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 19:38:12 +00:00
Chris Lattner 4da9f9cbb9 include smaller header for test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63758 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 19:37:49 +00:00
Chris Lattner 137b6a6149 Implement handling of file entry/exit notifications from GNU
line markers, including maintenance of the virtual include stack.

For something like this:

# 42 "bar.c" 1
# 142 "bar2.c" 1

#warning zappa
# 92 "bar.c" 2
#warning gonzo
# 102 "foo.c" 2
#warning bonkta


we now produce these three warnings:

#1:
In file included from foo.c:3:
In file included from bar.c:42:
bar2.c:143:2: warning: #warning zappa
#warning zappa
 ^

#2:
In file included from foo.c:3:
bar.c:92:2: warning: #warning gonzo
#warning gonzo
 ^

#3:
foo.c:102:2: warning: #warning bonkta
#warning bonkta
 ^




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63722 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 06:25:26 +00:00
Chris Lattner bd16209c76 # 42 doesn't change system header state either, add test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63721 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 05:36:14 +00:00
Chris Lattner 6b3066780b make getFileCharacteristic linetable aware. line markers that
play around with the 'is system header' bit now function correctly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63720 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 05:33:01 +00:00
Chris Lattner 953b4b0950 Add simple #line directive test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63713 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 02:17:09 +00:00
Chris Lattner 4c9a1669ee add testcase for PR3437 and r63405
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 18:49:16 +00:00
Chris Lattner b9c3f966b1 Introduce a new PresumedLoc class to represent the concept of a location
as reported to the user and as manipulated by #line.  This is what __FILE__,
__INCLUDE_LEVEL__, diagnostics and other things should follow (but not 
dependency generation!).  

This patch also includes several cleanups along the way: 

- SourceLocation now has a dump method, and several other places 
  that did similar things now use it.
- I cleaned up some code in AnalysisConsumer, but it should probably be
  simplified further now that NamedDecl is better.
- TextDiagnosticPrinter is now simplified and cleaned up a bit.

This patch is a prerequisite for #line, but does not actually provide 
any #line functionality.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 07:57:44 +00:00
Chris Lattner 202fd2c4fb Fix a bug that I noticed by inspection.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63094 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 05:34:03 +00:00
Chris Lattner 478a18ec47 add parsing and constraint enforcement for GNU line marker directives.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63003 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 06:19:46 +00:00
Chris Lattner 8e60a29e25 add another sanity test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63001 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 05:44:13 +00:00
Chris Lattner 359cc44754 parse and enforce required constraints on #line directives. Right now
we just discard them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62999 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 05:29:08 +00:00
Chris Lattner 4d2d04e9fb fix rdar://6505352 - Bogus warning with -WUndef, a case
Anders noticed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62472 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-18 21:18:58 +00:00
Chris Lattner c7d945d053 Make -E mode propagate #pragma comment's into the output.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62339 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 19:25:54 +00:00
Chris Lattner 636c5ef657 Implement basic support for parsing #pragma comment, a microsoft extension
documented here:
http://msdn.microsoft.com/en-us/library/7f0aews7(VS.80).aspx

This is according to my understanding reading the docs, I don't know if it
really agrees fully with what VC++ allows.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62317 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 08:21:25 +00:00
Chris Lattner df7c17a8d0 Change some terminology in SourceLocation: instead of referring to
the "physical" location of tokens, refer to the "spelling" location.
This is more concrete and useful, tokens aren't really physical objects!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62309 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 07:00:02 +00:00
Daniel Dunbar 5bea06ad9e Add test case for __ASSEMBLER__ definition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60363 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 19:23:47 +00:00
Chris Lattner 46fb6dc98f testcase for PR3096
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59794 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 06:19:48 +00:00
Torok Edwin e4d3788153 remove this testcase, it fails with -verify still
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59539 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 18:48:14 +00:00