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

11352 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek a902d55999 Extensive diagnostics: Do not add a location context for do...while statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70286 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 04:28:12 +00:00
Ted Kremenek 8bd4d037d8 BugReporter (extensive diagnostics): Clean up do...while control-flow edges, and
add "Looping back to the head of the loop" diagnostic for loops.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70285 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 04:23:15 +00:00
Ted Kremenek 8f08c9d83f CFG: Add "loop back" block for do...while statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70284 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 04:22:00 +00:00
Eli Friedman 2962f4d71d Emit keyword extension warning in all modes, not just C99 mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70283 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 03:59:15 +00:00
Eli Friedman c71133f0cf Remove unused LangOptions NoExtensions and Boolean.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70282 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 03:28:55 +00:00
Eli Friedman eb32fde032 Simplify the scheme used for keywords, and change the classification
scheme to be more useful.

The new scheme introduces a set of categories that should be more 
readable, and also reflects what we want to consider as an extension 
more accurately.  Specifically, it makes the "what is a keyword" 
determination accurately reflect whether the keyword is a GNU or 
Microsoft extension.

I also introduced separate flags for keyword aliases; this is useful 
because the classification of the aliases is mostly unrelated to the 
classification of the original keyword.

This patch treats anything that's in the implementation 
namespace (prefixed with "__", or "_X" where "X" is any upper-case 
letter) as a keyword without marking it as an extension.  This is 
consistent with the standards in that an implementation is allowed to define 
arbitrary extensions in the implementation namespace without violating 
the standard. This gets rid of all the nasty "extension used" warnings 
for stuff like __attribute__ in -pedantic mode.  We still warn for 
extensions outside of the the implementation namespace, like typeof.
If someone wants to implement -Wextensions or something like that, we 
could add additional information to the keyword table.

This also removes processing for the unused "Boolean" language option; 
such an extension isn't supported on any other C implementation, so I 
don't see any point to adding it.

The changes to test/CodeGen/inline.c are required because previously, we 
weren't actually disabling the "inline" keyword in -std=c89 mode.

I'll remove Boolean and NoExtensions from LangOptions in a follow-up 
commit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70281 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 03:13:54 +00:00
Ted Kremenek f6e8541dd8 CFG: 'WhileStmts' needs an extra block to indicate the "loop back" path.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70280 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 03:09:44 +00:00
Mike Stump fc0fed3fc7 We avoid the count of diagnostics when not generating carent
diagnostics to improve gcc compatibility; useful for dejagnu testing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70278 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 01:19:10 +00:00
Mike Stump 4eeab84b65 Don't allow blocks to be declared as returning an array. Radar 6441502
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70277 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 01:10:27 +00:00
Ted Kremenek 3575f84e45 CFG:
- Add 'LoopTarget' pointer field to CFGBlock. This records if the block is used
  as the 'loop back' path back to the head of a loop.
- For ForStmt, encode the loop back target as the increment code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70274 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 00:51:56 +00:00
Eli Friedman f01fdff97b Get rid of some useless uses of NoExtensions. The philosophy here is
that if we're going to print an extension warning anyway, 
there's no point to changing behavior based on NoExtensions: it will 
only make error recovery worse.

Note that this doesn't cause any behavior change because NoExtensions 
isn't used by the current front-end.  I'm still considering what to do about
the remaining use of NoExtensions in IdentifierTable.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70273 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 00:51:18 +00:00
Eli Friedman b0156ea412 A couple more small changes which are probably required for Cygwin
builds to work (PR4088).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70269 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 23:43:36 +00:00
Eli Friedman 4e14823581 Attempt to fix reported build error on Cygwin, PR4088.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 23:36:17 +00:00
Devang Patel de13502158 While generating debug info ignore unnamed fields.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70266 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 22:40:36 +00:00
Douglas Gregor ab41e63821 Add a header containing the Clang version; make the driver use this
Clang version value rather than hard-coding "1.0".

