Commit Graph

14740 Commits

Author SHA1 Message Date
Douglas Gregor af82e3510b Introduce a new lexer function to compute the "preamble" of a file,
which is the part of the file that contains all of the initial
comments, includes, and preprocessor directives that occur before any
of the actual code. Added a new -print-preamble cc1 action that is
only used for testing.

llvm-svn: 108913
2010-07-20 20:18:03 +00:00
Dan Gohman 481e40c681 Use getDebugLoc and setDebugLoc instead of getDbgMetadata and setDbgMetadata,
avoiding MDNode overhead.

llvm-svn: 108911
2010-07-20 20:13:52 +00:00
Ted Kremenek 4407ea4948 Hookup checking for invalid length modifiers in scanf format strings.
llvm-svn: 108907
2010-07-20 20:04:47 +00:00
Ted Kremenek ea28f83a5f Move 'hasValidLengthModifier' from PrintfFormatSpecifier to FormatSpecifier.
llvm-svn: 108906
2010-07-20 20:04:42 +00:00
Ted Kremenek 36521956f7 Cleanup whitespace in switch statement. No functionality change.
llvm-svn: 108905
2010-07-20 20:04:36 +00:00
Ted Kremenek f03e6d85a1 Add 'ConversionSpecifier' root class in 'analyze_format_string' namespace and
derived 'PrintfConversionSpecifier' from this class.  We will do the same for
'ScanfConversionSpecifier'.

llvm-svn: 108903
2010-07-20 20:04:27 +00:00
Ted Kremenek 348d1499c1 Rename 'UnicodeStrArg' to 'SArg'.
llvm-svn: 108901
2010-07-20 20:04:15 +00:00
Ted Kremenek 516ef222ba Rename 'ConsumedSoFarArg' -> 'nArg' and 'OutIntPtrArg' to 'nArg' (scanf and printf checking).
llvm-svn: 108900
2010-07-20 20:04:10 +00:00
Ted Kremenek 1ce32be36a Rename 'VoidPtrArg' to 'pArg' in printf/scanf checking.
llvm-svn: 108899
2010-07-20 20:04:04 +00:00
Ted Kremenek 563e3edbc2 Rename 'CStrArg' to 'sArg' for printf checking to match with the analagous enum for scanf checking.
llvm-svn: 108898
2010-07-20 20:03:58 +00:00
Ted Kremenek ab0fe8a48d Rename analyze_printf::ConversionSpecifier::IntAsCharArg to 'cArg' to match
analagous enum in analyze_scanf.  This is prep for refactoring the logic for handling
ConversionSpecifiers for both scanf and printf.

llvm-svn: 108897
2010-07-20 20:03:49 +00:00
Ted Kremenek b65a9d5a1a Rename diagnostic so that it can be reused with scanf checking. No functionality change.
llvm-svn: 108896
2010-07-20 20:03:43 +00:00
Chris Lattner b7a95cf165 delete a loop that just generates dead code. In an example
like this:

void *test(long N) {
  return new int[N][42][42];
}

