aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2013-04-25Add option to align escaped newlines left.Daniel Jasper
This enables formattings like: #define A \ int aaaa; \ int b; \ int ccc; \ int dddddddddd; Enabling this for Google/Chromium styles only as I don't know whether it is desired for Clang/LLVM. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180253 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-25[ms-cxxabi] Fix a number of bugs in the mangler.Peter Collingbourne
This includes the following fixes: - Implement 4 subtly different variants of qualifier mangling and use them in what I believe are the right places. - Fix handling of array types. Previously we were always decaying them, which is wrong if the type appears as a template argument, pointee, referent etc. Fixes PR13182. Differential Revision: http://llvm-reviews.chandlerc.com/D709 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180250 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-25[analyzer] Fix a crash in RetainCountChecker - we should not rely on ↵Anna Zaks
CallEnter::getCallExpr to return non-NULL We get a CallEnter with a null expression, when processing a destructor. All other users of CallEnter::getCallExpr work fine with null as return value. (Addresses PR15832, Thanks to Jordan for reducing the test case!) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180234 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24Objective-C parsing [qoi]: Recover gracefully with good diagnosticFariborz Jahanian
when class implementation declaration adds protocol qualifier list. // rdar://12233858 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180228 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24Objective-C arc: Improve disgnostics when 'weak'Fariborz Jahanian
property cannot be synthesized because its backing ivar does not support weak references. // rdar://13676793 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180211 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24[driver] Put -fvectorize under the -Ofast umbrella flag.Chad Rosier
Part of rdar://13622687 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180206 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24[driver] Improve the implementation of the -Ofast option.Chad Rosier
Specifically, allow the flags that fall under this umbrella (i.e., -O3, -ffast-math, and -fstrict-aliasing) to be overridden/disabled with the individual -O[0|1|2|s|z]/-fno- flags. This also fixes the handling of various floating point optimization flags that are modified by -ffast-math (and thus -Ofast as well). Part of rdar://13622687 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180204 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24[driver] Add a hasFlag API that accepts a positive alias.Chad Rosier
Part of rdar://13622687 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180203 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24Objective-C: When reporting on missing property accessor implementation inFariborz Jahanian
categories, do not report when they are declared in primary class, class's protocol, or one of it super classes. This is because, its class is going to implement them. // rdar://13713098 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180198 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24Flip flag to merge short if-statements into one line for Google style.Daniel Jasper
This now allows clang-format to do: if (a) return; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180187 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24[analyzer] Refactoring + explanatory comment.Anton Yartsev
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180181 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24Fix comment alignment behavior.Daniel Jasper
In the following snippet, clang-format incorrectly aligned the trailing comment, when only the last line was formatted: int aaaaaa; // comment int b; int c; // Formatting only this line moved this comment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180173 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24Add some more required SPARC v9 predefined macros.Jakob Stoklund Olesen
Solaris/AuroraUX only need __arch64__, the BSDs need the other variants. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180172 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24[analyzer] IvarInvalidation: correctly handle cases where only partial ↵Anna Zaks
invalidators exist - If only partial invalidators exist and there are no full invalidators in @implementation, report every ivar that has not been invalidated. (Previously, we reported the first Ivar in the list, which could actually have been invalidated by a partial invalidator. The code assumed you cannot have only partial invalidators.) - Do not report missing invalidation method declaration if a partial invalidation method declaration exists. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180170 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23[analyzer] Set the allocation site to be the uniqueing location for retain ↵Anna Zaks
count checker leaks. The uniqueing location is the location which is part of the hash used to determine if two reports are the same. This is used by the CmpRuns.py script to compare two analyzer runs and determine which warnings are new. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180166 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23[analyzer] Refactor BugReport::getLocation and ↵Anna Zaks
PathDiagnosticLocation::createEndOfPath for greater code reuse The 2 functions were computing the same location using different logic (each one had edge case bugs that the other one did not). Refactor them to rely on the same logic. The location of the warning reported in text/command line output format will now match that of the plist file. There is one change in the plist output as well. When reporting an error on a BinaryOperator, we use the location of the operator instead of the beginning of the BinaryOperator expression. This matches our output on command line and looks better in most cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180165 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23Make compares unsigned. The expression can't become negative anyways.Benjamin Kramer
Silences a sign compare warning on 32 bit archs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180110 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23Fix formatting of complex #if expressions.Daniel Jasper
Before: #if !defined(AAAAAAAAAAAAAAAA) && (defined CCCCCCCC || \ defined DDDDDDDD) && defined(BBBBBBBB) After: #if !defined(AAAAAAAAAAAAAAAA) && (defined CCCCCCCC || defined DDDDDDDD) && \ defined(BBBBBBBB) This fixes llvm.org/PR15828. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180105 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23Warn that scoped enumerations are a C++11 extenstion when compiling inRichard Trieu
C++98 mode. This improves on the previous diagnostic message of: error: expected identifier or '{' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180076 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23[analyzer] RetainCountChecker: Clean up path notes for autorelease.Jordan Rose
No functionality change. <rdar://problem/13710586> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180075 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22When modifying an implicit instantiation with information from an explicit ↵Argyrios Kyrtzidis
one, make sure to reset the "right brace" location. Otherwise the source range of the explicit instantiation may become invalid (begin location will be after the end location). rdar://13706991 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180070 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22[analyzer] Model strsep(), particularly that it returns its input.Jordan Rose
This handles the false positive leak warning in PR15374, and also serves as a basic model for the strsep() function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180069 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22Add a warning for Objective-C pointer introspection, which is solely the job ↵Ted Kremenek
of the Objective-C runtime. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180062 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22[ms-inline asm] Set the OpDecl to the InlineAsmIdentifierInfo struct.Chad Rosier
Part of rdar://13663589 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180055 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22[analyzer] Treat reinterpret_cast like a base cast in certain cases.Jordan Rose
The analyzer represents all pointer-to-pointer bitcasts the same way, but this can be problematic if an implicit base cast gets layered on top of a manual base cast (performed with reinterpret_cast instead of static_cast). Fix this (and avoid a valid assertion) by looking through cast regions. Using reinterpret_cast this way is only valid if the base class is at the same offset as the derived class; this is checked by -Wreinterpret-base-class. In the interest of performance, the analyzer doesn't repeat this check anywhere; it will just silently do the wrong thing (use the wrong offsets for fields of the base class) if the user code is wrong. PR15394 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180052 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22[analyzer] Type information from C++ new expressions is perfect.Jordan Rose
This improves our handling of dynamic_cast and devirtualization for objects allocated by 'new'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180051 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22TBAA: make sure zero-length bitfield works for tbaa.struct and path-aware tbaaManman Ren
For ms structs, zero-length bitfields following non-bitfield members are completely ignored, we should not increase the field index. Before the fix, we will have an assertion failure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180038 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22[ms-inline asm] Refactor/clean up the SemaLookup interface. No functionalChad Rosier
change indended. Part of rdar://13663589 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180027 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22Use the ugly PRIx64 macro to make format string portable.Benjamin Kramer
This is debugging code so functionality isn't a concern, but mingw32 warns because it doesn't understand the %llx format specifier. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180024 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22C++1y constexpr extensions, round 1: Allow most forms of declaration andRichard Smith
statement in constexpr functions. Everything which doesn't require variable mutation is also allowed as an extension in C++11. 'void' becomes a literal type to support constexpr functions which return 'void'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180022 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22Fix array constant expression evaluation bug: we can have different values forRichard Smith
different array elements, even if they're all constructed using the same default constructor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180017 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22Don't emit _ZTW wrappers for TLS variables which don't use the C++ ↵Richard Smith
thread_local keyword. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180004 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22Fix bin-packing behavior of constructor initialziers.Daniel Jasper
In Google style, constructor initializers need to be all on one line or one initializer per line if that does not fit. Without this patch, this non-bin-packing-behavior incorrectly extends to the parameters of the initializers. Before: Constructor() : aaaaa(aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaa) {} After: Constructor() : aaaaa(aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaa) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180001 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22Revert "Revert "PR14606: Debug info for using ↵David Blaikie
directives/DW_TAG_imported_module"" This reverts commit 179839 now that the corresponding LLVM patch has been fixed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179997 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-21[Mips] Convert a GNU style Mips ABI name to the name accepted by LLVMSimon Atanasyan
Mips backend. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179981 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-21[Mips] Do not add unnecessary Mips toolchain path to the listSimon Atanasyan
of system include directories with extern "C" semantics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179979 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-21The 'constexpr implies const' rule for non-static member functions is gone inRichard Smith
C++1y, so stop adding the 'const' there. Provide a compatibility warning for code relying on this in C++11, with a fix-it hint. Update our lazily-written tests to add the const, except for those ones which were testing our implementation of this rule. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179969 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-20Disable VLA diagnostic in C++1y mode, and add some tests.Richard Smith
Still to do here: - we have a collection of syntactic accepts-invalids to diagnose - support non-PODs in VLAs, including dynamic initialization / destruction - runtime checks (and throw std::bad_array_length) for bad bound - support VLA capture by reference in lambdas - properly support VLAs in range-based for (don't recompute bound) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179962 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-20C++1y: Allow aggregates to have default initializers.Richard Smith
Add a CXXDefaultInitExpr, analogous to CXXDefaultArgExpr, and use it both in CXXCtorInitializers and in InitListExprs to represent a default initializer. There's an additional complication here: because the default initializer can refer to the initialized object via its 'this' pointer, we need to make sure that 'this' points to the right thing within the evaluation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179958 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-20Implement core issue 1608: class members can be found via operator lookup in ↵Richard Smith
a trailing return type in that class's body. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179941 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-20Supports Sourcery CodeBench Mips toolchain directories tree.Simon Atanasyan
Sourcery CodeBench and modern FSF Mips toolchains require a bit more complicated algorithm to calculate headers, libraries and sysroot paths than implemented by Clang driver now. The main problem is that all these paths depend on a set of command line arguments additionally to a target triple value. For example, let $TC is a toolchain installation directory. If we compile big-endian 32-bit mips code, crtbegin.o is in the $TC/lib/gcc/mips-linux-gnu/4.7.2 folder and the toolchain's linker requires --sysroot=$TC/mips-linux-gnu/libc argument. If we compile little-endian 32-bit soft-float mips code, crtbegin.o is in the $TC/lib/gcc/mips-linux-gnu/4.7.2/soft-float/el folder and the toolchain's linker requires --sysroot=$TC/mips-linux-gnu/libc/soft-float/el argument. 1. Calculate MultiarchSuffix using all necessary command line options and use this MultiarchSuffix to detect crtbegin.o location in the GCCInstallationDetector::ScanLibDirForGCCTriple() routine. 2. If a user does not provide --sysroot argument to the driver explicitly, calculate new sysroot value based on command line options. Then use this calculated sysroot path: a. To populate a file search paths list in the Linux::Linux() constructor. b. To find Mips toolchain specific include headers directories in the Linux::AddClangSystemIncludeArgs() routine. c. To provide -–sysroot argument for a linker. Note: - The FSF's tree slightly differs (folder names) and is not supported yet. - New addExternCSystemIncludeIfExits() routine is a temporary solution. I plan to move path existence check to the addExternCSystemInclude() routine by a separate commit. The patch reviewed by Rafael Espindola. http://llvm-reviews.chandlerc.com/D644 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179934 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-20[analyzer] Ensure BugReporterTracking works on regions with pointer arithmeticAnna Zaks
Introduce a new helper function, which computes the first symbolic region in the base region chain. The corresponding symbol has been used for assuming that a pointer is null. Now, it will also be used for checking if it is null. This ensures that we are tracking a null pointer correctly in the BugReporter. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179916 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-20[analyzer] Flip printPretty and printPrettyAsExpr as per suggestion from ↵Anna Zaks
Jordan (r179572) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179915 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-19[libclang] Make sure the preable does not truncate comments.Argyrios Kyrtzidis
rdar://13647445 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179907 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-19Note that we support (and in fact have supported since the dawn of time itself)Richard Smith
C++1y binary literals. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179883 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-19[ms-inline asm] The parsing of C++ identifiers is a task of the front-end ↵Chad Rosier
parser, not the asm parser. As such, begin moving the parsing logic in that direction. This patch is just a temporary hack until the real frontend parser can be hooked up. Part of rdar://13663589 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179882 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-19Emit the underlying type in the debug info for all kinds of fixed enumsAdrian Prantl
instead of only C++11-scoped-with-class-tag enums. rdar://problem/13463793 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179879 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-19Keep the parentheses in #pragma message (partial revert of r179771).Andy Gibbs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179862 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-19C++11 support is now feature-complete.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179861 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-19Avoid names like __in that conflict with SAL in builtin headersReid Kleckner
Microsoft's Source Annotation Language (SAL) defines a bunch of keywords for annotating the inputs and outputs of functions. Empty definitions for the keywords are provided by <stdlib.h> -> <crtdefs.h> -> <sal.h>. This makes it basically impossible to include MSVC's stdlib.h and Clang's *mmintrin.h headers at the same time if they have variables named __in. As a workaround, I've renamed those variables. This fixes the Modules/compiler_builtins.m test which was XFAILed, presumably due to this conflict. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179860 91177308-0d34-0410-b5e6-96231b3b80d8