- Dec 20, 2011
-
-
Richard Smith authored
Split out a new ExpressionEvaluationContext flag for this case, and don't treat it as unevaluated in C++11. This fixes some crash-on-invalids where we would allow references to class members in potentially-evaluated constant expressions in static member functions, and also fixes half of PR10177. The fix to PR10177 exposed a case where template instantiation failed to provide a source location for a diagnostic, so TreeTransform has been tweaked to supply source locations when transforming a type. The source location is still not very good, but MarkDeclarationsReferencedInType would need to operate on a TypeLoc to improve it further. Also fix MarkDeclarationReferenced in C++98 mode to trigger instantiation for static data members of class templates which are used in constant expressions. This fixes a link-time problem, but we still incorrectly treat the member as non-constant. The rest of the fix for that issue is blocked on PCH support for early-instantiated static data members, which will be added in a subsequent patch. llvm-svn: 146955
-
- Dec 19, 2011
-
-
Richard Smith authored
variable is initialized by a non-constant expression, and pass in the variable being declared so that earlier-initialized fields' values can be used. Rearrange VarDecl init evaluation to make this possible, and in so doing fix a long-standing issue in our C++ constant expression handling, where we would mishandle cases like: extern const int a; const int n = a; const int a = 5; int arr[n]; Here, n is not initialized by a constant expression, so can't be used in an ICE, even though the initialization expression would be an ICE if it appeared later in the TU. This requires computing whether the initializer is an ICE eagerly, and saving that information in PCH files. llvm-svn: 146856
-
- Dec 18, 2011
-
-
Benjamin Kramer authored
llvm-svn: 146847
-
Douglas Gregor authored
chains. The previous implementation relied heavily on the declaration chain being stored as a (circular) linked list on disk, as it is in memory. However, when deserializing from multiple modules, the different chains could get mixed up, leading to broken declaration chains. The new solution keeps track of the first and last declarations in the chain for each module file. When we load a declaration, we search all of the module files for redeclarations of that declaration, then splice together all of the lists into a coherent whole (along with any redeclarations that were actually parsed). As a drive-by fix, (de-)serialize the redeclaration chains of TypedefNameDecls, which had somehow gotten missed previously. Add a test of this serialization. This new scheme creates a redeclaration table that is fairly large in the PCH file (on the order of 400k for Cocoa.h's 12MB PCH file). The table is mmap'd in and searched via a binary search, but it's still quite large. A future tweak will eliminate entries for declarations that have no redeclarations anywhere, and should drastically reduce the size of this table. llvm-svn: 146841
-
- Dec 17, 2011
-
-
Eli Friedman authored
Remove a non-gcc-compatible extension that would apply attributes on declarations without a declarator to structs. Add a warning for ignored attributes. Patch by Michael Han. llvm-svn: 146796
-
- Dec 16, 2011
-
-
Nicola Gigante authored
Fix an inconsistency in the syntactic form of InitListExpr in case of initialization that involves a ConstructorConversion llvm-svn: 146766
-
Richard Smith authored
might not be an rvalue when checking array accesses. Instead, pass through a flag indicating the array index is negated. llvm-svn: 146753
-
Richard Smith authored
fails within a call to a constexpr function. Add -fconstexpr-backtrace-limit argument to driver and frontend, to control the maximum number of notes so produced (default 10). Fix APValue printing to be able to pretty-print all APValue types, and move the testing for this functionality from a unittest to a -verify test now that it's visible in clang's output. llvm-svn: 146749
-
David Blaikie authored
Reviewed by Eli Friedman. llvm-svn: 146738
-
Fariborz Jahanian authored
on properties, prevent consequential error diagnostics. // rdar://10591336 llvm-svn: 146737
-
Douglas Gregor authored
llvm-svn: 146722
-
Sean Callanan authored
instantiate a class from its template pattern before it consults the ExternalASTSource. LLDB in particular will sometimes provide patterns that need to be completed first. To make this possible, I have moved the completion before the code that does the instantiation, allowing the ExternalASTSource to provide the required information. llvm-svn: 146715
-
- Dec 15, 2011
-
-
Douglas Gregor authored
applies to an actual definition. Plus, clarify the purpose of this field and give the accessor a different name, since getLocEnd() is supposed to be the same as getSourceRange().getEnd(). llvm-svn: 146694
-
Douglas Gregor authored
check whether any previous declarations of the class were visible. llvm-svn: 146680
-
Douglas Gregor authored
declarations and definitions) as ObjCInterfaceDecls within the same redeclaration chain. This new representation matches what we do for C/C++ variables/functions/classes/templates/etc., and makes it possible to answer the query "where are all of the declarations of this class?" llvm-svn: 146679
-
Richard Smith authored
llvm-svn: 146673
-
Douglas Gregor authored
don't refer to anything. Amusingly, we were relying on this in one place. Thanks to Chandler for noticing the weirdness in declaresSameEntity. llvm-svn: 146659
-
Hans Wennborg authored
extension. This fixes gcc.dg/format/c90-scanf-3.c and ext-4.c (test for excess errors). llvm-svn: 146649
-
Douglas Gregor authored
separately-allocated DefinitionData structure, which we manage the same way as CXXRecordDecl::DefinitionData. This prepares the way for making ObjCInterfaceDecls redeclarable, to more accurately model forward declarations of Objective-C classes and eliminate the mutation of ObjCInterfaceDecl that causes us serious trouble in the AST reader. Note that ObjCInterfaceDecl's accessors are fairly robust against being applied to forward declarations, because Clang (and Sema in particular) doesn't perform RequireCompleteType/hasDefinition() checks everywhere it has to. Each of these overly-robust cases is marked with a FIXME, which we can tackle over time. llvm-svn: 146644
-
Eli Friedman authored
Enhance the -Wsign-compare handling to suppress the -Wsign-compare warning in the case of a shifted bitfield. PR11572. llvm-svn: 146634
-
Fariborz Jahanian authored
protocols; with a warning. // rdar://10567333 llvm-svn: 146626
-
Douglas Gregor authored
expression with an unknown result type, assume that the result type is 'id'. Fixes <rdar://problem/10400663>. llvm-svn: 146622
-
Douglas Gregor authored
to declaresSameEntity(), as a baby step toward tracking forward declarations of Objective-C classes precisely. Part of <rdar://problem/10583531>. llvm-svn: 146618
-
Richard Smith authored
llvm-svn: 146607
-
- Dec 14, 2011
-
-
Douglas Gregor authored
going to be a pointer-to-member constant. Fixes <rdar://problem/10544564>. llvm-svn: 146587
-
David Blaikie authored
llvm-svn: 146576
-
Douglas Gregor authored
is not visible, look for any previous declarations of that entity that might be visible. llvm-svn: 146563
-
Matt Beaumont-Gay authored
r146430 lost some compile-time performance on MultiSource/Benchmarks/MiBench/security-rijndael; this gets most of it back. llvm-svn: 146562
-
Richard Trieu authored
handle non-pointer types. This is for the extra info printed when function types are compared. llvm-svn: 146525
-
- Dec 13, 2011
-
-
Fariborz Jahanian authored
in classes. // rdar://10535349 llvm-svn: 146504
-
David Blaikie authored
llvm-svn: 146480
-
Fariborz Jahanian authored
inside a struct/union. llvm-svn: 146444
-
- Dec 12, 2011
-
-
Matt Beaumont-Gay authored
The motivation here is a "clever" implementation of strncmp(), which peels the first few comparisons via chained conditional expressions which ensure that the input arrays are known at compile time to be sufficiently large. llvm-svn: 146430
-
Richard Smith authored
diagnostics. No functionality change. llvm-svn: 146365
-
David Blaikie authored
llvm-svn: 146354
-
- Dec 10, 2011
-
-
Hans Wennborg authored
and offer fixits when there is a mismatch. llvm-svn: 146326
-
Douglas Gregor authored
under ARC. Fixes <rdar://problem/10530209>. llvm-svn: 146307
-
Fariborz Jahanian authored
// rdar://10095131 llvm-svn: 146304
-
Douglas Gregor authored
template instantiation), and that expression might produce a temporary, invoke MaybeBindToTemporary. Otherwise, we forget to destroy objects, release objects, etc. Fixes <rdar://problem/10531073>. llvm-svn: 146301
-
- Dec 09, 2011
-
-
Richard Smith authored
whether an expression is a (core) constant expression as a side-effect of evaluation. This takes us from accepting far too few expressions as ICEs to accepting slightly too many -- fixes for the remaining cases are coming next. The diagnostics produced when an expression is found to be non-constant are currently quite poor (with generic wording but reasonable source locations), and will be improved in subsequent commits. llvm-svn: 146289
-