the loop generates two dead mul instructions:

  %tmp = load i64* %N.addr                        ; <i64> [#uses=2]
  %0 = mul i64 %tmp, 7056                         ; <i64> [#uses=1]
  %1 = mul i64 %tmp, 42                           ; <i64> [#uses=1]
  %2 = mul i64 %1, 42                             ; <i64> [#uses=0]
  %call = call noalias i8* @_Znam(i64 %0)         ; <i8*> [#uses=1]

The scale of these multiplies is already handled by the typesize stuff.

llvm-svn: 108884
2010-07-20 18:49:33 +00:00
Chris Lattner cb46bdc34f remove the special case for constant array sizes from
EmitCXXNewAllocSize.  This code uses IRBuilder, which does
constant folding already.

llvm-svn: 108882
2010-07-20 18:45:57 +00:00
Jim Grosbach 71d963e954 Re-apply fixed version of 108749, correctly conditionalizing the new sections on
ObjC ABI version 2 this time.

llvm-svn: 108847
2010-07-20 16:20:26 +00:00
Douglas Gregor b37b46e488 Complain when string literals are too long for the active language
standard's minimum requirements.

llvm-svn: 108837
2010-07-20 14:33:20 +00:00
Argyrios Kyrtzidis dde5790562 Hide FunctionTemplateDecl's specializations folding set as implementation detail and introduce
FunctionTemplateDecl::findSpecialization.

Redeclarations of specializations will not cause the previous decl to be removed from the set,
the set will keep the canonical decl. findSpecialization will return the most recent redeclaration.

llvm-svn: 108834
2010-07-20 13:59:58 +00:00
Argyrios Kyrtzidis c1624e9eda Whether the specialization should be added to template's folding set when read from PCH,
is determined by a isCanonicalDecl check.

llvm-svn: 108833
2010-07-20 13:59:40 +00:00
Argyrios Kyrtzidis 47470f2f3f Hide the specializations folding sets of ClassTemplateDecl as an implementation detail (InsertPos
leaks though) and add methods to its interface for adding/finding specializations.

Simplifies its users a bit and we no longer need to replace specializations in the folding set with
their redeclarations. We just return the most recent redeclarations.

As a bonus, it fixes http://llvm.org/PR7670.

llvm-svn: 108832
2010-07-20 13:59:28 +00:00
Rafael Espindola 38360b3ff7 Add -lstdc++ to DragonFly tools.
Patch by Sascha Wildner.

llvm-svn: 108830
2010-07-20 12:59:03 +00:00
Zhongxing Xu edb77fe8b4 Constify all references to Stmt* and CFGBlock* in libChecker.
llvm-svn: 108811
2010-07-20 06:22:24 +00:00
Sebastian Redl c57d34bc35 Update ImplicitCastExpr to be able to represent an XValue.
llvm-svn: 108807
2010-07-20 04:20:21 +00:00
Zhongxing Xu 6694255306 Constify.
llvm-svn: 108804
2010-07-20 02:56:49 +00:00
Zhongxing Xu 70856f7986 remove const_cast.
llvm-svn: 108803
2010-07-20 02:53:15 +00:00
Zhongxing Xu 3e02548d22 constify.
llvm-svn: 108801
2010-07-20 02:46:11 +00:00
Zhongxing Xu c2acbe0f45 Constify.
llvm-svn: 108800
2010-07-20 02:41:28 +00:00
Stuart Hastings 7d7bc561bf Correct line info for declarations/definitions. Radar 8063111.
llvm-svn: 108785
2010-07-19 23:56:31 +00:00
Jim Grosbach 50c63168ed Temporarily revert. Some odd internal breakage is likely related.
llvm-svn: 108764
2010-07-19 22:43:34 +00:00
Sebastian Redl 3d3f0b1039 Remove PCHReader::getStream(), it was unused. Inline PCHReader::getDelsCursor() into its sole caller and remove it. This reduces the attack surface of multiple PCH files towards code outside the PCH implementation.
llvm-svn: 108763
2010-07-19 22:38:35 +00:00
Sebastian Redl bd1b5befee Promote IdentifierOffsets to per-file data.
llvm-svn: 108762
2010-07-19 22:28:42 +00:00
Sebastian Redl 9e687994f3 Promote DeclOffsets and TypeOffsets to per-file data.
llvm-svn: 108760
2010-07-19 22:06:55 +00:00
Fariborz Jahanian 3c7ebc3a5e Patch to type match comparing Objective-C Classes which implement
protocols (Radar 8191774).

llvm-svn: 108758
2010-07-19 22:02:22 +00:00
Ted Kremenek 6cd694233d Don't warn when a '%%' or '%*d' (scanf) is used in a format string with positional arguments, since
these don't actually consume an argument.

llvm-svn: 108757
2010-07-19 22:01:06 +00:00
Douglas Gregor aa21cc401b Introduce a new libclang API, clang_reparseTranslationUnit(), which
reparses an already-parsed translation unit. At the moment it's just a
convenience function, but we hope to use it for performance
optimizations.

llvm-svn: 108756
2010-07-19 21:46:24 +00:00
Ted Kremenek ce81542d61 Hook up 'invalid conversion' warning for scanf format strings.
llvm-svn: 108750
2010-07-19 21:25:57 +00:00
Jim Grosbach f699594de8 Put ObjC method names, method types and class names in separate string literal
sections. rdar://8207705

llvm-svn: 108749
2010-07-19 20:54:43 +00:00
Sebastian Redl 393f8b76c0 Promote the identifier table to per-file data. Also, if a CHAINED_METADATA record exists, it has to be the first thing in the PCH file.
llvm-svn: 108748
2010-07-19 20:52:06 +00:00
Ted Kremenek 5c3e1b9a54 Add missing conversion specifier parsing for 'u', 'x', 'o', and 's'. Fixes <rdar://problem/8204052>.
llvm-svn: 108742
2010-07-19 19:47:40 +00:00
Daniel Dunbar 99b5524324 Driver: Make -fnext-runtime the default when rewriting Objective-C.
llvm-svn: 108741
2010-07-19 19:44:22 +00:00
Daniel Dunbar 354e96df95 Driver/Darwin: Add deployment target after doing argument translation, so that
-mmacosx-version-min works inside a -Xarch_ flag.

llvm-svn: 108712
2010-07-19 17:11:36 +00:00
Daniel Dunbar b2b8a91aa4 Driver: Factor out Darwin::AddDeploymentTarget.
llvm-svn: 108711
2010-07-19 17:11:33 +00:00
Douglas Gregor 549c1cd2c5 Remove unused location-to-AST-node resolver. libclang's implementation supercedes it
llvm-svn: 108708
2010-07-19 16:18:30 +00:00
Fariborz Jahanian 2a36089eef Categories cannot synthesize property ivars,
and a minor cleanup.

llvm-svn: 108707
2010-07-19 16:14:33 +00:00
Zhongxing Xu eb2528104a Fix construction of AnalysisContext. Thanks Daniel.
llvm-svn: 108694
2010-07-19 13:16:50 +00:00
Argyrios Kyrtzidis 3816ed4d58 Fix http://llvm.org/PR7660
A ParmVarDecl instantiated from a FunctionProtoType may have Record as DeclContext,
in which case isStaticDataMember() will erroneously return true.

llvm-svn: 108692
2010-07-19 10:14:41 +00:00
Chris Lattner 8d72f2aa3a tidy up comment.
llvm-svn: 108676
2010-07-19 05:07:24 +00:00
Zhongxing Xu a74af93eaf remove CallInliner.cpp.
llvm-svn: 108670
2010-07-19 01:55:38 +00:00
Zhongxing Xu ec5623570e Add double close check to StreamChecker. Patch by Lei Zhang.
llvm-svn: 108669
2010-07-19 01:52:29 +00:00
Zhongxing Xu 84f65e0692 Reapply r108617.
llvm-svn: 108668
2010-07-19 01:31:21 +00:00
Daniel Dunbar e38764c66c Driver: Change the driver to take the path to the main executable, instead of
taking it in pieces.
 - Fixes a problem where the Clang executable path was not initialized properly
   on Win32, because sys::Path::getBasename() doesn't do what I always think it
   does. Imagine that, a sys::Path interface that is confusing!

llvm-svn: 108667
2010-07-19 00:44:04 +00:00