Commit Graph

26805 Commits

Author SHA1 Message Date
Zhongxing Xu 1ade3267d7 Handle member initializer in C++ ctor.
- Add a new Kind of ProgramPoint: PostInitializer.
 - Still use GRStmtNodeBuilder. But special handling PostInitializer in 
   GRStmtNodeBuilder::GenerateAutoTransition().
 - Someday we should clean up the interface of GRStmtNodeBuilder.

llvm-svn: 119335
2010-11-16 07:52:17 +00:00
Craig Silverstein 9e448da324 Have CXXDeleteExpr::getDestroyedType return the actual destroyed type
in more situations.  In particular, for code like

   template<class T> void Fn() { T* x; delete x; }

getDestroyedType() will now return T rather than T*, as it would
before this change.  On the other hand, for code like this:

   template<class T> void Fn() { T x; delete x; }

getDestroyedType() will return an empty QualType(), since it doesn't
know what the actual destroyed type would be.  Previously, it would
return T.

OKed by rjmccall

llvm-svn: 119334
2010-11-16 07:16:25 +00:00
Marcin Swiderski 4098598ca8 Basic support for C++ in BasicStore:
- CXXThisRegion treated like VarRegion and ObjCIVarRegion in various places,
- Reference treated like pointer in BindDeclInternal.

llvm-svn: 119333
2010-11-16 07:15:33 +00:00
John McCall 3eba6e67ec Now that we have reliable cast kinds, simplify scalar cast IR gen.
llvm-svn: 119332
2010-11-16 06:21:14 +00:00
John McCall d50a27111c Kill CK_Unknown and flesh out the documentation for the existing CastKinds.
llvm-svn: 119331
2010-11-16 05:46:29 +00:00
John McCall fa8edb11e1 Teach complex compound assignment IR-generation that the RHS of
a compound assignment is always already in the computation type.

llvm-svn: 119330
2010-11-16 05:45:35 +00:00
John McCall 29600e160e Kill off the remaining places which generate CK_Unknown casts.
llvm-svn: 119326
2010-11-16 02:32:08 +00:00
Ted Kremenek 64dddfb39c Add CXString.cpp and CXString.h
llvm-svn: 119322
2010-11-16 02:03:55 +00:00
Ted Kremenek 4b4f36990d Move CXString creation/management routines into
their own .cpp file and make the interpretation
of its flags private.

llvm-svn: 119319
2010-11-16 01:56:27 +00:00
Ted Kremenek 4490e1015f Update checker build.
llvm-svn: 119318
2010-11-16 01:56:23 +00:00
John McCall 2489379756 Add an ExternalASTSource hook to complete a type on demand.
llvm-svn: 119316
2010-11-16 01:44:35 +00:00
Bob Wilson bafdb73e79 Add a test for Neon vector mangling
llvm-svn: 119304
2010-11-16 00:32:31 +00:00
Bob Wilson 1d54ee75da Add tests for new Neon vector type attributes.
llvm-svn: 119303
2010-11-16 00:32:28 +00:00
Bob Wilson 77ad2c4164 Update TypePrinter::PrintVector to handle new Neon vector types.
llvm-svn: 119302
2010-11-16 00:32:26 +00:00
Bob Wilson 118baf7611 Add support for "neon_vector_type" and "neon_polyvector_type" attributes
to create the special Neon vector types.  These are intended to be used in
Clang's version of <arm_neon.h> to define special Neon vector types that will
be mangled according to ARM's ABI.

llvm-svn: 119301
2010-11-16 00:32:24 +00:00
Bob Wilson 7795480992 ASTContext::getVectorType should preserve the vector kind for canonical types.
This is needed for Neon types when it is most natural to define them in terms
of a typedef.  For example, Neon poly8_t is a typedef for "signed char", and
we want to define polynomial vectors as vectors of that typedef.  Without this
change, the result will be a generic GCC-style vector.  I think this is safe
for other vector types as well, but I would appreciate a review of this.

llvm-svn: 119300
2010-11-16 00:32:20 +00:00
Bob Wilson e4652b1f22 Change CXXNameMangler::mangleNeonVectorType to require the vector type to be
one of the special Neon types.  We'll check for invalid Neon vectors when
they are created, so there's no point in handling them when mangling.