Add PCH and Clang version information into the PCH file. Reject PCH
files with the wrong version information.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70264 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 22:23:34 +00:00
Chris Lattner 6bf690fd46 fix test/PCH/method_pool.m
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70263 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 22:17:41 +00:00
Chris Lattner cc7dea8f32 -E, -Eonly and -parse-noop now work with PCH!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 22:02:30 +00:00
Chris Lattner d1d64a0275 Teach PCH that ASTContext is optional. Move -parse-noop and -Eonly (so far)
processing to after PCH is loaded.  -Eonly and -parse-noop are close to working
with PCH now but are not quite there yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70257 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 21:45:14 +00:00
Sebastian Redl 13e8854b18 Track down return statements in the handlers of a function-try-block of constructors. Meh ...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 21:33:24 +00:00
Douglas Gregor 2bf1eb09f0 Be more careful in our teardown of the PCHReader after deciding to
ignore a PCH file.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70251 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 21:28:04 +00:00
Chris Lattner 1aee61a713 unnest some code, decoupling fixit rewriting from ast stuff.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70250 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 21:25:27 +00:00
Daniel Dunbar 57cbfc0c52 Add -empty-input-only option, for timing.
- Forces input file to be empty to time startup/shutdown costs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70249 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 21:19:07 +00:00
Sebastian Redl fef9f59e80 Don't allow catch declarations to name an abstract class
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70248 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 21:03:30 +00:00
Sebastian Redl 972041f45b Improve validation of C++ exception handling: diagnose throwing incomplete types and jumps into protected try-catch scopes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70242 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 20:27:31 +00:00
Douglas Gregor b81c170920 Add Sema::ExtVectorDecls and Sema::ObjCCategoryImpls to the PCH file. Since these vectors are very, very rarely used and, when used in headers, and even when used are relatively small, we load them eagerly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70240 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 20:06:05 +00:00
Ted Kremenek c6a59e4bf2 Add two new checker-specific attributes: 'objc_ownership_release' and
'objc_ownership_cfrelease'. These are the 'release' equivalents of
'objc_ownership_retain' and 'objc_ownership_cfretain' respectively.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 19:36:56 +00:00
Ted Kremenek e798e7c5a1 Track objects in GC mode returned by 'alloc', 'new', etc. methods. These are
treated as "not owned" objects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70232 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 19:14:45 +00:00
Chris Lattner 828e18cd80 make these be unsigned now that they are eagerly created.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70229 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 19:03:22 +00:00
Chris Lattner 090d9b53e3 shrink SOURCE_LOCATION_OFFSETS to use 4-byte entries instead of 8-byte
entries, shaving 100K off the PCH file for cocoa.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70228 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 19:01:47 +00:00
Douglas Gregor ce5148894c Fix a problem with the RUN line of one of the PCH tests
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70227 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 18:49:47 +00:00
Ted Kremenek 22afc65ce9 Refactor HandleObjCOwnershipRetainAttr and HandleObjCOwnershipCFRetainAttr into
HandleObjCOwnershipParmAttr. No functionality change (hopefully).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70224 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 18:41:18 +00:00
Douglas Gregor 4fed3f47f6 Implement caching of stat() calls for precompiled headers, which is
essentially the same thing we do with pretokenized headers. stat()
caching improves performance of the Cocoa-prefixed "Hello, World" by
45%.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70223 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 18:38:38 +00:00
Daniel Dunbar 8e03444e92 x86-32 ABI: Fix crash on return of structure with flexible array
member.

Also, spell bitfield more consistently as bit-field.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70220 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 18:31:32 +00:00
Ted Kremenek 4064de9598 Add new checker-specific attribute 'objc_ownership_cfretain'. This is the same
as 'objc_ownership_cfretain' except that the method acts like a CFRetain instead
of a [... retain] (important in GC modes). Checker support is wired up, but
currently only for Objective-C message expressions (not function calls).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70218 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 18:27:22 +00:00
Sebastian Redl f331fb40fd Fill in the C++ status table for exceptions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70217 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 18:25:15 +00:00
Chris Lattner c732f5a4ae encode the type and decl offsets with 32-bits for entry instead
of 64 bits.  This cuts 400KB off the PCH file for cocoa (7.1 -> 
6.7MB):

Before:

	Record Histogram:
		  Count    # Bits   % Abv  Record Kind
		      1     14296          SOURCE_LOCATION_PRELOADS
		      1   1699598  100.00  SOURCE_LOCATION_OFFSETS
		      1   1870766  100.00  METHOD_POOL
		      1    212988  100.00  SELECTOR_OFFSETS
		      1        88          STATISTICS
		      1       106          SPECIAL_TYPES
		      1  18033788  100.00  IDENTIFIER_TABLE
		      1   1806428  100.00  IDENTIFIER_OFFSET
		      1       170  100.00  TARGET_TRIPLE
		      1       268          LANGUAGE_OPTIONS
		      1   5168252  100.00  DECL_OFFSET
		      1    952700  100.00  TYPE_OFFSET

