summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
...
* fix display of source lines with null charactersSeth Cantrell2012-04-181-2/+5
| | | | llvm-svn: 154981
* Nicer display of unprintable source, and fix caret display for non-ascii textSeth Cantrell2012-04-181-159/+439
| | | | | | | | | | | | | Unprintable source in diagnostics is transformed to a printable form and then displayed with reversed colors if possible. Unprintable characters are displayed as <U+NNNN> while bytes that do not represent valid characters are shown as <XX>. Column adjustments to diagnostic carets, highlighted ranges, and fixups are made both for characters escaped as above and for characters which are printable but take up more than a single column. llvm-svn: 154980
* Revert "Nicer display of unprintable source, and fix caret display for ↵Seth Cantrell2012-04-171-440/+160
| | | | | | | | | | | | non-ascii text" This reverts commit e9a3b76ba589a8a884e978273beaed0d97cf9861. Revert "fix display of source lines with null characters" This reverts commit 70712b276e40bbe11e5063dfc7e82ce3209929cd. llvm-svn: 154950
* fix display of source lines with null charactersSeth Cantrell2012-04-171-2/+5
| | | | llvm-svn: 154947
* Nicer display of unprintable source, and fix caret display for non-ascii textSeth Cantrell2012-04-171-158/+435
| | | | | | | | | | | | | Unprintable source in diagnostics is transformed to a printable form and then displayed with reversed colors if possible. Unprintable characters are displayed as <U+NNNN> while bytes that do not represent valid characters are shown as <XX>. Column adjustments to diagnostic carets, highlighted ranges, and fixups are made both for characters escaped as above and for characters which are printable but take up more than a single column. llvm-svn: 154946
* objective-c modern translator: buildit objc boolFariborz Jahanian2012-04-161-0/+4
| | | | | | | type for rewriter project will be BoolTy. // rdar://11231426. llvm-svn: 154861
* ASTUnit: Don't clone the new DiagnosticConsumer, causing it to get leaked.Benjamin Kramer2012-04-141-2/+4
| | | | llvm-svn: 154739
* Remove the -cc1-level option "-pubnames-dump". Such things should stayDouglas Gregor2012-04-132-75/+0
| | | | | | out of the tree and use the tooling infrastructure. llvm-svn: 154668
* Implement the missing pieces needed to support libstdc++4.7's <atomic>:Richard Smith2012-04-131-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | __atomic_test_and_set, __atomic_clear, plus a pile of undocumented __GCC_* predefined macros. Implement library fallback for __atomic_is_lock_free and __c11_atomic_is_lock_free, and implement __atomic_always_lock_free. Contrary to their documentation, GCC's __atomic_fetch_add family don't multiply the operand by sizeof(T) when operating on a pointer type. libstdc++ relies on this quirk. Remove this handling for all but the __c11_atomic_fetch_add and __c11_atomic_fetch_sub builtins. Contrary to their documentation, __atomic_test_and_set and __atomic_clear take a first argument of type 'volatile void *', not 'void *' or 'bool *', and __atomic_is_lock_free and __atomic_always_lock_free have an argument of type 'const volatile void *', not 'void *'. With this change, libstdc++4.7's <atomic> passes libc++'s atomic test suite, except for a couple of libstdc++ bugs and some cases where libc++'s test suite tests for properties which implementations have latitude to vary. llvm-svn: 154640
* Changed all direct calls to CompletionConsumer.reset(..) to go callErik Verbruggen2012-04-121-4/+4
| | | | | | | | CompilerInstance::setCodeCompletionConsumer instead, in order to change the SkipFunctionBodies flag accordingly. Also fixed setCodeCompletionConsumer to take a reset() to null into account. llvm-svn: 154585
* Added a flag to the parser to skip method bodies.Erik Verbruggen2012-04-123-1/+8
| | | | llvm-svn: 154584
* [libclang] If displayDiagnostics is set (when calling clang_createIndex), ↵Argyrios Kyrtzidis2012-04-111-24/+44
| | | | | | | | | | | | | make sure to output the errors that occurred even if we did not get an AST (e.g. because the PCH failed to load). Also honor displayDiagnostics in clang_indexSourceFile(). rdar://11203489 llvm-svn: 154472
* [code-complete] Introduce CodeCompletionTUInfo which will be used for cachingArgyrios Kyrtzidis2012-04-101-9/+17
| | | | | | | | | | | | | | | | | | | code-completion related strings specific to a translation unit (ASTContext and related data) CodeCompletionAllocator does such limited caching, by caching the name assigned to a DeclContext*, but that is not the appropriate place since that object has a lifetime that can extend beyond that of an ASTContext. Introduce CodeCompletionTUInfo which will be always tied to a translation unit to do this kind of caching and move the caching of CodeCompletionAllocator into this object, and propagate it to all the places where it will be needed. The plan is to extend the caching where appropriate, using CodeCompletionTUInfo, to avoid re-calculating code-completion strings. Part of rdar://10796159. llvm-svn: 154408
* Revert r154321, pending more discussion.David Chisnall2012-04-091-3/+0
| | | | llvm-svn: 154327
* Add -fobjc-trace to emit a call before and after each Objective-C message sendDavid Chisnall2012-04-091-0/+3
| | | | | | for hooking in code flow visualisation applications. llvm-svn: 154321
* Teach Clang about PIE compilations. This is the first step of PR12380.Chandler Carruth2012-04-082-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First, this patch cleans up the parsing of the PIC and PIE family of options in the driver. The existing logic failed to claim arguments all over the place resulting in kludges that marked the options as unused. Instead actually walk all of the arguments and claim them properly. We now treat -f{,no-}{pic,PIC,pie,PIE} as a single set, accepting the last one on the commandline. Previously there were lots of ordering bugs that could creep in due to the nature of the parsing. Let me know if folks would like weird things such as "-fPIE -fno-pic" to turn on PIE, but disable full PIC. This doesn't make any sense to me, but we could in theory support it. Options that seem to have intentional "trump" status (-static, -mkernel, etc) continue to do so and are commented as such. Next, a -pie-level flag is threaded into the frontend, rigged to a language option, and handled preprocessor, setting up the appropriate defines. We'll now have the correct defines when compiling with -fpie. The one place outside of the preprocessor that was inspecting the PIC level (as opposed to the relocation model, which is set and handled separately, yay!) is in the GNU ObjC runtime. I changed it to exactly preserve existing behavior. If folks want to change its behavior in the face of PIE, they can do that in a separate patch. Essentially the only functionality changed here is the preprocessor defines and bug-fixes to the argument management. Tests have been updated and extended to test all of this a bit more thoroughly. llvm-svn: 154291
* [analyzer] Enable retry exhausted without inlining by default.Anna Zaks2012-03-281-3/+3
| | | | llvm-svn: 153591
* Move the emission of strict enum range metadata behind a flag (the sameChandler Carruth2012-03-271-0/+3
| | | | | | | | | | | | | | | | | | | | | flag as GCC uses: -fstrict-enums). There is a *lot* of code making unwarranted assumptions about the underlying type of enums, and it doesn't seem entirely reasonable to eagerly break all of it. Much more importantly, the current state of affairs is *very* good at optimizing based upon this information, which causes failures that are very distant from the actual enum. Before we push for enabling this by default, I think we need to implement -fcatch-undefined-behavior support for instrumenting and trapping whenever we store or load a value outside of the range. That way we can track down the misbehaving code very quickly. I discussed this with Rafael, and currently the only important cases he is aware of are the bool range-based optimizations which are staying hard enabled. We've not seen any issue with those either, and they are much more important for performance. llvm-svn: 153550
* [analyzer] Add an option to re-analyze a dead-end path without inlining.Anna Zaks2012-03-271-0/+3
| | | | | | | | | | | | | | | | | | | | | The analyzer gives up path exploration under certain conditions. For example, when the same basic block has been visited more than 4 times. With inlining turned on, this could lead to decrease in code coverage. Specifically, if we give up inside the inlined function, the rest of parent's basic blocks will not get analyzed. This commit introduces an option to enable re-run along the failed path, in which we do not inline the last inlined call site. This is done by enqueueing the node before the processing of the inlined call site with a special policy encoded in the state. The policy tells us not to inline the call site along the path. This lead to ~10% increase in the number of paths analyzed. Even though we expected a much greater coverage improvement. The option is turned off by default for now. llvm-svn: 153534
* Introduce a -cc1-level option -pubnames-dump, which simply dumps theDouglas Gregor2012-03-272-0/+75
| | | | | | | | list of identifiers that that 'public' names at the end of the translation unit, e.g., defined macros or identifiers with top-level names, in sorted order. Meant to support <rdar://problem/10921596>. llvm-svn: 153522
* Driver: Factor string vector push_back into a helper class and optimize it.Benjamin Kramer2012-03-261-264/+174
| | | | | | | | | | Due to lack of move semantics we would create a temporary std::string from the string literal, copy it into the vector and discard the temporary. This leads to massive code bloat, optimizing it saves 50k on i386-linux-Release+Asserts. While there add a two-element overload for push_back, simplifying code a bit. llvm-svn: 153441
* Since this change is generating a considerable amount of discussion (and ↵Aaron Ballman2012-03-251-56/+46
| | | | | | possibly even a regression for known bad versions), I'm reverting it. llvm-svn: 153420
* No longer hard coding paths to the MinGW include directories; using a ↵Aaron Ballman2012-03-251-46/+56
| | | | | | | | regular expression instead. Patch thanks to Nikola Smiljanic llvm-svn: 153413
* [frontend] Fix how the frontend handles -fno-inline. AFAIK clang now matchesChad Rosier2012-03-151-6/+4
| | | | | | | the behavior of gcc with respect to the -fno-inline and -fno-inline-functions flags. llvm-svn: 152861
* Adding in newer MinGW header paths.Aaron Ballman2012-03-151-0/+3
| | | | | | Patch thanks to Nikola Smiljanic llvm-svn: 152801
* [frontend] Add support for disabling the "inline" keyword using Chad Rosier2012-03-141-2/+3
| | | | | | | | | | | -fno-inline-functions. This behaves much like -fno-inline in gcc, but based on a discussion with Daniel it was decided that -fno-inline-functions should subsume -fno-inline. Please speak up if you object. The -fno-inline flag remains ignored. Final part of rdar://10972766 llvm-svn: 152754
* [driver] Parse diagnostic args in the driver.Chad Rosier2012-03-131-12/+25
| | | | | | | | | | | | | | | | | | | | | | | | Previously, only diagnostics thrown by the cc1 process were actually honoring the diagnostic options given on the command line, like -Werror. Reuse the existing code in Frontend currently used for cc1, adjusting it to not interpret -Wl, linker flags as warnings. Also fix a faulty test exposed by this change. It wasn't actually testing anything, and was giving this warning: clang-3: warning: argument unused during compilation: '-verify' Which -Werror didn't turn into an error because it was output by the driver, not the cc1 process, and diagnostic options weren't parsed by the driver. And you couldn't see the warning when running the test suite. Fixes PR12181. Patch by Dylan Noblesmith <nobled@dreamwidth.org>. llvm-svn: 152660
* [libclang] When there's a file error when saving the PCH, make sure toArgyrios Kyrtzidis2012-03-131-1/+3
| | | | | | | | clear the error from raw_fd_ostream, otherwise we will crash. rdar://10976410 llvm-svn: 152605
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-119-18/+18
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* No longer defining GNUC mode when compiling for Microsoft compatibility. ↵Aaron Ballman2012-03-101-5/+8
| | | | | | This allows people's cross-platform compiler-specific macros to work properly. llvm-svn: 152512
* [analyzer] Add support for NoRedundancy inlining mode.Anna Zaks2012-03-091-1/+1
| | | | | | | | | | | We do not reanalyze a function, which has already been analyzed as an inlined callee. As per PRELIMINARY testing, this gives over 50% run time reduction on some benchmarks without decreasing of the number of bugs found. Turning the mode on by default. llvm-svn: 152440
* [Basic] Rename LangOptions::NoInline to NoInlineDefine, to make things a bitDaniel Dunbar2012-03-092-2/+2
| | | | | | more obvious. llvm-svn: 152408
* [analyzer] Rework inlining related command line options.Anna Zaks2012-03-081-3/+63
| | | | | | | | | - Remove -analyzer-inline-call. - Add -analyzer-ipa=[none|inlining] - Add -analyzer-inlining-mode to allow experimentation for different performance tuning methods. llvm-svn: 152351
* Replace MarkVarRequired with a more genericRafael Espindola2012-03-081-2/+2
| | | | | | HandleCXXStaticMemberVarInstantiation. Suggested by Argyrios. llvm-svn: 152320
* Workaround module test failures by removing the version info from module hashes.Bob Wilson2012-03-071-1/+4
| | | | | | | | | | PR12196: The module hash strings are not actually hashing the compiler version string; the entire version string is being included in the hash. Depending on the module cache directory name, that can lead to failures where the path names become too long. As a temporary workaround, just remove the version string from the hash. llvm-svn: 152266
* [PCH] Mark a PCH file with a flag to indicate if the serialized AST hadArgyrios Kyrtzidis2012-03-073-12/+20
| | | | | | | | | | | | | | | | compiler errors or not. -Control whether ASTReader should reject such a PCH by a boolean flag at ASTReader's creation time. By default, such a PCH file will be rejected with an error when trying to load it. [libclang] Allow clang_saveTranslationUnit to create a PCH file even if compiler errors occurred. -Have libclang API calls accept a PCH that had compiler errors. The general idea is that we want libclang to stay functional even if a PCH had a compiler error. rdar://10976363. llvm-svn: 152192
* CMake: Fix build to add clangEdit to USED_LIBS.NAKAMURA Takumi2012-03-061-0/+1
| | | | llvm-svn: 152154
* [driver] What was implemented in r152130 was actually -fno-inline-functions, notChad Rosier2012-03-061-3/+4
| | | | | | | -fno-inline. Part of rdar://10972766 llvm-svn: 152145
* Add new code migrator support for migrating existing Objective-C code to useTed Kremenek2012-03-062-5/+83
| | | | | | | | | | | the new Objective-C NSArray/NSDictionary/NSNumber literal syntax. This introduces a new library, libEdit, which provides a new way to support migration of code that improves on the original ARC migrator. We now believe that most of its functionality can be refactored into the existing libraries, and thus this new library may shortly disappear. llvm-svn: 152141
* [driver] Add support for -fno-inline.Chad Rosier2012-03-061-2/+4
| | | | | | rdar://10972766 llvm-svn: 152130
* Fix a small difference in sema and codegen views of what needs to be output.Rafael Espindola2012-03-051-0/+5
| | | | | | | | | | | | In the included testcase, soma thinks that we already have a definition after we see the out of line decl. Codegen puts it in a deferred list, to be output if a use is seen. This would break when we saw an explicit template instantiation definition, since codegen would not be notified. This patch adds a method to the consumer interface so that soma can notify codegen that this decl is now required. llvm-svn: 152024
* [preprocessor] Enhance PreprocessingRecord to keep track of locations of ↵Argyrios Kyrtzidis2012-03-051-1/+1
| | | | | | | | | conditional directives. Introduce PreprocessingRecord::rangeIntersectsConditionalDirective() which returns true if a given range intersects with a conditional directive block. llvm-svn: 152018
* Frontend: Default to creating output files using temporary files + rename.Daniel Dunbar2012-03-031-1/+2
| | | | | | | | | - This is a more reliable default, as it behaves better on failure and also ensures that we create *new* files (instead of reusing existing inodes). This is useful for other applications (like lldb) which want to cache inode's to know when a file has been rewritten. llvm-svn: 151961
* Frontend: Don't automatically create missing directories when using ↵Daniel Dunbar2012-03-032-7/+22
| | | | | | | | temporary files with createOutputFile() - This would otherwise happen as a side effect of llvm::sys::fs::unique_file creating parent directories. llvm-svn: 151960
* [analyzer] Bound the size of the functions being inlined + provideAnna Zaks2012-03-021-0/+6
| | | | | | | | | | | command line options for inlining tuning. This adds the option for stack depth bound as well as function size bound. + minor doxygenification llvm-svn: 151930
* Add the Solaris support directory to the header search when using libc++.David Chisnall2012-03-021-0/+5
| | | | | | | | Unconditionally define __C99FEATURES__ when using C++ on Solaris. This is a (hopefully temporary) work around for libc++ exposing C99-but-not-C++98 features in C++98 mode. llvm-svn: 151889
* [analyzer] Turn inlining on by default for better testing exposure.Anna Zaks2012-03-011-1/+2
| | | | | | Fix a test, which was most likely an unintended recursive call. llvm-svn: 151848
* Add a flag -fthread-sanitizer.Kostya Serebryany2012-03-011-0/+3
| | | | | | | | | | This flag enables ThreadSanitizer instrumentation committed to llvm as r150423. The patch includes one test for -fthread-sanitizer and one similar test for -faddress-sanitizer. This patch does not modify the linker flags (as we do it for -faddress-sanitizer) because the run-time library is not yet committed and it's structure in compiler-rt is not 100% clear. The users manual wil be changed in a separate commit. llvm-svn: 151846
* Serialization: Switch over to using the native SmallVector based BitstreamWriterDaniel Dunbar2012-02-292-2/+2
| | | | | | ctor. llvm-svn: 151752
* Some more Solaris fixes. Now successfully building libc++ on Solaris with ↵David Chisnall2012-02-281-7/+0
| | | | | | clang (and linking clang against it). llvm-svn: 151632
OpenPOWER on IntegriCloud