llvm-svn: 119299
2010-11-16 00:32:18 +00:00
Bob Wilson 4348a800ca Fix a comment typo.
llvm-svn: 119298
2010-11-16 00:32:16 +00:00
Bob Wilson 59f9dec8cd Use getTypeSize() method.
llvm-svn: 119297
2010-11-16 00:32:12 +00:00
John McCall 36459fdbad Add another case to the whitelist of cast kinds that can convert to bool.
Fixes PR8608.

llvm-svn: 119293
2010-11-16 00:12:50 +00:00
Ted Kremenek a4c27ec73b CursorVisitor: cache worklists created for data-recursion to reduce malloc() traffic.
llvm-svn: 119290
2010-11-15 23:31:32 +00:00
John McCall 8d69a2160e Add a new expression kind, OpaqueValueExpr, which is useful for
certain internal type-checking procedures as well as for representing
certain implicitly-generated operations.  Uses to follow.

llvm-svn: 119289
2010-11-15 23:31:06 +00:00
Zhanyong Wan 24f6742b34 Adds a README for the Clang static analyzer to document its design and work flow. The contents are taken from email notes by kremenek and xuzhongxing.
llvm-svn: 119288
2010-11-15 23:19:25 +00:00
Ted Kremenek acd03f6fa3 Use LLVM_ATTRIBUTE_NOINLINE instead of attribute((noinline)).
llvm-svn: 119287
2010-11-15 23:11:54 +00:00
Douglas Gregor c65929299d Tweak libclang's heuristics for building precompiled preambles and
caching global code-completion results. In particular, don't perform
either operation the first time we parse, but do both after the first
reparse. 

llvm-svn: 119285
2010-11-15 23:00:34 +00:00
Ted Kremenek 18fb1665bf Remove invalid assertion from CFG builder. When building the CFG pieces for a ternary '?' expression,
it is possible for the confluence block to only have a single predecessor due to calls to 'noreturn'
functions.  Fixes assertion failure reported in PR 8619.

llvm-svn: 119284
2010-11-15 22:59:22 +00:00
Ted Kremenek e6f030467c Cast pointers instead of returning a new value within RunVisitorWorkList().
llvm-svn: 119282
2010-11-15 22:23:26 +00:00
Ted Kremenek 51df4d5596 Annotate CursorVisitor::VisitDataRecursive() with attribute 'noinline'.
Clang currently uses a ridiculous amount of stack space when inlining
this function, which can lead to premature stack overflows.

llvm-svn: 119281
2010-11-15 22:23:24 +00:00
Ted Kremenek 43f50695a8 Add method ParentMap::addStmt().
llvm-svn: 119181
2010-11-15 20:54:24 +00:00
Ted Kremenek db73d599b7 Relax assertion in SValuator so that we don't crash when analyzing a call via a function pointer that
casts the return value to something completely different.  While we need better reasoning here,
we should definately not crash.

llvm-svn: 119177
2010-11-15 20:09:42 +00:00
Fariborz Jahanian 9db7b8b1ef Some cleanup of block API code.
llvm-svn: 119174
2010-11-15 19:19:38 +00:00
Rafael Espindola d1002f6fce Fixes PR8611.
Silence warning about -g not being used during linking. I couldn't find any
change in behavior in gcc liking when given -g. Please open another bug if
I missed something.

llvm-svn: 119166
2010-11-15 18:28:16 +00:00
Fariborz Jahanian c961119dcd Restore these tests. I think I fixed the problem.
We shall see.

llvm-svn: 119158
2010-11-15 17:06:17 +00:00
Douglas Gregor ee430a39c3 Implement C++0x [temp.func.order]p3 (aka DR532) properly. In
particular, we only add the implement object parameter type if only
one of the function templates is a non-static member function
template.

Moreover, since this DR differs from existing practice in C++98/03,
this commit implements the existing practice (which ignores the
first parameter of the function template that is not the non-static
member function template) in C++98/03 mode.

llvm-svn: 119145
2010-11-15 15:41:16 +00:00
Chandler Carruth 99da11cf04 Silence an unused variable warning during release builds by folding the
expression into the assert.