After:

	Record Histogram:
		  Count    # Bits   % Abv  Record Kind
		      1     14296          SOURCE_LOCATION_PRELOADS
		      1   1699598  100.00  SOURCE_LOCATION_OFFSETS
		      1   1870766  100.00  METHOD_POOL
		      1    212988  100.00  SELECTOR_OFFSETS
		      1        88          STATISTICS
		      1       106          SPECIAL_TYPES
		      1  18033788  100.00  IDENTIFIER_TABLE
		      1   1806428  100.00  IDENTIFIER_OFFSET
		      1       170  100.00  TARGET_TRIPLE
		      1       268          LANGUAGE_OPTIONS
		      1   2584156  100.00  DECL_OFFSET
		      1    476380  100.00  TYPE_OFFSET



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70216 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 18:24:17 +00:00
Chris Lattner ea5ce4705d add an abbreviation for common PARM_VAR_DECL. All but 9 of the
parm var decls in leopard cocoa.h end up using this abbreviation,
which shrinks the bitcode file by about 50K: 7217736->7167120.

Before:
  Block ID #12 (DECLS_BLOCK):
      Num Instances: 1
         Total Size: 2.23595e+07b/2.79494e+06B/698736W
          % of file: 38.7233
      Num SubBlocks: 0
        Num Abbrevs: 0
        Num Records: 139387
      % Abbrev Recs: 0

After:
  Block ID #12 (DECLS_BLOCK):
      Num Instances: 1
         Total Size: 2.02405e+07b/2.53006e+06B/632516W
          % of file: 35.301
      Num SubBlocks: 0
        Num Abbrevs: 1
        Num Records: 139387
      % Abbrev Recs: 19.2902



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70199 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 07:35:58 +00:00
Chris Lattner c47be9e5dd fix a couple more places that should be using the DeclCursor instead
of the normal stream cursor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70198 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 07:35:40 +00:00
Douglas Gregor 7f94b0b0c6 Load most of the source manager's information lazily from the PCH
file. In particular, only eagerly load source location entries for
files and for the predefines buffer. Other buffers and
macro-instantiation source location entries are loaded lazily.

With the Cocoa-prefixed "Hello, World", we only load 815/26555 source
location entities. This halves the amount of user time we spend in
this "Hello, World" program with -fsyntax-only (down to .007s).

This optimization is part 1 of 2 for the source manager. This
eliminates most of the user time in loading a PCH file. We still spend
too much time initialize File structures (especially in the calls to
stat), so we need to either make the loading of source location
entries for files lazy or import the stat cache from the PTH
implementation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70196 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 06:38:32 +00:00
Chris Lattner 63377d56de split expr/stmt writing out to PCHWriterStmt.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70194 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 06:20:01 +00:00
Chris Lattner 12b1c7615d split decl writing out to its own PCHWriterDecl.cpp file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70193 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 06:16:06 +00:00
Chris Lattner 02602be3cc unclone SavedStreamPosition
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70192 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 06:03:19 +00:00
Chris Lattner 4e3fcc845b move attribute reading to PCHReaderDecl.cpp, remove some
extraneous braces.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70191 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 06:01:06 +00:00
Chris Lattner da93061f56 read all decls (and attributes and stmts/exprs referenced by the decl)
from the DeclsCursor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70190 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 05:58:23 +00:00
Chris Lattner 887e2b375f rename GetStmt -> GetDeclStmt to make it clear that the stmt read
is part of a decl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70189 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 05:46:25 +00:00
Chris Lattner 52e97d1afc change the interface to ReadStmt to force clients to pass a cursor in to read from.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70188 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 05:41:06 +00:00
Chris Lattner 698f925ded split decl reading out to its own PCHReaderDecl.cpp file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70187 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 05:27:42 +00:00
Chris Lattner 4c6f952b70 split stmt/expr deserialization out to PCHReaderStmt.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70186 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 05:14:47 +00:00
Chris Lattner c7c11b1ba6 rdar://6827200 - [sema] reject statically allocated arrays of interface types
Upgrade "array of interface" warning to an error.  In addition to being a
terrible idea, this crashes codegen.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70178 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 01:55:56 +00:00
Chris Lattner d0359af511 Change our silencing of C typedef redefinition handling to what we had
before r69391: typedef redefinition is an error by default, but if
*either* the old or new definition are from a system header, we silence
it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70177 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 01:46:12 +00:00