]> granicus.if.org Git - clang/log
clang
12 years agoMake -Wformat check the argument type for %n.
Hans Wennborg [Mon, 30 Jul 2012 17:11:32 +0000 (17:11 +0000)]
Make -Wformat check the argument type for %n.

This makes Clang check that the corresponding argument for "%n" in a
format string is a pointer to int.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160966 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoComment parser: add one more test
Dmitri Gribenko [Mon, 30 Jul 2012 16:52:51 +0000 (16:52 +0000)]
Comment parser: add one more test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160965 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUpdate source location in test.
Benjamin Kramer [Mon, 30 Jul 2012 16:51:34 +0000 (16:51 +0000)]
Update source location in test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160964 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse the location of the copy assignment when diagnosing classes that are nontrivial...
Benjamin Kramer [Mon, 30 Jul 2012 16:41:40 +0000 (16:41 +0000)]
Use the location of the copy assignment when diagnosing classes that are nontrivial because of it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160962 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix ambiguity detection in GetBestOverloadCandidateSimple.
Benjamin Kramer [Mon, 30 Jul 2012 15:53:26 +0000 (15:53 +0000)]
Fix ambiguity detection in GetBestOverloadCandidateSimple.

When performing the simplistic overload resolution for single-argument methods,
don't check the best overload for ambiguity with itself when the best overload
doesn't happen to be the first one.

Fixes PR13480.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160961 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix dynamic object linker for ARM GNUEABIHF.
Jiangning Liu [Mon, 30 Jul 2012 11:05:56 +0000 (11:05 +0000)]
Fix dynamic object linker for ARM GNUEABIHF.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160958 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix for ASTMatchFinder to visit a functions parameter declarations.
Daniel Jasper [Mon, 30 Jul 2012 05:03:25 +0000 (05:03 +0000)]
Fix for ASTMatchFinder to visit a functions parameter declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160947 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoProvide correct linker command line options on FreeBSD 8 (GNU ld 2.15) and on newer...
David Chisnall [Sun, 29 Jul 2012 15:24:44 +0000 (15:24 +0000)]
Provide correct linker command line options on FreeBSD 8 (GNU ld 2.15) and on newer FreeBSD (GNU ld 2.17).

