summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
* Back out r70506 (exception spec in AST) again. We won't have exception specs ↵Sebastian Redl2009-05-062-14/+1
| | | | | | until we've had a lot more discussion. llvm-svn: 71125
* Eliminate extra vertical space in Clang diagnosticsDouglas Gregor2009-05-061-21/+3
| | | | llvm-svn: 71066
* Fix rdar://6849429 - -Wunused-value with deeply nested macro expansion ↵Chris Lattner2009-05-051-14/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | generates untraceable warnings The "instantiated from" messages coming from the caret diagnostics system are basically walking the macro expansion tree, emitting each level as it goes. However, it was skipping certain leaves in the tree by skipping up the entire instantiation arm every time it went up one spelling arm. This caused it to miss some things. For example, in this testcase: #define M1(x) x #define M2 1; void foo() { M1(M2) } we now print: /Users/sabre/Desktop/clang-unused-value-macro.c:6:2: warning: expression result unused M1(M2) ^~~~~~ /Users/sabre/Desktop/clang-unused-value-macro.c:6:5: note: instantiated from: M1(M2) ^~ /Users/sabre/Desktop/clang-unused-value-macro.c:3:12: note: instantiated from: #define M2 1; ^ Previously we didn't print the last line, so we never emitted the caret pointing to the 1! Incidentally, the spaces between the lines is really noisy, I think we should reconsider this heuristic (which adds them when the printed code starts too close to the start of the line). The regression test can't use -verify, because -verify doesn't catch notes for macro instantiation history. llvm-svn: 71025
* Implement attribute 'ns_autorelease'.Ted Kremenek2009-05-052-0/+2
| | | | llvm-svn: 70990
* Implement attribute 'cf_returns_owned' (mirrors 'ns_returns_owned').Ted Kremenek2009-05-052-0/+2
| | | | llvm-svn: 70952
* Remove experimental attribute 'ns_ownership_make_collectable.'Ted Kremenek2009-05-042-2/+0
| | | | llvm-svn: 70940
* Rename attributes 'objc_ownership...' to 'ns_ownership...'.Ted Kremenek2009-05-042-8/+8
| | | | llvm-svn: 70897
* Rename attributes:Ted Kremenek2009-05-042-4/+4
| | | | | | | | | | | 'objc_ownership_cfretain' -> 'cf_ownership_retain' 'objc_ownership_cfrelease' -> 'cf_ownership_release' Motivation: Core Foundation objects can be used in isolation from Objective-C, and this forces users to reason about the separate semantics of CF objects. More Sema support pending. llvm-svn: 70884
* Simplify the interesting-region code by assimmilating blocks of ↵Douglas Gregor2009-05-041-57/+18
| | | | | | non-whitespace text with each expansion step. It's easier and seems to have better results. llvm-svn: 70833
* Tweak the extraction of the "interesting" part of a source range in two ways: Douglas Gregor2009-05-041-4/+19
| | | | | | | | | 1) First of all, we treat _ as part of an identifier and not as punctuation (oops). 2) Second of all, always make sure that the token that the ^ is pointing at is fully within the "interesting" part of the range. llvm-svn: 70831
* Fix an infinite loop in diagnostic printing.Daniel Dunbar2009-05-031-7/+5
| | | | | | | | | | - The diagnostic is still poor, however. Doug, can you investigate? - Improved the test case to not depend on the file name, now it can be extended to actually check the formatting of the diagnostics (I'm hoping grep -A is portable here). llvm-svn: 70807
* Fix crash in source-line truncation code for diagnosticDouglas Gregor2009-05-031-2/+3
| | | | | | | printing. Also, when we only need to truncate the line at the end, make sure there is room for the ellipsis. llvm-svn: 70781
* temporary hack to work around PR4128Chris Lattner2009-05-031-1/+1
| | | | llvm-svn: 70681
* When a fix-it hint would span multiple lines, don't print it; half aDouglas Gregor2009-05-031-0/+21
| | | | | | | | | fix-it hint is much worse than no fix-it hint. (Fixes PR4084). When we need to truncate a source line to fix in the terminal, make sure to take the width of the fix-it information into account, too. llvm-svn: 70656
* When we truncate a source line to fit it within the terminal width,Douglas Gregor2009-05-031-5/+6
| | | | | | | | | | | | show an ellipsis where we have removed text. An example: /Users/dgregor/Projects/llvm/tools/clang/test/Misc/message-length.c:18:120: warning: comparison of distinct pointer types ('int *' and 'float *') ...a_func_to_call(ip == FloatPointer, ip[ALongIndexName], ... ~~ ^ ~~~~~~~~~~~~ llvm-svn: 70655
* Respect the COLUMNS environment variable for word-wrapping (so we getDouglas Gregor2009-05-031-1/+2
| | | | | | | | | | | word-wrapping by default in Emacs; yay!). Thanks, Daniel. Use LLVM's System layer rather than calling isatty() directly. Fix a thinko in printing the indentation string that was causing some weird output. llvm-svn: 70654
* When printing a source line as part of a diagnostic, the source lineDouglas Gregor2009-05-011-35/+180
| | | | | | | | | | | | | | | | | | | | | | | | might be wider than we're supposed to print. In this case, we try to select the "important" subregion of the source line, which contains everything that we want to show (e.g., with underlining and the caret itself) and tries to also contain some of the context. From the fantastically long line in the test case, we get an error message that slices down to this: message-length.c:18:120: warning: comparison of distinct pointer types ('int *' and 'float *') a_func_to_call(ip == FloatPointer, ip[ALongIndexName], ~~ ^ ~~~~~~~~~~~~ There are a bunch of gee-it-sounds-good heuristics in here, which seem to do well on the various simple tests I've thrown at it. However, we're going to need to look at a bunch more diagnostics to tweak these heuristics. This is the second part of <rdar://problem/6711348>. Almost there! llvm-svn: 70597
* Implement -fmessage-length=N, which word-wraps diagnostics to N columns. Douglas Gregor2009-05-011-7/+211
| | | | | | | | | | | | | | | | | | | | | | | | | | Also, put a line of whitespace between the diagnostic and the source code/caret line when the start of the actual source code text lines up (or nearly lines up) with the most recent line of the diagnostic. For example, here it's okay for the last line of the diagnostic to be (vertically) next to the source line, because there is horizontal whitespace to separate them: decl-expr-ambiguity.cpp:12:16: error: function-style cast to a builtin type can only take one argument typeof(int)(a,5)<<a; However, here is a case where we need the vertical separation (since there is no horizontal separation): message-length.c:10:46: warning: incompatible pointer types initializing 'void (int, float, char, float)', expected 'int (*)(int, float, short, float)' int (*fp1)(int, float, short, float) = f; This is part one of <rdar://problem/6711348>. llvm-svn: 70578
* Make a home for exception specs in the AST. Now Sema can hook them up.Sebastian Redl2009-04-302-1/+14
| | | | llvm-svn: 70506
* initial support for __[u]int128_t, which should be basicallyChris Lattner2009-04-302-0/+4
| | | | | | | | compatible with VC++ and GCC. The codegen/mangling angle hasn't been fully ironed out yet. Note that we accept int128_t even in 32-bit mode, unlike gcc. llvm-svn: 70464
* BugReporter/PathDiagnostics:Ted Kremenek2009-04-291-0/+1
| | | | | | | | | - Add an (optional) short description for BugReports for clients that want to distinguish between long and short descriptions for bugs - Make the bug report for VLA less obscene for Plist diagnostics by using the short description llvm-svn: 70415
* In -fdiagnostics-print-source-range-info mode, print a space before theChris Lattner2009-04-281-1/+14
| | | | | | | lines that clang extracts from the source code so that machine parsing can easily ignore them. llvm-svn: 70337
* Implement ownership attribute 'objc_ownership_make_collectable'. This allows oneTed Kremenek2009-04-282-2/+4
| | | | | | to add 'CFMakeCollectable' semantics to a method. llvm-svn: 70336
* Make all PCH-incompatibility warnings into errors, and abortDouglas Gregor2009-04-281-10/+1
| | | | | | | compilation if the user requested a PCH file but no such PCH file exists. llvm-svn: 70332
* Make the PCH reader use the diagnostics system for its complaints.Douglas Gregor2009-04-282-52/+46
| | | | llvm-svn: 70330
* Optimize IdentifierInfo storage within the precompiled header. We'veDouglas Gregor2009-04-282-15/+10
| | | | | | now gotten back about 180k of the 500k we lost. llvm-svn: 70326
* Implement a minor space optimization for the PCH identifier table,Douglas Gregor2009-04-282-12/+45
| | | | | | | | which eliminates the storage for IdentifierInfo in the "uninteresting identifier" cases. Sadly, this only brought back 7k of the 500k we lost :( llvm-svn: 70325
* Replace a lame fprintf with a slightly-less lame diagnosticDouglas Gregor2009-04-281-4/+4
| | | | llvm-svn: 70322
* Implement checking for macro definitions that occur on the commandDouglas Gregor2009-04-282-8/+33
| | | | | | | | line when using a PCH that were not provided when building the PCH file. If those names were used as identifiers somewhere in the PCH file, reject the PCH file. llvm-svn: 70321
* Revert r70075 and r70078, which reorganized the PCH on-disk hash tableDouglas Gregor2009-04-282-76/+12
| | | | | | | | | | for identifiers to separate "interesting" from "uninteresting" identifiers. However, to cope with compiler invocations where the predefines buffers mismatch, we need to be able to search the complete identifier table. Cocoa.h.pch is now about 500k larger that it used to be :( llvm-svn: 70320
* Allow some differences between the predefines buffer used to build aDouglas Gregor2009-04-281-42/+182
| | | | | | | | | | | | | PCH file and the predefines buffer used when including the PCH file. We (explicitly) detect conflicting macro definitions (rejecting the PCH file) and about missing macro definitions (they'll be automatically pulled from the PCH file anyway). We're missing some checking to make sure that new macro definitions won't have any impact on the PCH file itself (e.g., #define'ing an identifier that the PCH file used). llvm-svn: 70316
* Remove unused LangOptions NoExtensions and Boolean.Eli Friedman2009-04-282-4/+0
| | | | llvm-svn: 70282
* Add a header containing the Clang version; make the driver use thisDouglas Gregor2009-04-272-10/+25
| | | | | | | | | 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. llvm-svn: 70264
* fix test/PCH/method_pool.mChris Lattner2009-04-271-1/+1
| | | | llvm-svn: 70263
* -E, -Eonly and -parse-noop now work with PCH!Chris Lattner2009-04-271-0/+2
| | | | llvm-svn: 70259
* Teach PCH that ASTContext is optional. Move -parse-noop and -Eonly (so far)Chris Lattner2009-04-273-125/+128
| | | | | | | processing to after PCH is loaded. -Eonly and -parse-noop are close to working with PCH now but are not quite there yet. llvm-svn: 70257
* Be more careful in our teardown of the PCHReader after deciding toDouglas Gregor2009-04-271-0/+8
| | | | | | ignore a PCH file. llvm-svn: 70251
* Add Sema::ExtVectorDecls and Sema::ObjCCategoryImpls to the PCH file. Since ↵Douglas Gregor2009-04-272-0/+50
| | | | | | these vectors are very, very rarely used and, when used in headers, and even when used are relatively small, we load them eagerly. llvm-svn: 70240
* Add two new checker-specific attributes: 'objc_ownership_release' andTed Kremenek2009-04-272-0/+4
| | | | | | | 'objc_ownership_cfrelease'. These are the 'release' equivalents of 'objc_ownership_retain' and 'objc_ownership_cfretain' respectively. llvm-svn: 70235
* make these be unsigned now that they are eagerly created.Chris Lattner2009-04-271-4/+4
| | | | llvm-svn: 70229
* shrink SOURCE_LOCATION_OFFSETS to use 4-byte entries instead of 8-byteChris Lattner2009-04-272-3/+3
| | | | | | entries, shaving 100K off the PCH file for cocoa. llvm-svn: 70228
* Implement caching of stat() calls for precompiled headers, which isDouglas Gregor2009-04-272-3/+248
| | | | | | | | essentially the same thing we do with pretokenized headers. stat() caching improves performance of the Cocoa-prefixed "Hello, World" by 45%. llvm-svn: 70223
* Add new checker-specific attribute 'objc_ownership_cfretain'. This is the sameTed Kremenek2009-04-272-0/+2
| | | | | | | | 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). llvm-svn: 70218
* encode the type and decl offsets with 32-bits for entry insteadChris Lattner2009-04-272-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 70216
* add an abbreviation for common PARM_VAR_DECL. All but 9 of the Chris Lattner2009-04-272-7/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 70199
* fix a couple more places that should be using the DeclCursor instead Chris Lattner2009-04-271-11/+10
| | | | | | of the normal stream cursor. llvm-svn: 70198
* Load most of the source manager's information lazily from the PCHDouglas Gregor2009-04-272-124/+234
| | | | | | | | | | | | | | | | | | | 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. llvm-svn: 70196
* split expr/stmt writing out to PCHWriterStmt.cppChris Lattner2009-04-273-799/+822
| | | | llvm-svn: 70194
* split decl writing out to its own PCHWriterDecl.cpp file.Chris Lattner2009-04-273-445/+470
| | | | llvm-svn: 70193
* unclone SavedStreamPositionChris Lattner2009-04-272-35/+0
| | | | llvm-svn: 70192
OpenPOWER on IntegriCloud