summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Actually remove the members of CaretDiagnostic no longer in use forChandler Carruth2011-09-251-10/+6
| | | | | | | | tracking the start and stop of macro expansion suppression. Also remove the Columns variable which was just a convenience variable based on DiagOpts. Instead we materialize it in the one piece of code that cared. llvm-svn: 140475
* Sink the logic for suppressing some macro expansion notes from theChandler Carruth2011-09-251-41/+29
| | | | | | | | | | | | | | | | TextDiagnosticPrinter into the CaretDiagnostic class. Several interesting results from this: - This removes a significant per-diagnostic bit of state from the CaretDiagnostic class, which should eventually allow us to re-use the object. - It removes a redundant recursive walk of the macro expansion stack just to compute the depth. We don't need the depth until we're unwinding anyways, so we can just mark when we reach it. - It also paves the way for several simplifications we can do to how we implement the suppression. llvm-svn: 140474
* Split the recursive macro expansion walk out from the routine whichChandler Carruth2011-09-251-58/+71
| | | | | | emits a source snippet and caret line. llvm-svn: 140467
* Add a missing increment to avoid infinite looping in the regression test.Benjamin Kramer2011-09-251-1/+4
| | | | | | Also make sure we set the error flag when correcting a typo. llvm-svn: 140466
* Update CMake build.Benjamin Kramer2011-09-241-0/+1
| | | | llvm-svn: 140462
* Add a special note for overload resolution when an initializer list argumentSebastian Redl2011-09-241-0/+11
| | | | | | | | | cannot be converted. This is in preparation for overload resolution of initializer lists. Currently, you will always get this message when you try to pass an init list to an overloaded function. llvm-svn: 140461
* Correctly parse braced member initializers (even in delayed parsing) and ↵Sebastian Redl2011-09-246-135/+279
| | | | | | | | | | | correctly pass the information on to Sema. There's still an incorrectness in the way template instantiation works now, but that is due to a far larger underlying representational problem. Also add a test case for various list initialization cases of scalars, which test this commit as well as the previous one. llvm-svn: 140460
* Treat list-initialization of scalars as a first-class citizen in C++11.Sebastian Redl2011-09-243-10/+61
| | | | | | | | | Allow empty initializer lists for scalars, which mean value-initialization. Constant evaluation for single-element and empty initializer lists for scalars. Codegen for empty initializer lists for scalars. Test case comes in next commit. llvm-svn: 140459
* Give InitListChecker a verification-only mode, where it neither emits ↵Sebastian Redl2011-09-243-238/+357
| | | | | | | | | | | diagnostics nor builds a semantic (structured) initializer list, just reports on whether it can match the given list to the target type. Use this mode for doing init list checking in the initial step of initialization, which will eventually allow us to do overload resolution based on the outcome. llvm-svn: 140457
* In Initialization, add step kind SK_ListConstructorCall (list-initializationSebastian Redl2011-09-241-5/+21
| | | | | | | resolves to a constructor call in C++11) and failure kind FK_ListInitializationFailed (early InitListChecker run failed). llvm-svn: 140456
* Inline Sema::CheckInitList into its only user.Sebastian Redl2011-09-241-11/+4
| | | | llvm-svn: 140455
* Fix typos and non-doxygen-ness in a few comments.Sebastian Redl2011-09-241-4/+2
| | | | llvm-svn: 140454
* [microsoft] In Microsoft mode, if we are inside a template class member ↵Francois Pichet2011-09-241-0/+10
| | | | | | | | | function and we can't resolve an identifier then assume the identifier is type dependent. The goal is to postpone name lookup to instantiation time to be able to search into type dependent base classes. This fixes a few errors when parsing MFC code with clang. BTW clang trunk is now about 5 patches away to be able the parse the default wizard-generated MFC project. llvm-svn: 140452
* Fix comment typo.Benjamin Kramer2011-09-241-1/+1
| | | | | | Patch by Rui Paulo! llvm-svn: 140448
* objc - redeclaration of property in extension classFariborz Jahanian2011-09-241-1/+7
| | | | | | | must match property type declaration in its primary class. // rdar://10142679 llvm-svn: 140438
* Don't translate CRLF files into LF files. Fixes PR6870, from Aaron Ballman!Douglas Gregor2011-09-231-2/+43
| | | | llvm-svn: 140435
* Driver: Use sys::Process::SetWorkingDirectory, for consistency.Daniel Dunbar2011-09-231-7/+2
| | | | llvm-svn: 140434
* objc - fixes a crash when undefined typed propertyFariborz Jahanian2011-09-231-1/+4
| | | | | | | | followed by it implementation crashes when attempt is made to access the synthesized ivar. // rdar://10177744 llvm-svn: 140432
* Fix a crash-on-invalid.Matt Beaumont-Gay2011-09-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The token stream was not getting properly reset when leaving ParseLexedMethodDef in some error cases. In the testcase, that caused later accesses to the token stream to touch memory which had been freed as we finished parsing the class definition. Major hat-tip to AddressSanitizer for helping pinpoint the use-after-free, including the allocation and deallocation points: ==21510== ERROR: AddressSanitizer heap-use-after-free on address 0x7feb3de87848 at pc 0x249f4e2 bp 0x7fff15a89df0 sp 0x7fff15a89ce0 READ of size 1 at 0x7feb3de87848 thread T0 #0 0x249f4e2 clang::TokenLexer::Lex() #1 0x1c834a0 clang::Parser::ConsumeToken() #2 0x1c7dc0f clang::Parser::ParseDeclarationOrFunctionDefinition() #3 0x1c7e16b clang::Parser::ParseDeclarationOrFunctionDefinition() <snip> 0x7feb3de87848 is located 1992 bytes inside of 3816-byte region [0x7feb3de87080,0x7feb3de87f68) freed by thread T0 here: #0 0x3a22c19 free #1 0x1d136a1 clang::Parser::LexedMethod::~LexedMethod() #2 0x1cef528 clang::Parser::DeallocateParsedClasses() #3 0x1cef676 clang::Parser::PopParsingClass() #4 0x1cea094 clang::Parser::ParseCXXMemberSpecification() #5 0x1ce7ae5 clang::Parser::ParseClassSpecifier() #6 0x1cfe588 clang::Parser::ParseDeclarationSpecifiers() #7 0x1c7dbe8 clang::Parser::ParseDeclarationOrFunctionDefinition() #8 0x1c7e16b clang::Parser::ParseDeclarationOrFunctionDefinition() <snip> previously allocated by thread T0 here: #0 0x3a2302d realloc #1 0x39d7c97 llvm::SmallVectorBase::grow_pod() #2 0x1ac588e llvm::SmallVectorImpl<>::push_back() #3 0x1d12d8b clang::Parser::ConsumeAndStoreUntil() #4 0x1c9c24d clang::Parser::ConsumeAndStoreUntil() #5 0x1d12c1e clang::Parser::ConsumeAndStoreUntil() #6 0x1c9c24d clang::Parser::ConsumeAndStoreUntil() #7 0x1d10042 clang::Parser::ParseCXXInlineMethodDef() #8 0x1cec51a clang::Parser::ParseCXXClassMemberDeclaration() #9 0x1ce9de5 clang::Parser::ParseCXXMemberSpecification() #10 0x1ce7ae5 clang::Parser::ParseClassSpecifier() #11 0x1cfe588 clang::Parser::ParseDeclarationSpecifiers() #12 0x1c7dbe8 clang::Parser::ParseDeclarationOrFunctionDefinition() #13 0x1c7e16b clang::Parser::ParseDeclarationOrFunctionDefinition() <snip> llvm-svn: 140427
* Fix up assertion a bit moreDouglas Gregor2011-09-231-1/+1
| | | | llvm-svn: 140424
* Driver: Explicitly include <unistd.h>, libstdc++'s <map> pulls it in, libc++ ↵Benjamin Kramer2011-09-231-0/+6
| | | | | | | | doesn't. Also, on windows, chdir seems to live in <direct.h>. llvm-svn: 140414
* Driver: Add a --working-directory option which can be used to cause the compilerDaniel Dunbar2011-09-231-0/+7
| | | | | | | | | | to operate "as if" in a certain working directory. - For now, we just implement this by changing the actual working directory, but eventually we would want to handle this transparently. This is useful to avoid an extra exec() pair in some situations, and will be something we would want to support for more flexibility in using the Clang libraries. llvm-svn: 140409
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-2358-122/+4
| | | | llvm-svn: 140407
* Don't propagate the 'availability' attribute through declarationDouglas Gregor2011-09-231-2/+4
| | | | | | | | merging for overrides. One might want to make a method's availability in a superclass different from that of its subclass. Fixes <rdar://problem/10166223>. llvm-svn: 140406
* Add a new warning to -Wliteral-conversion to catch cases where a string literalRichard Trieu2011-09-232-6/+22
| | | | | | | | | | | | | | is cast to a boolean. An exception has been made for string literals in logical expressions to allow the common case of use in assert statements. bool x; x = "hi"; // Warn here void foo(bool x); foo("hi"); // Warn here assert(0 && "error"); assert("error); // Warn here llvm-svn: 140405
* Clean up parsing the category names in interfaces slightly, usingDouglas Gregor2011-09-231-10/+9
| | | | | | | MatchRHSPunctuation appropriately and giving a useful source location for the complaint about attributes being added to a category. llvm-svn: 140404
* Move immutable map canonization out of the removeDeadBindings loop (via ↵Anna Zaks2011-09-231-4/+9
| | | | | | using ImmutableMapRef). Gives ~2% speedup. llvm-svn: 140403
* When checking for weak vtables, check whether the actual definition ofDouglas Gregor2011-09-231-1/+4
| | | | | | | | the key function is inline, rather than the original declaration. Perhaps FunctionDecl::isInlined() is poorly named. Fixes <rdar://problem/9979458>. llvm-svn: 140400
* objc-gc: Fix a corner case where clang fails to generate GC Fariborz Jahanian2011-09-231-1/+8
| | | | | | write barrier with captured pointer to object. // rdar://10150823 llvm-svn: 140399
* Fix up comment now that 'new' is no longer a virt-specifier, from Aaron BallmanDouglas Gregor2011-09-231-1/+0
| | | | llvm-svn: 140389
* Eliminate an MSVC comparison warning, from Aaron BallmanDouglas Gregor2011-09-231-1/+1
| | | | llvm-svn: 140388
* Fix wrong comment about reentering template scope for ↵Francois Pichet2011-09-231-1/+1
| | | | | | -fdelayed-template-parsing. llvm-svn: 140382
* More missing header inclusions from llvm_unreachable migration.David Blaikie2011-09-237-0/+7
| | | | llvm-svn: 140369
* Fix missing includes for llvm_unreachableDavid Blaikie2011-09-237-0/+7
| | | | llvm-svn: 140368
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-23101-316/+322
| | | | llvm-svn: 140367
* Reenable -cxx-isystem for Objective C++, until I come up with a better solutionBenjamin Kramer2011-09-231-1/+1
| | | | llvm-svn: 140365
* Don't finalize checking of base and member initializers for aDouglas Gregor2011-09-221-1/+1
| | | | | | constructor template. Fixes PR10457. llvm-svn: 140350
* [microsoft] Fix a bug in -fdelayed-template-parsing mode where we were not ↵Francois Pichet2011-09-221-19/+38
| | | | | | | | | | reentering the delayed function context correctly. The problem was that all template params were reintroduced inside the same scope. So if we had a situation where we had 2 template params with the same name at different scope then clang would generate an error about ambiguous name. The solution is to create a new ParseScope(Scope::TemplateParamScope) for each template scope that we want to reenter. (from the outmost to the innermost scope) This fixes some errors when parsing MFC code with clang. llvm-svn: 140344
* Add support for CPATH and friends.Benjamin Kramer2011-09-223-63/+84
| | | | | | | | | | | | This moves the existing code for CPATH into the driver and adds the environment lookup and path splitting there. The paths are then passed down to cc1 with -I options (CPATH), added after the normal user-specified include dirs. Language specific paths are passed via -LANG-isystem and the actual filtering is performed in the frontend. I tried to match GCC's behavior as close as possible Fixes PR8971. llvm-svn: 140341
* Do manual binary search for preprocessing entities because their end locationsArgyrios Kyrtzidis2011-09-222-8/+45
| | | | | | may be unordered and MSVC's debug-mode doesn't like it. llvm-svn: 140337
* Don't remove filters.Bill Wendling2011-09-221-7/+3
| | | | | | | | | It's not valid to remove filters from landingpad instructions, even if we catch the type. The metadata won't be set up correctly. Testcase is projects/llvm-test/SingleSource/UnitTests/EH/filter-2.cpp. llvm-svn: 140335
* Only trigger the initialize-an-array-via-elementwise-copy/move codeDouglas Gregor2011-09-222-3/+5
| | | | | | | | generation when we're dealing with an implicitly-defined copy or move constructor. And, actually set the implicitly-defined bit for implicitly-defined constructors and destructors. Should fix self-host. llvm-svn: 140334
* Don't use TemplateArgumentListInfo inside AST nodes because it may leak.Argyrios Kyrtzidis2011-09-227-64/+93
| | | | | | Use ASTTemplateArgumentListInfo instead. llvm-svn: 140331
* Rename ExplicitTemplateArgumentList -> ASTTemplateArgumentListInfo, no ↵Argyrios Kyrtzidis2011-09-225-27/+27
| | | | | | functionality change. llvm-svn: 140330
* ST->scanReachableSymbols() is creating a SubRegionMap (SRM) on every call ↵Anna Zaks2011-09-222-31/+4
| | | | | | | | since one SRM is created in each ScanReachableSymbols instance. Creating the object just once and calling only scan inside the loop gives ~ 14% speed up of the StaticAnalyzer run (Release+Asserts). Pull out the declaration of the ScanReachableSymbols so that it can be used directly. Document ProgramState::scanReachableSymbols() methods. llvm-svn: 140323
* PTX: Clean up target options codeJustin Holewinski2011-09-221-79/+27
| | | | llvm-svn: 140320
* Fix the ASTImporter's lookup for anonymous structs/unions that get aDouglas Gregor2011-09-221-2/+2
| | | | | | linkage name via typedef. Patch from/fixes PR10958. llvm-svn: 140317
* Don't allow template argument deduction to deduce a placeholder type,Douglas Gregor2011-09-221-0/+4
| | | | | | ever. Fixes PR10939. llvm-svn: 140304
* Explicitly-defaulted copy/move constructors are not "implicit", butDouglas Gregor2011-09-221-2/+1
| | | | | | | they still need the logic to cope with array member initialization. Fixes PR10720. llvm-svn: 140302
* In OpenCL, conversions between different vector types are disallowedTobias Grosser2011-09-221-1/+5
| | | | | | | | | | | | | | OpenCL 6.2.1 says: "Implicit conversions between built-in vector data types are disallowed." OpenCL 6.2.2 says: "Explicit casts between vector types are not legal." For example: uint4 u = (uint4)(1); int4 i = u; // invalid implicit conversion int4 e = (int4)u; // invalid explicit conversion Fixes PR10967. Submitted by: Anton Lokhmotov <Anton.lokhmotov@gmail.com> llvm-svn: 140300
OpenPOWER on IntegriCloud