From dbe13110f59f48b4dbb7552b3ac2935acdeece7f Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 14 Apr 2012 14:01:31 +0000 Subject: Vendor import of clang trunk r154661: http://llvm.org/svn/llvm-project/cfe/trunk@r154661 --- docs/AddressSanitizer.html | 139 ++++++++ docs/AnalyzerRegions.html | 6 +- docs/AutomaticReferenceCounting.html | 387 ++++++++++++++++---- docs/Block-ABI-Apple.txt | 1 - docs/DriverInternals.html | 26 +- docs/InternalsManual.html | 64 ++-- docs/LanguageExtensions.html | 660 ++++++++++++++++++++++++++++------- docs/ObjectiveCLiterals.html | 314 +++++++++++++++++ docs/PCHInternals.html | 8 +- docs/PTHInternals.html | 6 +- docs/ReleaseNotes.html | 193 ++++++++++ docs/UsersManual.html | 89 +++-- docs/doxygen.cfg.in | 2 +- docs/tools/clang.pod | 2 +- 14 files changed, 1623 insertions(+), 274 deletions(-) create mode 100644 docs/AddressSanitizer.html create mode 100644 docs/ObjectiveCLiterals.html create mode 100644 docs/ReleaseNotes.html (limited to 'docs') diff --git a/docs/AddressSanitizer.html b/docs/AddressSanitizer.html new file mode 100644 index 000000000000..c1dc91bf4c88 --- /dev/null +++ b/docs/AddressSanitizer.html @@ -0,0 +1,139 @@ + + + + + + AddressSanitizer, a fast memory error detector + + + + + + + + +
+ +

AddressSanitizer

+ + +

Introduction

+AddressSanitizer is a fast memory error detector. +It consists of a compiler instrumentation module and a run-time library. +The tool can detect the following types of bugs: + +Typical slowdown introduced by AddressSanitizer is 2x. + +

How to build

+Follow the clang build instructions.
+Note: CMake build does not work yet. +See bug 12272. + +

Usage

+Simply compile and link your program with -faddress-sanitizer flag.
+To get a reasonable performance add -O1 or higher.
+To get nicer stack traces in error messages add +-fno-omit-frame-pointer.
+To get perfect stack traces you may need to disable inlining (just use -O1) and tail call +elimination (-fno-optimize-sibling-calls). + +
+% cat example_UseAfterFree.cc
+int main(int argc, char **argv) {
+  int *array = new int[100];
+  delete [] array;
+  return array[argc];  // BOOM
+}
+
+ +
+% clang -O1 -g -faddress-sanitizer -fno-omit-frame-pointer example_UseAfterFree.cc
+
+ +If a bug is detected, the program will print an error message to stderr and exit with a +non-zero exit code. +Currently, AddressSanitizer does not symbolize its output, so you may need to use a +separate script to symbolize the result offline (this will be fixed in future). +
+% ./a.out 2> log
+% projects/compiler-rt/lib/asan/scripts/asan_symbolize.py / < log | c++filt
+==9442== ERROR: AddressSanitizer heap-use-after-free on address 0x7f7ddab8c084 at pc 0x403c8c bp 0x7fff87fb82d0 sp 0x7fff87fb82c8
+READ of size 4 at 0x7f7ddab8c084 thread T0
+    #0 0x403c8c in main example_UseAfterFree.cc:4
+    #1 0x7f7ddabcac4d in __libc_start_main ??:0
+0x7f7ddab8c084 is located 4 bytes inside of 400-byte region [0x7f7ddab8c080,0x7f7ddab8c210)
+freed by thread T0 here:
+    #0 0x404704 in operator delete[](void*) ??:0
+    #1 0x403c53 in main example_UseAfterFree.cc:4
+    #2 0x7f7ddabcac4d in __libc_start_main ??:0
+previously allocated by thread T0 here:
+    #0 0x404544 in operator new[](unsigned long) ??:0
+    #1 0x403c43 in main example_UseAfterFree.cc:2
+    #2 0x7f7ddabcac4d in __libc_start_main ??:0
+==9442== ABORTING
+
+ +

__has_feature(address_sanitizer)

+In some cases one may need to execute different code depending on whether +AddressSanitizer is enabled. +__has_feature +can be used for this purpose. +
+#if defined(__has_feature) && __has_feature(address_sanitizer)
+  code that runs only under AddressSanitizer
+#else
+  code that does not run under AddressSanitizer
+#endif
+
+ +

Supported Platforms

+AddressSanitizer is supported on + +Support for Linux i386/ARM and MacOS 10.7 is in progress +(it may work, but is not guaranteed too). + + +

Limitations

+ + + +

Current Status

+AddressSanitizer is fully functional on supported platforms in LLVM head. +However, the test suite is not fully integrated yet and we lack the testing +process (buildbots). + +

More Information

+http://code.google.com/p/address-sanitizer. + + +
+ + diff --git a/docs/AnalyzerRegions.html b/docs/AnalyzerRegions.html index 35708d57c970..f9d333792045 100644 --- a/docs/AnalyzerRegions.html +++ b/docs/AnalyzerRegions.html @@ -1,3 +1,5 @@ + Static Analyzer Design Document: Memory Regions @@ -59,7 +61,7 @@ of structures) then the StoreManager can simply return 'unknown' (represented by concerns not only isolates the core analysis engine from the details of reasoning about program memory but also facilities the option of a client of the path-sensitive engine to easily swap in different StoreManager implementations -that internally reason about program memory in very different ways. +that internally reason about program memory in very different ways.

The rest of this document is divided into two parts. We first discuss region taxonomy and the semantics of regions. We then discuss the StoreManager @@ -102,7 +104,7 @@ typedef struct s my_type; void *p; int *q = (int*) p; char *r = (char*) p; -

Thus we need to canonicalize the MemRegion which is used in binding and retrieving.

diff --git a/docs/AutomaticReferenceCounting.html b/docs/AutomaticReferenceCounting.html index bc784578e4cf..1416df58e45e 100644 --- a/docs/AutomaticReferenceCounting.html +++ b/docs/AutomaticReferenceCounting.html @@ -1,8 +1,10 @@ + Objective-C Automatic Reference Counting (ARC) - - + + -