llvm-svn: 119143
2010-11-15 13:54:43 +00:00
John McCall 3065d046b5 Yes, vector conversions are bitcasts.
llvm-svn: 119141
2010-11-15 10:08:00 +00:00
John McCall f608debd9b Kill CK_Unknown references in the ObjC rewriter. The actual
choice of cast doesn't matter here, but I've tried to choose
the right one anyway.

llvm-svn: 119140
2010-11-15 09:46:46 +00:00
Chandler Carruth 3b702674f4 Fix a think-o. Fixes PR8606.
llvm-svn: 119139
2010-11-15 09:28:23 +00:00
John McCall 8cb679e4e1 Assorted work leading towards the elimination of CK_Unknown.
llvm-svn: 119138
2010-11-15 09:13:47 +00:00
Zhongxing Xu 14776cf96a Add driver support for Ubuntu 9.10.
llvm-svn: 119137
2010-11-15 09:01:52 +00:00
Zhongxing Xu 5d30c69813 Add skeleton for handling other kinds of CFGElements.
llvm-svn: 119135
2010-11-15 08:48:43 +00:00
Chandler Carruth eb84200747 Clean up some names and fix the handling of default sysroots on Windows and
other platforms where the textual default of '/' isn't the system's root
directory. We should probably still make the textual default platform specific,
but this should avoid the particularly bad problem with the previous state: we
applied a sysroot of '/' to '/usr/local/google' which added
'//usr/local/include' to the windows header search path, a share on another
machine named 'usr'. Oops.

llvm-svn: 119131
2010-11-15 07:15:26 +00:00
Chandler Carruth 03ac1b09d1 Switch the sysroot logic to use the Path interface, resolving a FIXME and
making the code less gross.

llvm-svn: 119099
2010-11-15 00:48:13 +00:00
Chandler Carruth c4d6fd5b03 Make sysroot only apply to baked in paths which start with a '/'.
llvm-svn: 119095
2010-11-15 00:05:18 +00:00
Ted Kremenek 0526f52a49 Revert r119045. It was failing on Windows.
llvm-svn: 119048
2010-11-14 17:53:34 +00:00
Ted Kremenek ca817a3c0c "Fix" some unintentional fallout from converting
the Stmt* visitation in CursorVisitor to be
data-recursive.

Since AnnotationTokensWorker explicitly calls
CursorVisitor::VisitChildren(), it essentially
transforms the data-recursive algorithm in
CursorVisitor back into a non-data recursive one.
This is particularly bad because the data-recursive
algorithm uses more stack space per stack frame,
which can cause us to blow the stack in some cases.

"Fix" this by making the stack that AnnotationTokensWorker
runs in really huge.  The real fix is to modify
AnnotationTokensWorker not to do the explicit
recursive call.

llvm-svn: 119047
2010-11-14 17:47:35 +00:00
Ted Kremenek 96b329c428 Clean up initialization of LangOptions object by splitting part of it into a parent class
'LangOptionsBase' that default initializes all flags to 0.  Now the ctor of LangOptions
only initializes the flags that might be non-zero (significantly simplifying things).

This also appeases Valgrind on Mac OS X, which no longer reports that one of the flags
may be uninitialized.

llvm-svn: 119045
2010-11-14 17:04:23 +00:00
Zhongxing Xu fee455fcf5 Revert r118991.
Elidable CXXConstructExpr should inhibit calling destructor for temporary 
that is copied, not the one created. This is because eliding copy constructor 
means that the object that was to be copied will be constructed directly in 
memory the copy would be constructed in.

llvm-svn: 119044
2010-11-14 15:23:50 +00:00
John McCall 83fe49d1e1 Always emit full loads from volatile complex l-values.
Return the result of a complex assignment with the original values,
not by performing a load from the l-value;  this is the correct
semantics in C, although not in C++.

llvm-svn: 119037
2010-11-14 09:40:28 +00:00
John McCall d764625448 Add a few more complex-related cast kinds that arise due to arbitrary
implicit conversions;  the last batch was specific to promotions.
I think this is the full set we need.  I do think dividing the cast
kinds into floating and integral is probably a good idea.

Annotate a *lot* more C casts with useful cast kinds.

llvm-svn: 119036
2010-11-14 08:17:51 +00:00