summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
* clang support for Bitrig (an OpenBSD fork); patch by David Hill.Eli Friedman2012-08-081-0/+1
| | | | llvm-svn: 161546
* Preprocessor: fix __OPTIMIZE_SIZE__ and -OzDylan Noblesmith2012-08-081-2/+3
| | | | | | | | | | | | Add some tests for __OPTIMIZE_SIZE__ and __NO_INLINE__, removing the superfluous copies in the target-specific tests, since it's target-independent. This uncovered a bug in the handling of -Oz: it would attempt to store the value 2 in the 1-bit bitfield OptimizeSize, leaving a value of 0 and never defining __OPTIMIZE_SIZE__. llvm-svn: 161495
* Frontend: further document __BYTE_ORDER__Dylan Noblesmith2012-08-081-1/+3
| | | | llvm-svn: 161494
* Remove unused variables.Benjamin Kramer2012-08-081-7/+0
| | | | llvm-svn: 161483
* Correct AddDefaultCIncludePaths for OpenBSD to not include /usr/local/includeHans Wennborg2012-08-021-0/+1
| | | | | | | | | in the default search path. Compilers on *BSD OS's only include /usr/include by default. Contributed by Brad Smith <brad@comstyle.com> llvm-svn: 161173
* [analyzer] Turn -cfg-add-initializers on by default, and remove the flag.Jordan Rose2012-07-311-1/+0
| | | | llvm-svn: 161060
* Added -ast-list option to dump filterable AST decl node names.Alexander Kornienko2012-07-313-0/+35
| | | | llvm-svn: 161040
* Preprocessor: add __BYTE_ORDER__ predefined macroDylan Noblesmith2012-07-271-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | The __BYTE_ORDER__ predefined macro was added in GCC 4.6: http://gcc.gnu.org/onlinedocs/gcc-4.6.0/cpp/Common-Predefined-Macros.html It's used like the following: #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ ... #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ... #else #error insane architecture like the pdp-11 #endif There's a similar macro, __FLOAT_WORD_ORDER__, but it looks like it mainly exist to accommodate fairly obscure architectures and ARM's old FPA instructions, so it doesn't seem nearly as useful. The tests are updated to check for the correct(at least, based on clang's current output) value of the macro on each target. So now the suite will catch bugs like the one fixed in r157626. llvm-svn: 160879
* clang/lib: [CMake] Update tblgen'd dependencies.NAKAMURA Takumi2012-07-271-0/+4
| | | | llvm-svn: 160851
* clang/lib: [CMake] Reformat, alphabetize lists.NAKAMURA Takumi2012-07-271-2/+2
| | | | llvm-svn: 160850
* Added -ast-dump-filter option to clang -cc1.Alexander Kornienko2012-07-263-19/+64
| | | | llvm-svn: 160784
* Fix a typo (the the => the)Sylvestre Ledru2012-07-232-2/+2
| | | | llvm-svn: 160622
* Rename -fms-inline-asm to -fenable-experimental-ms-inline-asm.Chad Rosier2012-07-201-1/+1
| | | | llvm-svn: 160590
* Add the mechanics for -fms-inline-asm. No easy way to test at this time.Chad Rosier2012-07-201-0/+1
| | | | llvm-svn: 160580
* Re-apply r160319 "Don't crash when emitting fixits following Unicode chars"Jordan Rose2012-07-201-29/+29
| | | | | | | | | This time, make sure we don't try to print fixits with newline characters, since they don't have a valid column width, and they don't look good anyway. PR13417 (and originally <rdar://problem/11877454>) llvm-svn: 160561
* Revert r160319, it caused PR13417. Add a test for PR13417.Nico Weber2012-07-201-26/+27
| | | | llvm-svn: 160542
* Define __FINITE_MATH_ONLY__ based on -ffast-math and -ffinite-math-only.Bob Wilson2012-07-192-3/+5
| | | | | | | This macro was being unconditionally set to zero, preceded by a FIXME comment. This fixes <rdar://problem/11845441>. Patch by Michael Gottesman! llvm-svn: 160491
* Don't crash when emitting fixits following Unicode characters.Jordan Rose2012-07-161-27/+26
| | | | | | | | | | | | | | | This code is very sensitive to the difference between "columns" as printed and "bytes" (SourceManager columns). All variables are now named explicitly and our assumptions are (hopefully) documented as both comment and assertion. Whether parseable fixits should use byte offsets or Unicode character counts is pending discussion on the mailing list; currently the implementation uses bytes (and has no problems on lines containing multibyte characters). This has been added to the user manual. <rdar://problem/11877454> llvm-svn: 160319
* PR13312: Don't crash when printing a fixit that ends in a unicode character.Benjamin Kramer2012-07-121-1/+6
| | | | llvm-svn: 160112
* Add OpenCL metadata for kernel arg names. This output is controlled via a ↵Tanya Lattner2012-07-111-0/+3
| | | | | | | | flag as noted in the OpenCL Spec. Includes a test case. llvm-svn: 160092
* Introduce a flag in SourceManager to treat non-system source filesArgyrios Kyrtzidis2012-07-111-8/+20
| | | | | | | | | | | | | | | | | | | | as "volatile", meaning there's a high enough chance that they may change while we are trying to use them. This flag is only enabled by libclang. Currently "volatile" source files will be stat'ed immediately before opening them, because the file size stat info may not be accurate since when we got it (e.g. from the PCH). This avoids crashes when trying to reference mmap'ed memory from a file whose size is not what we expect. Note that there's still a window for a racing issue to occur but the window for it should be way smaller than before. We can consider later on to avoid mmap completely on such files. rdar://11612916 llvm-svn: 160074
* Allow -verify directives to be filtered by preprocessing.Jordan Rose2012-07-111-28/+90
| | | | | | | | | | | | | | | | | | | | | This is accomplished by making VerifyDiagnosticsConsumer a CommentHandler, which then only reads the -verify directives that are actually in live blocks of code. It also makes it simpler to handle -verify directives that appear in header files, though we still have to manually reparse some files depending on how they are generated. This requires some test changes. In particular, all PCH tests now have their -verify directives outside the "header" portion of the file, using the @line syntax added in r159978. Other tests have been modified mostly to make it clear what is being tested, and to prevent polluting the expected output with the directives themselves. Patch by Andy Gibbs! (with slight modifications) The new Frontend/verify-* tests exercise the functionality of this commit, as well as r159978, r159979, and r160053 (Andy's other -verify enhancements). llvm-svn: 160068
* Emit -verify diagnostics even when we have a fatal error.Jordan Rose2012-07-111-2/+2
| | | | | | | | | | | | | | Previously we'd halt at the fatal error as expected, but not actually emit any -verify-related diagnostics. This lets us catch cases that emit a /different/ fatal error from the one we expected. This is implemented by adding a "force emit" mode to DiagnosticBuilder, which will cause diagnostics to immediately be emitted regardless of current suppression. Needless to say this should probably be used /very/ sparingly. Patch by Andy Gibbs! Tests for all of Andy's -verify patches coming soon. llvm-svn: 160053
* Clear diagnostic counts after processing the diagnostics.Axel Naumann2012-07-101-0/+3
| | | | | | The consumer might see multiple input files (e.g. for cling) and since r159977 the count is maintained across input files. llvm-svn: 159995
* Allow -verify directives to specify a min and max count, not just "+".Jordan Rose2012-07-101-21/+33
| | | | | | | | | | | void f(); // expected-note 0+ {{previous declaration is here}} void g(); // expected-note 0-1 {{previous declaration is here}} The old "+" syntax is still an alias for "1+", and single numbers still work. Patch by Andy Gibbs! llvm-svn: 159979
* Allow line numbers on -verify directives.Jordan Rose2012-07-101-55/+83
| | | | | | | | | | | // expected-warning@10 {{some text}} The line number may be absolute (as above), or relative to the current line by prefixing the number with either '+' or '-'. Patch by Andy Gibbs! llvm-svn: 159978
* Clean up VerifyDiagnosticsConsumer in preparation for upcoming enhancements.Jordan Rose2012-07-101-73/+22
| | | | | | Patch by Andy Gibbs! llvm-svn: 159977
* Re-apply r159875 with fixes.Ted Kremenek2012-07-071-10/+0
| | | | | | | - Split pedantic driver flag test into separate test file, and XFAIL on cygwin,mingw32 - Fix bug in tablegen logic where a missing '{' caused errors to be included in -Wpedantic. llvm-svn: 159892
* Revert rr159875, "Implement -Wpedantic and --no-pedantic to complement ↵NAKAMURA Takumi2012-07-071-0/+10
| | | | | | | | | | -Weverything." It broke several builds. I suspect FileCheck might match assertion failure, even if clang/test/Misc/warning-flags.c passed the test. > 0. Program arguments: bin/./clang -### -pedantic -Wpedantic clang/test/Driver/warning-options.cpp llvm-svn: 159886
* Implement -Wpedantic and --no-pedantic to complement -Weverything.Ted Kremenek2012-07-061-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces some magic in tablegen to create a "Pedantic" diagnostic group which automagically includes all warnings that are extensions. This allows a user to suppress specific warnings traditionally under -pedantic used an ordinary warning flag. This also allows users to use #pragma to silence specific -pedantic warnings, or promote them to errors, within blocks of text (just like any other warning). -Wpedantic is NOT an alias for -pedantic. Instead, it provides another way to (a) activate -pedantic warnings and (b) disable them. Where they differ is that -pedantic changes the behavior of the preprocessor slightly, whereas -Wpedantic does not (it just turns on the warnings). The magic in the tablegen diagnostic emitter has to do with computing the minimal set of diagnostic groups and diagnostics that should go into -Wpedantic, as those diagnostics that already members of groups that themselves are (transitively) members of -Wpedantic do not need to be included in the Pedantic group directly. I went back and forth on whether or not to magically generate this group, and the invariant was that we always wanted extension warnings to be included in -Wpedantic "some how", but the bookkeeping would be very onerous to manage by hand. -no-pedantic (and --no-pedantic) is included for completeness, and matches many of the same kind of flags the compiler already supports. It does what it says: cancels out -pedantic. One discrepancy is that if one specifies --no-pedantic and -Weverything or -Wpedantic the pedantic warnings are still enabled (essentially the -W flags win). We can debate the correct behavior here. Along the way, this patch nukes some code in TextDiagnosticPrinter.cpp and CXStoredDiagnostic.cpp that determine whether to include the "-pedantic" flag in the warning output. This is no longer needed, as all extensions now have a -W flag. This patch also significantly reduces the number of warnings not under flags from 229 to 158 (all extension warnings). That's a 31% reduction. llvm-svn: 159875
* Add -ffp-contract = { fast | on | off } command line option support.Lang Hames2012-07-061-0/+17
| | | | | | | | | | | | | | | | | This flag sets the 'fp-contract' mode, which controls the formation of fused floating point operations. Available modes are: - Fast: Form fused operations anywhere. - On: Form fused operations where allowed by FP_CONTRACT. This is the default mode. - Off: Don't form fused operations (in future this may be relaxed to forming fused operations where it can be proved that the result won't be affected). Currently clang doesn't support the FP_CONTRACT pragma, so the 'On' and 'Off' modes are equivalent. llvm-svn: 159794
* Implement AST classes for comments, a real parser for Doxygen comments and aDmitri Gribenko2012-07-061-0/+1
| | | | | | | | | | | | | | very simple semantic analysis that just builds the AST; minor changes for lexer to pick up source locations I didn't think about before. Comments AST is modelled along the ideas of HTML AST: block and inline content. * Block content is a paragraph or a command that has a paragraph as an argument or verbatim command. * Inline content is placed within some block. Inline content includes plain text, inline commands and HTML as tag soup. llvm-svn: 159790
* [libclang] Protect against a race condition where a threadArgyrios Kyrtzidis2012-07-031-1/+2
| | | | | | | | | may be destroying an ASTUnit while cleanupOnDiskMapAtExit is getting called. rdar://11781241 llvm-svn: 159664
* Reduce default template instantiation depth to 512; we're blowing outDouglas Gregor2012-07-021-1/+1
| | | | | | the stack too often with 1024. Fixes <rdar://problem/11678534>. llvm-svn: 159573
* Add a new libclang completion API to get brief documentation comment that isDmitri Gribenko2012-07-023-36/+57
| | | | | | | | | | | | | | | | attached to a declaration in the completion string. Since extracting comments isn't free, a new code completion option is introduced. A new code completion option that enables including brief comments into CodeCompletionString should be a, err, code completion option. But because ASTUnit caches global declarations during parsing before even completion consumer is created, the option is duplicated as a translation unit option (in both libclang and ASTUnit, like the option to cache code completion results). llvm-svn: 159539
* When applying a template diff highlighting to a diagnostic message, rememberRichard Trieu2012-06-281-10/+19
| | | | | | to reapply the bold formatting when needed. llvm-svn: 159386
* Fix template type diffing coloring (r159216) when forcing color output to a ↵David Blaikie2012-06-281-2/+5
| | | | | | | | file (not a terminal) Reviewed (over the shoulder) by Richard Trieu. llvm-svn: 159381
* Add -ftls-model command-line flag.Hans Wennborg2012-06-281-1/+31
| | | | | | This allows for setting the default TLS model. (PR9788) llvm-svn: 159336
* Add template type diffing to Clang. This feature will provide a betterRichard Trieu2012-06-263-4/+32
| | | | | | | | | | | | comparison between two templated types when they both appear in a diagnostic. Type elision will remove indentical template arguments, which can be disabled with -fno-elide-type. Cyan highlighting is applied to the differing types. For more formatting, -fdiagnostic-show-template-tree will output the template type as an indented text tree, with differences appearing inline. Template tree works with or without type elision. llvm-svn: 159216
* Documentation cleanup: escape \ characters in Doxygen comments as needed.James Dennett2012-06-221-2/+2
| | | | llvm-svn: 158968
* Remove a goofy CMake hack and use the standard CMake facilities toChandler Carruth2012-06-211-13/+13
| | | | | | | | | express library-level dependencies within Clang. This is no more verbose really, and plays nicer with the rest of the CMake facilities. It should also have no change in functionality. llvm-svn: 158888
* Restructure how the driver communicates information about theJohn McCall2012-06-202-17/+11
| | | | | | | | | | | | | | | | | | | | | | | | target Objective-C runtime down to the frontend: break this down into a single target runtime kind and version, and compute all the relevant information from that. This makes it relatively painless to add support for new runtimes to the compiler. Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z, available at the driver level as a better and more general alternative to -fgnu-runtime and -fnext-runtime. This new concept of an Objective-C runtime also encompasses what we were previously separating out as the "Objective-C ABI", so fragile vs. non-fragile runtimes are now really modelled as different kinds of runtime, paving the way for better overall differentiation. As a sort of special case, continue to accept the -cc1 flag -fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak. I won't go so far as to say "no functionality change", even ignoring the new driver flag, but subtle changes in driver semantics are almost certainly not intended. llvm-svn: 158793
* Extend the support for cl-std to include 1.2.Tanya Lattner2012-06-191-3/+14
| | | | | | | Add error checking for the static qualifier which is now allowed in certain situations for OpenCL 1.2. Use the CL version to turn on this feature. Added test case for 1.2 static storage class feature. llvm-svn: 158759
* Add a -fuse-init-array option to cc1 and map to the UseInitArray targetRafael Espindola2012-06-191-0/+1
| | | | | | | | | option. On the driver, check if we are using libraries from gcc 4.7 or newer and if so pass -fuse-init-array to the frontend. The crtbegin*.o files in gcc 4.7 no longer call the constructors listed in .ctors, so we have to use .init_array. llvm-svn: 158694
* Sink definition of IBOutlet, IBOutletCollection, and IBAction intoTed Kremenek2012-06-191-0/+5
| | | | | | | the compiler predefines buffer. These are essentially part of the Objective-C language. llvm-svn: 158690
* Add language std for OpenCL 1.1 and 1.2.Tanya Lattner2012-06-181-1/+14
| | | | llvm-svn: 158686
* Move a few static functions from DiagnosticRenderer.cpp into SourceManager.Matt Beaumont-Gay2012-06-181-71/+6
| | | | | | | | This simplifies the code a little bit, since these functions all took a SourceManager parameter and called a bunch of methods on it, and makes the functions available to other users. llvm-svn: 158676
* Explicitly build __builtin_va_list.Meador Inge2012-06-161-3/+0
| | | | | | | The target specific __builtin_va_list types are now explicitly built instead of injecting strings into the preprocessor input. llvm-svn: 158592
* [-E] Emit a rewritten _Pragma on its own line.Jordan Rose2012-06-151-29/+36
| | | | | | | | | | | 1. Teach Lexer that pragma lexers are like macro expansions at EOF. 2. Treat pragmas like #define/#undef when printing. 3. If we just printed a directive, add a newline before any more tokens. (4. Miscellaneous cleanup in PrintPreprocessedOutput.cpp) PR10594 and <rdar://problem/11562490> (two separate related problems) llvm-svn: 158571
* Documentation cleanup: escape # in a Doxygen comment.James Dennett2012-06-151-1/+1
| | | | llvm-svn: 158554
OpenPOWER on IntegriCloud