Patch by Dimitry Andric!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160931 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMicrooptimize isOffsetInFileID a bit.
Benjamin Kramer [Sun, 29 Jul 2012 11:12:46 +0000 (11:12 +0000)]
Microoptimize isOffsetInFileID a bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160928 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPR13433: In Microsoft mode, don't require function calls within decltype
Richard Smith [Sat, 28 Jul 2012 19:54:11 +0000 (19:54 +0000)]
PR13433: In Microsoft mode, don't require function calls within decltype
expressions to have complete return types (or accessible destructors). If the
return type is required to be complete for some other reason (for instance, if
it is needed by overload resolution), then it will still be required to be
complete. This is apparently required in order to parse a MSVC11 header.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160924 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoassert on ACC_bottom when checking for invalid
Fariborz Jahanian [Sat, 28 Jul 2012 18:59:49 +0000 (18:59 +0000)]
assert on ACC_bottom when checking for invalid
CF to ARC conversions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160923 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a missing testcase for merging the visibility of two declarations used
Rafael Espindola [Sat, 28 Jul 2012 02:51:03 +0000 (02:51 +0000)]
Add a missing testcase for merging the visibility of two declarations used
as arguments of a template.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160911 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoComment dumper: print \param parameter index if parameter name is resolved.
Dmitri Gribenko [Sat, 28 Jul 2012 00:35:48 +0000 (00:35 +0000)]
Comment dumper: print \param parameter index if parameter name is resolved.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160908 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomore objc-arc: With ACC_bottom, we just provide
Fariborz Jahanian [Sat, 28 Jul 2012 00:11:31 +0000 (00:11 +0000)]
more objc-arc: With ACC_bottom, we just provide
__bride fixit, as it doesn't matter which cast to
use. // rdar://11923822

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160906 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjc-arc: change per Jordy's comments.
Fariborz Jahanian [Fri, 27 Jul 2012 23:55:46 +0000 (23:55 +0000)]
objc-arc: change per Jordy's comments.
// rdar://11923822

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160902 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCommentSema.cpp: remove extra semicolon
Dmitri Gribenko [Fri, 27 Jul 2012 23:26:26 +0000 (23:26 +0000)]
CommentSema.cpp: remove extra semicolon

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160901 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjective-c arc: When function calls with known CFCreate naming convention
Fariborz Jahanian [Fri, 27 Jul 2012 22:37:07 +0000 (22:37 +0000)]
objective-c arc: When function calls with known CFCreate naming convention
are cast to retainable types, only suggest CFBridgingRelease/
CFBridgingRetain and not the __bridge casts.
// rdar://11923822

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160900 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoComment Sema: don't try to typo-correct a \param when function has zero
Dmitri Gribenko [Fri, 27 Jul 2012 21:34:43 +0000 (21:34 +0000)]
Comment Sema: don't try to typo-correct a \param when function has zero
arguments.  Just an optimization, no functional change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160896 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agorevert r160839 for now.
Fariborz Jahanian [Fri, 27 Jul 2012 21:34:23 +0000 (21:34 +0000)]
revert r160839 for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160895 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement resolving of HTML character references (named: &, decimal: *,
Dmitri Gribenko [Fri, 27 Jul 2012 20:37:06 +0000 (20:37 +0000)]
Implement resolving of HTML character references (named: &, decimal: *,
hex: ) during comment parsing.

Now internal representation of plain text in comment AST does not contain
character references, but the characters themselves.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160891 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a function to convert a single Unicode code point to a UTF8 sequence.
Dmitri Gribenko [Fri, 27 Jul 2012 20:36:22 +0000 (20:36 +0000)]
Add a function to convert a single Unicode code point to a UTF8 sequence.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160890 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake -Wformat walk the typedef chain when looking for size_t, etc.
Hans Wennborg [Fri, 27 Jul 2012 19:17:46 +0000 (19:17 +0000)]
Make -Wformat walk the typedef chain when looking for size_t, etc.

Clang's -Wformat fix-its currently suggest using "%zu" for values of
type size_t (in C99 or C++11 mode). However, for a type such as
std::vector<T>::size_type, it does not notice that type is actually
typedeffed to size_t, and instead suggests a format for the underlying
type, such as "%lu" or "%u".

This commit makes the format string fix mechanism walk the typedef chain
so that it notices if the type is size_t, even if that isn't "at the
top".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160886 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoConsolidate ObjC lookupPrivateMethod methods from Sema and DeclObjC.
Anna Zaks [Fri, 27 Jul 2012 19:07:44 +0000 (19:07 +0000)]
Consolidate ObjC lookupPrivateMethod methods from Sema and DeclObjC.

Also, fix a subtle bug, which occurred due to lookupPrivateMethod
defined in DeclObjC.h not looking up the method inside parent's
categories.

Note, the code assumes that Class's parent object has the same methods
as what's in the Root class of a the hierarchy, which is a heuristic
that might not hold for hierarchies which do not descend from NSObject.
Would be great to fix this in the future.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160885 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Another false positive in Class method inlining.
Anna Zaks [Fri, 27 Jul 2012 19:07:34 +0000 (19:07 +0000)]
[analyzer] Another false positive in Class method inlining.
We are currently not setting the self object to the calling class object
during inlining nor do we reason about [AAA class].

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160884 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Address Jordan's and Fariborz's review of r160768.
Anna Zaks [Fri, 27 Jul 2012 19:07:32 +0000 (19:07 +0000)]
[analyzer] Address Jordan's and Fariborz's review of r160768.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160883 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPreprocessor: add __BYTE_ORDER__ predefined macro
Dylan Noblesmith [Fri, 27 Jul 2012 18:34:31 +0000 (18:34 +0000)]
Preprocessor: add __BYTE_ORDER__ predefined macro

The __BYTE_ORDER__ predefined macro was added in GCC 4.6:
http://gcc.gnu.org/onlinedocs/gcc-4.6.0/cpp/Common-Predefined-Macros.html

It's used like the following:

 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 ...
 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
 ...
 #else
 #error insane architecture like the pdp-11
 #endif

There's a similar macro, __FLOAT_WORD_ORDER__, but it looks like it
mainly exist to accommodate fairly obscure architectures and ARM's
old FPA instructions, so it doesn't seem nearly as useful.

The tests are updated to check for the correct(at least, based on
clang's current output) value of the macro on each target. So now the
suite will catch bugs like the one fixed in r157626.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160879 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[scan-build] Fix clang++ pathname
Arnaud A. de Grandmaison [Fri, 27 Jul 2012 17:10:06 +0000 (17:10 +0000)]
[scan-build] Fix clang++ pathname

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160871 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agotest/Preprocessor: add NVPTX predefine tests
Dylan Noblesmith [Fri, 27 Jul 2012 16:37:53 +0000 (16:37 +0000)]
test/Preprocessor: add NVPTX predefine tests

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160866 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix an assertion failure when code completing an auto variable's initialiser.
Peter Collingbourne [Fri, 27 Jul 2012 12:56:09 +0000 (12:56 +0000)]
Fix an assertion failure when code completing an auto variable's initialiser.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160857 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix PR13394: Erasing from a vector changes the end of the vector, so make sure we...
Benjamin Kramer [Fri, 27 Jul 2012 10:21:08 +0000 (10:21 +0000)]
Fix PR13394: Erasing from a vector changes the end of the vector, so make sure we always have the right end.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160855 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoclang/lib: [CMake] Update tblgen'd dependencies.
NAKAMURA Takumi [Fri, 27 Jul 2012 06:18:33 +0000 (06:18 +0000)]
clang/lib: [CMake] Update tblgen'd dependencies.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160851 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoclang/lib: [CMake] Reformat, alphabetize lists.
NAKAMURA Takumi [Fri, 27 Jul 2012 06:18:12 +0000 (06:18 +0000)]
clang/lib: [CMake] Reformat, alphabetize lists.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160850 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agolibclang, examples: [CMake] Add dependencies to tblgen'd headers.
NAKAMURA Takumi [Fri, 27 Jul 2012 06:17:56 +0000 (06:17 +0000)]
libclang, examples: [CMake] Add dependencies to tblgen'd headers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160849 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoclang/CMakeLists.txt: Move "examples" after building lib and tools.
NAKAMURA Takumi [Fri, 27 Jul 2012 06:17:48 +0000 (06:17 +0000)]
clang/CMakeLists.txt: Move "examples" after building lib and tools.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160848 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFinal piece of core issue 1330: delay computing the exception specification of
Richard Smith [Fri, 27 Jul 2012 04:22:15 +0000 (04:22 +0000)]
Final piece of core issue 1330: delay computing the exception specification of
a defaulted special member function until the exception specification is needed
(using the same criteria used for the delayed instantiation of exception
specifications for function temploids).

EST_Delayed is now EST_Unevaluated (using 1330's terminology), and, like
EST_Uninstantiated, carries a pointer to the FunctionDecl which will be used to
resolve the exception specification.

This is enabled for all C++ modes: it's a little faster in the case where the
exception specification isn't used, allows our C++11-in-C++98 extensions to
work, and is still correct for C++98, since in that mode the computation of the
exception specification can't fail.

The diagnostics here aren't great (in particular, we should include implicit
evaluation of exception specifications for defaulted special members in the
template instantiation backtraces), but they're not much worse than before.

Our approach to the problem of cycles between in-class initializers and the
exception specification for a defaulted default constructor is modified a
little by this change -- we now reject any odr-use of a defaulted default
constructor if that constructor uses an in-class initializer and the use is in
an in-class initialzer which is declared lexically earlier. This is a closer
approximation to the current draft solution in core issue 1351, but isn't an
exact match (but the current draft wording isn't reasonable, so that's to be
expected).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160847 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Look through SubstNonTypeTemplateParmExprs.
Jordan Rose [Fri, 27 Jul 2012 01:15:02 +0000 (01:15 +0000)]
[analyzer] Look through SubstNonTypeTemplateParmExprs.

We were treating this like a CXXDefaultArgExpr, but
SubstNonTypeTemplateParmExpr actually appears when a template is
instantiated, i.e. we have all the information necessary to evaluate it.
This allows us to inline functions like llvm::array_lengthof.

<rdar://problem/11949235>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160846 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Use a stack-based local AGAIN to fix the build for real.
Jordan Rose [Fri, 27 Jul 2012 00:47:52 +0000 (00:47 +0000)]
[analyzer] Use a stack-based local AGAIN to fix the build for real.

It's a good thing CallEvents aren't created all over the place yet.
I checked all the uses this time and the private copy constructor
/really/ shouldn't cause any more problems.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160845 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Use a stack-based local instead of a temporary to fix build.
Jordan Rose [Thu, 26 Jul 2012 23:24:15 +0000 (23:24 +0000)]
[analyzer] Use a stack-based local instead of a temporary to fix build.

Passing a temporary via reference parameter still requires a visible
copy constructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160840 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjc-arc: When objects with known CF semantics are assigned to
Fariborz Jahanian [Thu, 26 Jul 2012 23:17:04 +0000 (23:17 +0000)]
objc-arc: When objects with known CF semantics are assigned to
retainable types in arc, only suggest CFBridgingRelease/
CFBridgingRetain and not the confusing __bridge casts.
// rdar://11923822

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160839 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTweak test case to not emit warning.
Ted Kremenek [Thu, 26 Jul 2012 22:32:35 +0000 (22:32 +0000)]
Tweak test case to not emit warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160822 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSATestBuild should not ask for non-existent checkers.
Jordan Rose [Thu, 26 Jul 2012 22:31:59 +0000 (22:31 +0000)]
SATestBuild should not ask for non-existent checkers.

- "cocoa" was moved to "osx.cocoa" a long time ago.
- "cplusplus" would be a valid package except we don't have any C++ checkers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160821 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoLook at the preceding CFGBlock for the expression to load from in ExprEngine::VisitGu...
Ted Kremenek [Thu, 26 Jul 2012 22:23:41 +0000 (22:23 +0000)]
Look at the preceding CFGBlock for the expression to load from in ExprEngine::VisitGuardedExpr
instead of walking to the preceding PostStmt node.  There are cases where the last evaluated
expression does not appear in the ExplodedGraph.

Fixes PR 13466.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160819 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] CallEvent is no longer a value object.
Jordan Rose [Thu, 26 Jul 2012 21:41:15 +0000 (21:41 +0000)]
[analyzer] CallEvent is no longer a value object.

After discussion, the type-based dispatch was decided to be bad for
maintenance and made it very easy for subtle bugs to creep in. Instead,
we'll just be very careful when we do have to allocate these on the heap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160817 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Rename Calls.{h,cpp} to CallEvent.{h,cpp}. No functionality change.
Jordan Rose [Thu, 26 Jul 2012 21:39:41 +0000 (21:39 +0000)]
[analyzer] Rename Calls.{h,cpp} to CallEvent.{h,cpp}. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160815 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Don't crash on implicit statements inside initializers.
Jordan Rose [Thu, 26 Jul 2012 20:04:30 +0000 (20:04 +0000)]
[analyzer] Don't crash on implicit statements inside initializers.

Our BugReporter knows how to deal with implicit statements: it looks in
the ParentMap until it finds a parent with a valid location. However, since
initializers are not in the body of a constructor, their sub-expressions are
not in the ParentMap. That was easy enough to fix in AnalysisDeclContext.

...and then even once THAT was fixed, there's still an extra funny case
of Objective-C object pointer fields under ARC, which are initialized with
a top-level ImplicitValueInitExpr. To catch these cases,
PathDiagnosticLocation will now fall back to the start of the current
function if it can't find any other valid SourceLocations. This isn't great,
but it's miles better than a crash.

(All of this is only relevant when constructors and destructors are being
inlined, i.e. under -cfg-add-initializers and -cfg-add-implicit-dtors.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160810 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Don't crash on array constructors and destructors.
Jordan Rose [Thu, 26 Jul 2012 20:04:25 +0000 (20:04 +0000)]
[analyzer] Don't crash on array constructors and destructors.

This workaround is fairly lame: we simulate the first element's constructor
and destructor and rely on the region invalidation to "initialize" the rest
of the elements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160809 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Handle C++ member initializers and destructors.
Jordan Rose [Thu, 26 Jul 2012 20:04:21 +0000 (20:04 +0000)]
[analyzer] Handle C++ member initializers and destructors.

This uses CFG to tell if a constructor call is for a member, and uses
the member's region appropriately.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160808 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Use the CFG to see if a constructor is for a local variable.
Jordan Rose [Thu, 26 Jul 2012 20:04:16 +0000 (20:04 +0000)]
[analyzer] Use the CFG to see if a constructor is for a local variable.

Previously we were using ParentMap and crawling through the parent DeclStmt.
This should be at least slightly cheaper (and is also more flexible).

No (intended) functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160807 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Handle base class initializers and destructors.
Jordan Rose [Thu, 26 Jul 2012 20:04:13 +0000 (20:04 +0000)]
[analyzer] Handle base class initializers and destructors.

Most of the logic here is fairly simple; the interesting thing is that
we now distinguish complete constructors from base or delegate constructors.
We also make sure to cast to the base class before evaluating a constructor
or destructor, since non-virtual base classes may behave differently.

This includes some refactoring of VisitCXXConstructExpr and VisitCXXDestructor
in order to keep ExprEngine.cpp as clean as possible (leaving the details for
ExprEngineCXX.cpp).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160806 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Variables with destructors are live until the destructor is run.
Jordan Rose [Thu, 26 Jul 2012 20:04:08 +0000 (20:04 +0000)]
[analyzer] Variables with destructors are live until the destructor is run.

Test case in the next commit, which enables destructors under certain
circumstances.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160805 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Show paths for destructor calls.
Jordan Rose [Thu, 26 Jul 2012 20:04:05 +0000 (20:04 +0000)]
[analyzer] Show paths for destructor calls.

This modifies BugReporter and friends to handle CallEnter and CallExitEnd
program points that came from implicit call CFG nodes (read: destructors).

This required some extra handling for nested implicit calls. For example,
the added multiple-inheritance test case has a call graph that looks like this:

testMultipleInheritance3
  ~MultipleInheritance
    ~SmartPointer
    ~Subclass
      ~SmartPointer
        ***bug here***

In this case we correctly notice that we started in an inlined function
when we reach the CallEnter program point for the second ~SmartPointer.
However, when we reach the next CallEnter (for ~Subclass), we were
accidentally re-using the inner ~SmartPointer call in the diagnostics.

Rather than guess if we saw the corresponding CallExitEnd based on the
contents of the active path, we now just ask the PathDiagnostic if there's
any known stack before popping off the top path.

(A similar issue could have occured without multiple inheritance, but there
wasn't a test case for it.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160804 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Inline ctors + dtors when the CFG is built for them.
Jordan Rose [Thu, 26 Jul 2012 20:04:00 +0000 (20:04 +0000)]
[analyzer] Inline ctors + dtors when the CFG is built for them.

At the very least this means initializer nodes for constructors and
automatic object destructors are present in the CFG.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160803 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] PostImplicitCall can also occur between CFGElements.
Jordan Rose [Thu, 26 Jul 2012 20:03:56 +0000 (20:03 +0000)]
[analyzer] PostImplicitCall can also occur between CFGElements.

This avoids an assertion crash when we invalidate on a destructor call
instead of inlining it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160802 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a const version of Expr::IgnoreImplicit. No functionality change.
Jordan Rose [Thu, 26 Jul 2012 20:03:54 +0000 (20:03 +0000)]
Add a const version of Expr::IgnoreImplicit. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160801 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUn-break standalone invocations of CmpRuns.py.
Jordan Rose [Thu, 26 Jul 2012 20:03:51 +0000 (20:03 +0000)]
Un-break standalone invocations of CmpRuns.py.

Fallout from CmpRuns.py API changes in r160314.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160800 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjective-c parsing. Don't crash when selector name
Fariborz Jahanian [Thu, 26 Jul 2012 17:32:28 +0000 (17:32 +0000)]
objective-c parsing. Don't crash when selector name
is missing in method prototype. // rdar://11939584

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160789 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPut back dump() without a default argument, "because debuggers don't usually respect...
Alexander Kornienko [Thu, 26 Jul 2012 17:11:45 +0000 (17:11 +0000)]
Put back dump() without a default argument, "because debuggers don't usually respect default arguments".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160788 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdded -ast-dump-filter option to clang -cc1.
Alexander Kornienko [Thu, 26 Jul 2012 16:01:23 +0000 (16:01 +0000)]
Added -ast-dump-filter option to clang -cc1.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160784 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove an outdated comment; add one test to compare function pointer and block mangling
Timur Iskhodzhanov [Thu, 26 Jul 2012 13:41:30 +0000 (13:41 +0000)]
Remove an outdated comment; add one test to compare function pointer and block mangling

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160783 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd more tests for PR13207 (Mangling of template back references with -cxx-abi micros...
Timur Iskhodzhanov [Thu, 26 Jul 2012 11:01:05 +0000 (11:01 +0000)]
Add more tests for PR13207 (Mangling of template back references with -cxx-abi microsoft) now that PR13389 is fixed (mangling of return types)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160782 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix PR13389 (Wrong mangling of return type qualifiers with -cxx-abi microsoft)
Timur Iskhodzhanov [Thu, 26 Jul 2012 10:41:15 +0000 (10:41 +0000)]
Fix PR13389 (Wrong mangling of return type qualifiers with -cxx-abi microsoft)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160780 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemoved standalone clang-ast-dump tool.
Alexander Kornienko [Thu, 26 Jul 2012 01:44:18 +0000 (01:44 +0000)]
Removed standalone clang-ast-dump  tool.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160772 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Inline ObjC class methods.
Anna Zaks [Thu, 26 Jul 2012 00:27:51 +0000 (00:27 +0000)]
[analyzer] Inline ObjC class methods.

- Some cleanup(the TODOs) will be done after ObjC method inlining is
complete.
- Simplified CallEvent::getDefinition not to require ISDynamicDispatch
parameter.
- Also addressed Jordan's comments from r160530.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160768 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd static analyzer check for calling a C++ instance method with a null/uninitialized...
Ted Kremenek [Thu, 26 Jul 2012 00:22:32 +0000 (00:22 +0000)]
Add static analyzer check for calling a C++ instance method with a null/uninitialized pointer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160767 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDisable the warning for missing prototypes for OpenCL kernels. Includes testcase.
Tanya Lattner [Thu, 26 Jul 2012 00:08:28 +0000 (00:08 +0000)]
Disable the warning for missing prototypes for OpenCL kernels. Includes testcase.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160766 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove the ability to stash arbitrary pointers into UndefinedVal (no longer needed).
Ted Kremenek [Wed, 25 Jul 2012 22:09:19 +0000 (22:09 +0000)]
Remove the ability to stash arbitrary pointers into UndefinedVal (no longer needed).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160764 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix two typos in the doc
Sylvestre Ledru [Wed, 25 Jul 2012 22:02:37 +0000 (22:02 +0000)]
Fix two typos in the doc

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160763 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove ExprEngine::MarkBranch(), as it is no longer needed.
Ted Kremenek [Wed, 25 Jul 2012 21:58:29 +0000 (21:58 +0000)]
Remove ExprEngine::MarkBranch(), as it is no longer needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160761 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUpdate ExprEngine's handling of ternary operators to find the ternary expression
Ted Kremenek [Wed, 25 Jul 2012 21:58:25 +0000 (21:58 +0000)]
Update ExprEngine's handling of ternary operators to find the ternary expression
value by scanning the path, rather than assuming we have visited the '?:' operator
as a terminator (which sets a value indicating which expression to grab the
final ternary expression value from).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160760 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjective-c modern translator. Provide declaration of
Fariborz Jahanian [Wed, 25 Jul 2012 21:48:36 +0000 (21:48 +0000)]
objective-c modern translator. Provide declaration of
"memset' lazily when is needed in translation of
struct-valued methods which require checkinf of nil receivers
outside their bodies. // rdar://11847319

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160759 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove experimental invalid iterators checker from the codebase until we have the...
Ted Kremenek [Wed, 25 Jul 2012 20:02:05 +0000 (20:02 +0000)]
Remove experimental invalid iterators checker from the codebase until we have the time
to fix all the issues.  Currently the code is essentially unmaintained and buggy, and
needs major revision (with coupled enhancements to the analyzer core).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160754 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[driver crash diagnostics] Strip -internal-isystem and -internal-externc-isystem.
Chad Rosier [Wed, 25 Jul 2012 18:55:43 +0000 (18:55 +0000)]
[driver crash diagnostics] Strip -internal-isystem and -internal-externc-isystem.
rdar://11949066

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160752 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[driver crash diagnostics] Strip -idirafter, -iprefix, -iwithprefix,
Chad Rosier [Wed, 25 Jul 2012 18:38:57 +0000 (18:38 +0000)]
[driver crash diagnostics] Strip -idirafter, -iprefix, -iwithprefix,
-iwithprefixbefore, and -isystem options, per Matt's suggestion.
rdar://11949066

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160750 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[driver crash diagnostics] A few enhancements:
Chad Rosier [Wed, 25 Jul 2012 17:52:16 +0000 (17:52 +0000)]
[driver crash diagnostics] A few enhancements:
 -Strip -iquote and -M options.
 -Quote -D options to avoid problems with command line macros that include
  parens.
rdar://11949066

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160743 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agolibclang comment to HTML rendering: \result is the same as \returns
Dmitri Gribenko [Wed, 25 Jul 2012 17:14:58 +0000 (17:14 +0000)]
libclang comment to HTML rendering: \result is the same as \returns

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160738 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agotest/PCH/objc_stmts.m: Suppress stderr to be fed to FileCheck.
NAKAMURA Takumi [Wed, 25 Jul 2012 11:14:11 +0000 (11:14 +0000)]
test/PCH/objc_stmts.m: Suppress stderr to be fed to FileCheck.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160720 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIntroduces the 'decl' matcher which was missing for a while
Manuel Klimek [Wed, 25 Jul 2012 10:02:02 +0000 (10:02 +0000)]
Introduces the 'decl' matcher which was missing for a while
and became necessary with the change to require BindableMatchers
for binding.

Also fixes PR 13445: "hasSourceExpression only works for implicit casts".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160716 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agotest/Analysis/iterators.cpp: Mark as REQUIRES:asserts. It crashes due to assertion...
NAKAMURA Takumi [Wed, 25 Jul 2012 09:47:24 +0000 (09:47 +0000)]
test/Analysis/iterators.cpp: Mark as REQUIRES:asserts. It crashes due to assertion failure.

I saw the case it XPASSes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160715 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a FIXME to revisit the performance of BackRefMap later
Timur Iskhodzhanov [Wed, 25 Jul 2012 08:16:41 +0000 (08:16 +0000)]
Add a FIXME to revisit the performance of BackRefMap later

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160709 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdds a introductionary document to the Clang AST.
Manuel Klimek [Wed, 25 Jul 2012 07:28:11 +0000 (07:28 +0000)]
Adds a introductionary document to the Clang AST.

Next steps are adding information about types & source location handling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160708 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTurn -Wobjc-root-class on by default. <rdar://problem/11203649>.
Ted Kremenek [Wed, 25 Jul 2012 07:26:32 +0000 (07:26 +0000)]
Turn -Wobjc-root-class on by default.  <rdar://problem/11203649>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160707 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPromote warn_unknown_analyzer_checker to an error. Addresses <rdar://problem/10987863>.
Ted Kremenek [Wed, 25 Jul 2012 07:12:13 +0000 (07:12 +0000)]
Promote warn_unknown_analyzer_checker to an error.  Addresses <rdar://problem/10987863>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160706 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPR12057: Allow variadic template pack expansions to cross lambda boundaries.
Richard Smith [Wed, 25 Jul 2012 03:56:55 +0000 (03:56 +0000)]
PR12057: Allow variadic template pack expansions to cross lambda boundaries.
Rather than adding a ContainsUnexpandedParameterPack bit to essentially every
AST node, we tunnel the bit directly up to the surrounding lambda expression
when we reach a context where an unexpanded pack can not normally appear.
Thus any statement or declaration within a lambda can now potentially contain
an unexpanded parameter pack.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160705 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake comments::Parser and comments::Sema noncopyable.
Dmitri Gribenko [Wed, 25 Jul 2012 00:02:45 +0000 (00:02 +0000)]
Make comments::Parser and comments::Sema noncopyable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160702 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoComment parsing tests: fix test
Dmitri Gribenko [Tue, 24 Jul 2012 21:56:59 +0000 (21:56 +0000)]
Comment parsing tests: fix test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160700 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd __has_feature(attribute_availability_with_message).
Jordan Rose [Tue, 24 Jul 2012 21:55:34 +0000 (21:55 +0000)]
Add __has_feature(attribute_availability_with_message).

This tests for the ability to include a "message" field in availability
attributes, like so:

  extern void ATSFontGetName(const char *oName)
    __attribute__((availability(macosx,introduced=8.0,deprecated=9.0,
                                message="use CTFontCopyFullName")));

This was actually supported in Clang 3.1, but we got a request for a
__has_feature so that header files can use this more safely. It's
unfortunate that the 3.1 release doesn't include this, however.

<rdar://problem/11886458>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160699 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoComment diagnostics tests: add a function with zero arguments, for completeness.
Dmitri Gribenko [Tue, 24 Jul 2012 21:46:24 +0000 (21:46 +0000)]
Comment diagnostics tests: add a function with zero arguments, for completeness.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160697 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoComment diagnostics: add warning for multiple \param commands with duplicate
Dmitri Gribenko [Tue, 24 Jul 2012 21:44:16 +0000 (21:44 +0000)]
Comment diagnostics: add warning for multiple \param commands with duplicate
parameter names.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160696 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen a && or || appears as the condition of a ?:, perform appropriate
Richard Smith [Tue, 24 Jul 2012 21:02:14 +0000 (21:02 +0000)]
When a && or || appears as the condition of a ?:, perform appropriate
short-circuiting when building the CFG. Also be sure to skip parens before
checking for the && / || special cases. Finally, fix some crashes in CFG
printing in the presence of calls to destructors for array of array of class
type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160691 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCommentSema: simplify functions, per Jordan's comment.
Dmitri Gribenko [Tue, 24 Jul 2012 20:58:46 +0000 (20:58 +0000)]
CommentSema: simplify functions, per Jordan's comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160689 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPedantic -pedantic correction. Duplicate cv-qualifiers are permitted in C++11
Richard Smith [Tue, 24 Jul 2012 20:24:58 +0000 (20:24 +0000)]
Pedantic -pedantic correction. Duplicate cv-qualifiers are permitted in C++11
unless they appear in a decl-specifier-seq.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160688 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't use a temporary file.
Rafael Espindola [Tue, 24 Jul 2012 20:00:35 +0000 (20:00 +0000)]
Don't use a temporary file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160686 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoABIArgInfo's constructor is private and only used by the static get* methods.
Rafael Espindola [Tue, 24 Jul 2012 19:30:23 +0000 (19:30 +0000)]
ABIArgInfo's constructor is private and only used by the static get* methods.
No need to abuse default arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160684 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoComment parsing: allow newlines between \param, direction specification (e.g.,
Dmitri Gribenko [Tue, 24 Jul 2012 18:23:31 +0000 (18:23 +0000)]
Comment parsing: allow newlines between \param, direction specification (e.g.,
[in]), parameter name and description paragraph.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160682 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTweak warning text for returning incomplete type from extern "C" functions.
Hans Wennborg [Tue, 24 Jul 2012 17:59:41 +0000 (17:59 +0000)]
Tweak warning text for returning incomplete type from extern "C" functions.

A warning was added in r150128 for returning non-C compatible
user-defined types from functions with C linkage.

This makes the text more clear for the case when the type isn't
decidedly non-C compatible, but incomplete.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160681 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoComment parsing: couple TextTokenRetokenizer and comment parser together to
Dmitri Gribenko [Tue, 24 Jul 2012 17:52:18 +0000 (17:52 +0000)]
Comment parsing: couple TextTokenRetokenizer and comment parser together to
remove one of the two variable-length lookahead buffers.  Now retokenizer will
ask for more tokens when it needs them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160680 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMove TextTokenRetokenizer from CommentLexer.h to CommentParser.cpp since it is
Dmitri Gribenko [Tue, 24 Jul 2012 17:43:18 +0000 (17:43 +0000)]
Move TextTokenRetokenizer from CommentLexer.h to CommentParser.cpp since it is
an implementation detail of the parser.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160679 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoComment parsing: retokenized text tokens are now pushed back in correct (not
Dmitri Gribenko [Tue, 24 Jul 2012 16:10:47 +0000 (16:10 +0000)]
Comment parsing: retokenized text tokens are now pushed back in correct (not
reverse) order

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160675 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIntroduces a new concept for binding results to matchers
Manuel Klimek [Tue, 24 Jul 2012 13:37:29 +0000 (13:37 +0000)]
Introduces a new concept for binding results to matchers
as per Chandler's request:
- introduces a new matcher base type BindableMatcher that
  provides the bind() call
- makes all dynamic-cast matcher creation functions return
  BindableMatchers; the special case about dynamic-cast
  matchers is that the node they match on and the node
  their child matchers match on are the same node, just
  casted to a different type; thus, there is no ambiguity
  on what bind() matches on; additionally, those are the
  matchers that we name with nouns in the matcher language,
  so it's easy for users to intuitively know which matchers
  are bindable

To make this change possible, we got rid of a non-orthogonal
implementation of thisPointerType, which had an implicit
dynamic-cast matcher from CallExpr to CXXMemberCallExpr; as
alternative, we now provide a memberCall dynamic-cast matcher
and thisPointerType is a predicate on CXXMemberCallExpr.

Last, the ArgumentAdaptingMatcher is actually not required
for the implementation of makeDynCastAllOfComposite - this
simplification makes it more obvious where the bind() call
can be used based on the matcher creation function types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160673 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix PR13207 (Mangling of templates with back references when using -cxx-abi microsoft)
Timur Iskhodzhanov [Tue, 24 Jul 2012 09:37:54 +0000 (09:37 +0000)]
Fix PR13207 (Mangling of templates with back references when using -cxx-abi microsoft)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160667 91177308-0d34-0410-b5e6-96231b3b80d8