llvm-project/clang
Jordan Rose ba101e1b3b Use the new LLVM_LVALUE_FUNCTION to ban two getAs() calls on rvalues.
If 'x' is a temporary, x.getAs<Foo>() may not be safe if the result is
supposed to persist (if its address is stored somewhere). Since getAs()
can return a null value, the result is almost always stored into a
variable, which of course is not safe when the original value dies.

This has caused several bugs with GCC's "Temporaries May Vanish Sooner Than
You Expect" optimization; in C++11 builds, at least, we'll be able to catch
these problems now.

I would suggest applying these to other getAs() and get*As() methods
(castAs is "better" because sometimes the result is used directly, which
means the temporary will still be live), but these two have both caused
trouble in the analyzer in the past.

llvm-svn: 168967
2012-11-30 01:15:32 +00:00
..
INPUTS Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164766 2012-09-27 10:16:10 +00:00
bindings [clang.py] Add Cursor.get_arguments() 2012-11-01 05:46:30 +00:00
docs This patch exposes to Clang users three more sanitizers are experimental features of ASan: 2012-11-29 22:36:21 +00:00
examples Fix examples. 2012-11-27 16:16:02 +00:00
include Use the new LLVM_LVALUE_FUNCTION to ban two getAs() calls on rvalues. 2012-11-30 01:15:32 +00:00
lib Keep track of modules that have failed to build. If we encounter an 2012-11-29 23:55:25 +00:00
runtime UBSan: enable proper linking with UBsan runtime on Darwin. Turn on building ubsan on OS X in 'make' build system. Patch by Jean-Daniel Dupas. 2012-11-16 12:53:14 +00:00
test Keep track of modules that have failed to build. If we encounter an 2012-11-29 23:55:25 +00:00
tools [analyzer] scan-build: Don't forget to close our temp file for Clang's output. 2012-11-28 19:12:44 +00:00
unittests Fix unit tests for ModuleLoader change in r168961. 2012-11-30 00:01:57 +00:00
utils [analyzer] SATestBuild.py: allow make builds to disable parallelization 2012-11-26 19:59:57 +00:00
www docs: [CMake] Add Xcode to the list of project formats CMake can generate. 2012-11-27 23:34:28 +00:00
.gitignore Add extra vim swap file pattern 2012-10-09 23:48:58 +00:00
CMakeLists.txt CMake: Fix public header search for generating Xcode/MSVC projects. 2012-10-23 21:54:03 +00:00
CODE_OWNERS.TXT Duplicate some common owners between Clang and LLVM. 2012-11-27 00:48:12 +00:00
INSTALL.txt
LICENSE.TXT
Makefile The top-level clang Makefile is #included into other Makefiles. (sigh) So we 2012-10-03 08:39:19 +00:00
ModuleInfo.txt
NOTES.txt Fix typo (test commit) 2012-10-18 15:24:46 +00:00
README.txt commit access verified, revert change 2012-03-06 22:55:51 +00:00

README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:              http://clang.llvm.org/
Building and using Clang:          http://clang.llvm.org/get_started.html
Clang Static Analyzer:             http://clang-analyzer.llvm.org/
Information on the LLVM project:   http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang development mailing list:
  http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/