]> granicus.if.org Git - clang/log
clang
11 years ago-Wreceiver-is-weak: rephrase warning text and add a suggestion Note.
Jordan Rose [Fri, 28 Sep 2012 22:21:42 +0000 (22:21 +0000)]
-Wreceiver-is-weak: rephrase warning text and add a suggestion Note.

New output:
  warning: weak property may be unpredictably set to nil
  note: property declared here
  note: assign the value to a strong variable to keep the object alive
        during use

<rdar://problem/12277204>

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

11 years agoPull ScopeInfo implementation into its own file.
Jordan Rose [Fri, 28 Sep 2012 22:21:39 +0000 (22:21 +0000)]
Pull ScopeInfo implementation into its own file.

The infrastructure for -Warc-repeated-use-of-weak got a little too heavy
to leave sitting at the top of Sema.cpp.

No functionality change.

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

11 years ago-Warc-repeated-use-of-weak: check ivars and variables as well.
Jordan Rose [Fri, 28 Sep 2012 22:21:35 +0000 (22:21 +0000)]
-Warc-repeated-use-of-weak: check ivars and variables as well.

Like properties, loading from a weak ivar twice in the same function can
give you inconsistent results if the object is deallocated between the
two loads. It is safer to assign to a strong local variable and use that.

Second half of <rdar://problem/12280249>.

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

11 years agoAdd a warning (off by default) for repeated use of the same weak property.
Jordan Rose [Fri, 28 Sep 2012 22:21:30 +0000 (22:21 +0000)]
Add a warning (off by default) for repeated use of the same weak property.

The motivating example:

if (self.weakProp)
  use(self.weakProp);

As with any non-atomic test-then-use, it is possible a weak property to be
non-nil at the 'if', but be deallocated by the time it is used. The correct
way to write this example is as follows:

id tmp = self.weakProp;
if (tmp)
  use(tmp);

The warning is controlled by -Warc-repeated-use-of-receiver, and uses the
property name and base to determine if the same property on the same object
is being accessed multiple times. In cases where the base is more
complicated than just a single Decl (e.g. 'foo.bar.weakProp'), it picks a
Decl for some degree of uniquing and reports the problem under a subflag,
-Warc-maybe-repeated-use-of-receiver. This gives a way to tune the
aggressiveness of the warning for a particular project.

The warning is not on by default because it is not flow-sensitive and thus
may have a higher-than-acceptable rate of false positives, though it is
less noisy than -Wreceiver-is-weak. On the other hand, it will not warn
about some cases that may be legitimate issues that -Wreceiver-is-weak
will catch, and it does not attempt to reason about methods returning weak
values.

Even though this is not a real "analysis-based" check I've put the bug
emission code in AnalysisBasedWarnings for two reasons: (1) to run on
every kind of code body (function, method, block, or lambda), and (2) to
suggest that it may be enhanced by flow-sensitive analysis in the future.

The second (smaller) half of this work is to extend it to weak locals
and weak ivars. This should use most of the same infrastructure.

Part of <rdar://problem/12280249>

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

11 years agoAdd basic support for adding !tbaa.struct metadata on llvm.memcpy calls for
Dan Gohman [Fri, 28 Sep 2012 21:58:29 +0000 (21:58 +0000)]
Add basic support for adding !tbaa.struct metadata on llvm.memcpy calls for
struct assignment.

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

11 years agoWhen processing an InitListExpr and skipping the initialization of an invalid
Richard Smith [Fri, 28 Sep 2012 21:23:50 +0000 (21:23 +0000)]
When processing an InitListExpr and skipping the initialization of an invalid
record, skip at least one element from the InitListExpr to avoid an infinite
loop if we're initializing an array of unknown bound.

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

11 years agoUpdate template type diffing to handle qualifiers. Differing qualifiers will
Richard Trieu [Fri, 28 Sep 2012 20:32:51 +0000 (20:32 +0000)]
Update template type diffing to handle qualifiers.  Differing qualifiers will
now be printed with highlighting.

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

11 years agoAllow __builtin_bswap32/64 in constant expressions, like gcc does. Patch by Tijl...
Richard Smith [Fri, 28 Sep 2012 20:20:52 +0000 (20:20 +0000)]
Allow __builtin_bswap32/64 in constant expressions, like gcc does. Patch by Tijl Coosemans!

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

11 years agoClean up part of template type diffing. Moved repeated code to separate
Richard Trieu [Fri, 28 Sep 2012 19:51:57 +0000 (19:51 +0000)]
Clean up part of template type diffing.  Moved repeated code to separate
functions.  Reworked one of the conditionals.  No functional changes.

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

11 years agoModern objcective-C translator. When doing rewriting, Do not
Fariborz Jahanian [Fri, 28 Sep 2012 19:05:17 +0000 (19:05 +0000)]
Modern objcective-C translator. When doing rewriting, Do not
use the integrated pre-processor, preprocess in objective-c++ mode.
// rdar://12189793.

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

11 years ago[analyzer] Handle inlined constructors for rvalue temporaries correctly.
Jordan Rose [Fri, 28 Sep 2012 17:15:25 +0000 (17:15 +0000)]
[analyzer] Handle inlined constructors for rvalue temporaries correctly.

Previously the analyzer treated all inlined constructors like lvalues,
setting the value of the CXXConstructExpr to the newly-constructed
region. However, some CXXConstructExprs behave like rvalues -- in
particular, the implicit copy constructor into a pass-by-value argument.
In this case, we want only the /contents/ of a temporary object to be
passed, so that we can use the same "copy each argument into the
parameter region" algorithm that we use for scalar arguments.

This may change when we start modeling destructors of temporaries,
but for now this is the last part of <rdar://problem/12137950>.

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

11 years ago[analyzer] Create a temp region when a method is called on a struct rvalue.
Jordan Rose [Fri, 28 Sep 2012 17:15:21 +0000 (17:15 +0000)]
[analyzer] Create a temp region when a method is called on a struct rvalue.

An rvalue has no address, but calling a C++ member function requires a
'this' pointer. This commit makes the analyzer create a temporary region
in which to store the struct rvalue and use as a 'this' pointer whenever
a member function is called on an rvalue, which is essentially what
CodeGen does.

More of <rdar://problem/12137950>. The last part is tracking down the
C++ FIXME in array-struct-region.cpp.

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

11 years ago[analyzer] Create a temporary region for rvalue structs when accessing fields
Jordan Rose [Fri, 28 Sep 2012 17:15:12 +0000 (17:15 +0000)]
[analyzer] Create a temporary region for rvalue structs when accessing fields

Struct rvalues are represented in the analyzer by CompoundVals,
LazyCompoundVals, or plain ConjuredSymbols -- none of which have associated
regions. If the entire structure is going to persist, this is not a
problem -- either the rvalue will be assigned to an existing region, or
a MaterializeTemporaryExpr will be present to create a temporary region.
However, if we just need a field from the struct, we need to create the
temporary region ourselves.

This is inspired by the way CodeGen handles calls to temporaries;
support for that in the analyzer is coming next.

Part of <rdar://problem/12137950>

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

11 years agoAvoid malloc thrashing in the uninitialized value analysis.
Benjamin Kramer [Fri, 28 Sep 2012 16:44:29 +0000 (16:44 +0000)]
Avoid malloc thrashing in the uninitialized value analysis.

- The size of the packed vector is often small, save mallocs using SmallBitVector.
- Copying SmallBitVectors is also cheap, remove a level of indirection.

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

11 years agoSet Diag.ErrorOccurred even if a DiagnosticConsumer does not want it in
Daniel Jasper [Fri, 28 Sep 2012 15:45:07 +0000 (15:45 +0000)]
Set Diag.ErrorOccurred even if a DiagnosticConsumer does not want it in
diagnostic count.

If a DiagnosticConsumer sub-class overwrites IncludeInDiagnosticCounts,
this should change diagnostic counts. However, it currently also
influences Diag.ErrorOccurred, which in turn influences the behavior of
parsing and semantic analysis (in a way that can make it crash).

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

11 years agoFix a regression from r164656.
Eli Friedman [Thu, 27 Sep 2012 22:13:33 +0000 (22:13 +0000)]
Fix a regression from r164656.

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

11 years ago[analyzer] Address Jordan's code review for r164790.
Anna Zaks [Thu, 27 Sep 2012 21:57:17 +0000 (21:57 +0000)]
[analyzer] Address Jordan's code review for r164790.

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

11 years ago[analyzer] IvarInvalidation: track synthesized ivars and allow escape
Anna Zaks [Thu, 27 Sep 2012 21:57:14 +0000 (21:57 +0000)]
[analyzer] IvarInvalidation: track synthesized ivars and allow escape
through property getters.

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

11 years agoUnbreak cmake build
Anna Zaks [Thu, 27 Sep 2012 20:32:46 +0000 (20:32 +0000)]
Unbreak cmake build
(fixup for r164790)

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

11 years ago[analyzer] Add an experimental ObjC direct ivar assignment checker.
Anna Zaks [Thu, 27 Sep 2012 19:45:15 +0000 (19:45 +0000)]
[analyzer] Add an experimental ObjC direct ivar assignment checker.

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

11 years agoMake getDefaultSynthIvarName() a member of ObjCPropertyDecl.
Anna Zaks [Thu, 27 Sep 2012 19:45:11 +0000 (19:45 +0000)]
Make getDefaultSynthIvarName() a member of ObjCPropertyDecl.

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

11 years ago[analyzer] Address Jordan's code review comments for r164716.
Anna Zaks [Thu, 27 Sep 2012 19:45:08 +0000 (19:45 +0000)]
[analyzer] Address Jordan's code review comments for r164716.

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

11 years agoPass PrintingPolicy by reference, copying it isn't cheap.
Benjamin Kramer [Thu, 27 Sep 2012 17:37:30 +0000 (17:37 +0000)]
Pass PrintingPolicy by reference, copying it isn't cheap.

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

11 years agoclang/test/CodeGen/ms-inline-asm.c: It requires x86 codegen. Reported by Joey Gouly.
NAKAMURA Takumi [Thu, 27 Sep 2012 14:55:08 +0000 (14:55 +0000)]
clang/test/CodeGen/ms-inline-asm.c: It requires x86 codegen. Reported by Joey Gouly.

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

11 years agoFollowing up on r164620, cope with symlinking from an embedded
Douglas Gregor [Thu, 27 Sep 2012 14:50:15 +0000 (14:50 +0000)]
Following up on r164620, cope with symlinking from an embedded
framework location out to a top-level framework. Such frameworks are
not really embedded at all.

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

11 years agoShrink LinkageInfo from 96 bits to 8 bits.
Benjamin Kramer [Thu, 27 Sep 2012 12:52:55 +0000 (12:52 +0000)]
Shrink LinkageInfo from 96 bits to 8 bits.

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

11 years agoRevert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See:...
Sylvestre Ledru [Thu, 27 Sep 2012 10:16:10 +0000 (10:16 +0000)]
Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164766

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

11 years agoFix a typo 'iff' => 'if'
Sylvestre Ledru [Thu, 27 Sep 2012 09:57:10 +0000 (09:57 +0000)]
Fix a typo 'iff' => 'if'

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

11 years agoIvarInvalidationChecker.cpp: Remove an unused member, InterfD. [-Wunused-private...
NAKAMURA Takumi [Thu, 27 Sep 2012 01:52:00 +0000 (01:52 +0000)]
IvarInvalidationChecker.cpp: Remove an unused member, InterfD. [-Wunused-private-field]

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

11 years agoPer discussion in http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120917...
Argyrios Kyrtzidis [Thu, 27 Sep 2012 01:42:07 +0000 (01:42 +0000)]
Per discussion in http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120917/064551.html
have PPCallbacks::InclusionDirective pass the character range for the filename quotes or brackets.

rdar://11113134 & http://llvm.org/PR13880

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

11 years agoUse %clang_cc1 so that the test works even if the target isn't available.
Jordan Rose [Thu, 27 Sep 2012 01:40:12 +0000 (01:40 +0000)]
Use %clang_cc1 so that the test works even if the target isn't available.

Xcode-style clang builds only support Xcode's architectures, so mips
isn't available and the driver tries to use gcc instead. cc1 will go
ahead and do -fsyntax-only for any platform it knows about even if it
can't actually compile.

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

11 years ago[libclang] Always report a CXCursor_MacroDefinition for code-completion
Argyrios Kyrtzidis [Thu, 27 Sep 2012 00:24:09 +0000 (00:24 +0000)]
[libclang] Always report a CXCursor_MacroDefinition for code-completion
results for a macro name, not CXCursor_NotImplemented.

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

11 years agoUse a variable to stop us from building clang testing tools.
Bill Wendling [Thu, 27 Sep 2012 00:11:09 +0000 (00:11 +0000)]
Use a variable to stop us from building clang testing tools.
<rdar://problem/11202465>

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

11 years agoTurn off this test, as the new and old SROA cause it produce different output.
Nick Lewycky [Wed, 26 Sep 2012 22:48:46 +0000 (22:48 +0000)]
Turn off this test, as the new and old SROA cause it produce different output.
Left in a note that we need to turn it back on once the SROA fallout is cleared
up.

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

11 years agoUpdate to new function attribute querying syntax.
Bill Wendling [Wed, 26 Sep 2012 21:59:46 +0000 (21:59 +0000)]
Update to new function attribute querying syntax.

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

11 years agoAllow -MF to be used in combination with -E -M or -E -MM.
Benjamin Kramer [Wed, 26 Sep 2012 19:01:49 +0000 (19:01 +0000)]
Allow -MF to be used in combination with -E -M or -E -MM.

Fixes PR13851. Patch by Dimitry Andric!

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

11 years ago[analyzer] Add experimental ObjC invalidation method checker.
Anna Zaks [Wed, 26 Sep 2012 18:55:16 +0000 (18:55 +0000)]
[analyzer] Add experimental ObjC invalidation method checker.

This checker is annotation driven. It checks that the annotated
invalidation method accesses all ivars of the enclosing objects that are
objects of type, which in turn contains an invalidation method.

This is driven by
__attribute((annotation("objc_instance_variable_invalidator")).

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

11 years ago[analyzer] Commit a test case for r164579.
Anna Zaks [Wed, 26 Sep 2012 18:55:09 +0000 (18:55 +0000)]
[analyzer] Commit a test case for r164579.

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

11 years agoHave set-xcode-analyer report an error if no xcspec file could be found.
Ted Kremenek [Wed, 26 Sep 2012 18:19:55 +0000 (18:19 +0000)]
Have set-xcode-analyer report an error if no xcspec file could be found.

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

11 years agoMake set-xcode-analyzer more tolerant of the naming differenes reported by xcode...
Ted Kremenek [Wed, 26 Sep 2012 18:13:03 +0000 (18:13 +0000)]
Make set-xcode-analyzer more tolerant of the naming differenes reported by xcode-select.

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

11 years agoRevert "Use sep instead of ' '."
Ted Kremenek [Wed, 26 Sep 2012 18:06:08 +0000 (18:06 +0000)]
Revert "Use sep instead of ' '."

This isn't correct, as Jordan correctly points out.

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

11 years agoFix template instantiation of attributes. More specifically, fix the case
DeLesley Hutchins [Wed, 26 Sep 2012 17:57:31 +0000 (17:57 +0000)]
Fix template instantiation of attributes.  More specifically, fix the case
where an attribute is attached to a forward declaration of a template function,
and refers to parameters of that declaration, but is then inherited by the
definition of that function.  When the definition is instantiated, the
parameter references need to be remapped.

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

11 years agoUse sep instead of ' '.
Ted Kremenek [Wed, 26 Sep 2012 17:23:31 +0000 (17:23 +0000)]
Use sep instead of ' '.

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

11 years agoMake our mini-stdint.h platform-independent by using predefined macros.
Jordan Rose [Wed, 26 Sep 2012 16:41:11 +0000 (16:41 +0000)]
Make our mini-stdint.h platform-independent by using predefined macros.

This also adds a definition for uint64_t, which was causing build failures
on some platforms. (I'm actually surprised this didn't happen on more
builders, but maybe the search paths are different.)

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

11 years ago[libclang] Remove the ParentKind cursor kind from code-completion results.
Argyrios Kyrtzidis [Wed, 26 Sep 2012 16:39:56 +0000 (16:39 +0000)]
[libclang] Remove the ParentKind cursor kind from code-completion results.

This is to reduce dependency to cursors for the code-completion results.

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

11 years agoHave ASTUnit::Save() return a bool to indicate save error.
Argyrios Kyrtzidis [Wed, 26 Sep 2012 16:39:46 +0000 (16:39 +0000)]
Have ASTUnit::Save() return a bool to indicate save error.

Removes a dependency of ASTUnit to clang-c/Index.h.

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

11 years agoFix build failure and enhance the testcase for unwind.h.
Logan Chien [Wed, 26 Sep 2012 09:40:37 +0000 (09:40 +0000)]
Fix build failure and enhance the testcase for unwind.h.

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

11 years agoRun test in a freestanding environment so it doesn't accidentally pick up system...
Benjamin Kramer [Wed, 26 Sep 2012 09:10:53 +0000 (09:10 +0000)]
Run test in a freestanding environment so it doesn't accidentally pick up system headers for the wrong target.

While there add a test that verifies that the header parses in C++ mode.

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

11 years agoFix two more tests that didn't do anything.
Nico Weber [Wed, 26 Sep 2012 09:09:17 +0000 (09:09 +0000)]
Fix two more tests that didn't do anything.

Found with
  find test -type f | xargs grep RUN: | grep '%clang' | grep -iv '%s' | grep -v '%t' | grep -v '\\$'

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

11 years agoMake this test actually test something
Nico Weber [Wed, 26 Sep 2012 09:02:07 +0000 (09:02 +0000)]
Make this test actually test something

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

11 years agoRevert r163022, it caused PR13924.
Nico Weber [Wed, 26 Sep 2012 08:19:01 +0000 (08:19 +0000)]
Revert r163022, it caused PR13924.

Add a test for PR13924. Do not revert the test added in r163022,
it surprisingly still passes even after reverting the code changes.

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

11 years agoAdd struct keyword before _Unwind_Context.
Logan Chien [Wed, 26 Sep 2012 06:35:17 +0000 (06:35 +0000)]
Add struct keyword before _Unwind_Context.

In the C programming language, we have to add the
"struct" keyword.  Otherwise, the compiler will
emit error message.

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

11 years agoRemove unnecessary ASTContext& parameter from SymExpr::getType().
Ted Kremenek [Wed, 26 Sep 2012 06:00:14 +0000 (06:00 +0000)]
Remove unnecessary ASTContext& parameter from SymExpr::getType().

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

11 years agoAdd codegen support for the __debugbreak intrinsic.
Nico Weber [Wed, 26 Sep 2012 05:40:16 +0000 (05:40 +0000)]
Add codegen support for the __debugbreak intrinsic.

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

11 years agoFix an edge case of mangling involving the combination of a lambda and typeid.
Eli Friedman [Wed, 26 Sep 2012 04:34:21 +0000 (04:34 +0000)]
Fix an edge case of mangling involving the combination of a lambda and typeid.
typeid (and a couple other non-standard places where we can transform an
unevaluated expression into an evaluated expression) is special
because it introduces an an expression evaluation context,
which conflicts with the mechanism to compute the current
lambda mangling context.  PR12123.

I would appreciate if someone would double-check that we get the mangling
correct with this patch.

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

11 years agoFix the AST representation for non-type template arguments to encode
Eli Friedman [Wed, 26 Sep 2012 02:36:12 +0000 (02:36 +0000)]
Fix the AST representation for non-type template arguments to encode
enough information so we can mangle them correctly in cases involving
dependent parameter types. (This specifically impacts cases involving
null pointers and cases involving parameters of reference type.)
Fix the mangler to use this information instead of trying to scavenge
it out of the parameter declaration.

<rdar://problem/12296776>.

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

11 years agoTeach Type::getAs<TemplateSpecializationType> that a TemplateSpecializationType
Richard Smith [Wed, 26 Sep 2012 02:18:13 +0000 (02:18 +0000)]
Teach Type::getAs<TemplateSpecializationType> that a TemplateSpecializationType
for a type alias template can appear as sugar at any level of desugaring, just
like a TypedefType.

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

11 years agoUpdate checker build.
Ted Kremenek [Tue, 25 Sep 2012 23:58:39 +0000 (23:58 +0000)]
Update checker build.

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

11 years ago[Options] Store the option ID in OptTable::Info.
Michael J. Spencer [Tue, 25 Sep 2012 23:12:48 +0000 (23:12 +0000)]
[Options] Store the option ID in OptTable::Info.

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

11 years agoRemove 'const' version of getBasicVals(), which is useless.
Ted Kremenek [Tue, 25 Sep 2012 23:12:12 +0000 (23:12 +0000)]
Remove 'const' version of getBasicVals(), which is useless.

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

11 years agoRename CanFitInto64Bits to alwaysFitsInto64Bits per discussion on IRC.
Jordan Rose [Tue, 25 Sep 2012 22:32:51 +0000 (22:32 +0000)]
Rename CanFitInto64Bits to alwaysFitsInto64Bits per discussion on IRC.

This makes the behavior clearer concerning literals with the maximum
number of digits. For a 32-bit example, 4,000,000,000 is a valid uint32_t,
but 5,000,000,000 is not, so we'd have to count 10-digit decimal numbers
as "unsafe" (meaning we have to check for overflow when parsing them,
just as we would for numbers with 11 digits or higher). This is the same,
only with 64 bits to play with.

No functionality change.

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

11 years ago[driver] Add support for the -fno-fast-math option.
Chad Rosier [Tue, 25 Sep 2012 22:03:25 +0000 (22:03 +0000)]
[driver] Add support for the -fno-fast-math option.
rdar://12299433

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

11 years ago[libclang] Do a AST concurrency check in clang_indexTranslationUnit_Impl.
Argyrios Kyrtzidis [Tue, 25 Sep 2012 19:29:50 +0000 (19:29 +0000)]
[libclang] Do a AST concurrency check in clang_indexTranslationUnit_Impl.

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

11 years agoImprove upon r164450 and localize the logic of updating the type of
Argyrios Kyrtzidis [Tue, 25 Sep 2012 19:26:39 +0000 (19:26 +0000)]
Improve upon r164450 and localize the logic of updating the type of
a function decl inside the ASTNodeImporter::VisitFunctionDecl function.

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

11 years agoOptimize NumericLiteralParser::GetIntegerValue().
Dmitri Gribenko [Tue, 25 Sep 2012 19:09:15 +0000 (19:09 +0000)]
Optimize NumericLiteralParser::GetIntegerValue().

It does a conservative estimate on the size of numbers that can fit into
uint64_t.  This bound is improved.

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

11 years ago[analyzer] Add tests for symbolic expression liveness.
Jordan Rose [Tue, 25 Sep 2012 19:03:09 +0000 (19:03 +0000)]
[analyzer] Add tests for symbolic expression liveness.

There are very few tests here because SValBuilder is fairly aggressive
about not building SymExprs that we can't evaluate, which saves memory
and CPU but also makes it very much tied to the current constraint
manager. We should probably scale back here and let things decay to
UnknownVal later on.

bitwise-ops.c tests that for the SymExprs we do create, we persist our
assumptions about them. traversal-path-unification.c tests that we do
clean out constraints on arbitrary SymExprs once they have actually died.

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

11 years agoReapply "[analyzer] Remove constraints on dead symbols as part of removeDeadBindings."
Jordan Rose [Tue, 25 Sep 2012 19:03:06 +0000 (19:03 +0000)]
Reapply "[analyzer] Remove constraints on dead symbols as part of removeDeadBindings."

Previously, we'd just keep constraints around forever, which means we'd
never be able to merge paths that differed only in constraints on dead
symbols.

Because we now allow constraints on symbolic expressions, not just single
symbols, this requires changing SymExpr::symbol_iterator to include
intermediate symbol nodes in its traversal, not just the SymbolData leaf
nodes.

This depends on the previous commit to be correct. Originally applied in
r163444, reverted in r164275, now being re-applied.

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

11 years ago[analyzer] Calculate liveness for symbolic exprs as well as atomic symbols.
Jordan Rose [Tue, 25 Sep 2012 19:03:01 +0000 (19:03 +0000)]
[analyzer] Calculate liveness for symbolic exprs as well as atomic symbols.

No tests, but this allows the optimization of removing dead constraints.
We can then add tests that we don't do this prematurely.

<rdar://problem/12333297>

Note: the added FIXME to investigate SymbolRegionValue liveness is
tracked by <rdar://problem/12368183>. This patch does not change the
existing behavior.

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

11 years agoUnder certain terrible circumstances (<rdar://problem/10805775>),
Douglas Gregor [Tue, 25 Sep 2012 18:29:14 +0000 (18:29 +0000)]
Under certain terrible circumstances (<rdar://problem/10805775>),
top-level frameworks can actually be symlinked over to embedded
frameworks, and accessed via the top-level framework's headers. In
this case, we need to determine that the framework was *actually* an
embedded framework, so we can load the appropriate top-level module.

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

11 years agoMacro history (de-)serialization. Deserialization currently reads only the latest...
Alexander Kornienko [Tue, 25 Sep 2012 17:18:14 +0000 (17:18 +0000)]
Macro history (de-)serialization. Deserialization currently reads only the latest macro definition. Needs more work.

Summary: Passes all tests (+ the new one with code completion), but needs a thorough review in part related to modules.

Reviewers: doug.gregor

Reviewed By: alexfh

CC: cfe-commits, rsmith
Differential Revision: http://llvm-reviews.chandlerc.com/D41

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

11 years agoExamine the last, not the first, instruction from the MC matcher.
Bob Wilson [Tue, 25 Sep 2012 16:30:16 +0000 (16:30 +0000)]
Examine the last, not the first, instruction from the MC matcher.

If an MS-style inline asm is matched to multiple instructions, e.g., with a
a WAIT-prefix, then we need to examine the operands of the last instruction
instruction, not the prefix instruction.

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

11 years ago-iframework should allow separate arguments.
Douglas Gregor [Tue, 25 Sep 2012 16:13:41 +0000 (16:13 +0000)]
-iframework should allow separate arguments.

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

11 years agoIntroduce builtin macros to determine whether we're building a
Douglas Gregor [Tue, 25 Sep 2012 15:44:52 +0000 (15:44 +0000)]
Introduce builtin macros to determine whether we're building a
specific module (__building_module(modulename)) and to get the name of
the current module as an identifier (__MODULE__).

Used to help headers behave differently when they're being included as
part of building a module. Oh, the irony.

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

11 years agoA minor doc fix.
Alexander Kornienko [Tue, 25 Sep 2012 12:42:05 +0000 (12:42 +0000)]
A minor doc fix.

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

11 years agoFix failing test/Sema/wchar.c on ARM.
Hans Wennborg [Tue, 25 Sep 2012 10:11:17 +0000 (10:11 +0000)]
Fix failing test/Sema/wchar.c on ARM.

Currently Sema/wchar.c fails because WCHAR_T_TYPE is defined as int,
however on ARM wchar_t is unsigned int.

This patch changes that, so this test passes for ARM.

Patch by Joey Gouly!

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

11 years agoWhen performing a ::delete of an object with a virtual destructor,
John McCall [Tue, 25 Sep 2012 10:10:39 +0000 (10:10 +0000)]
When performing a ::delete of an object with a virtual destructor,
be sure to delete the complete object pointer, not the original
pointer.  This is necessary if the base being deleted is at a
non-zero offset in the complete object.  This is only required
for objects with virtual destructors because deleting an object
via a base-class subobject when the base does not have a virtual
destructor is undefined behavior.

Noticed while reviewing the last four years of cxx-abi-dev
activity.

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

11 years agoclang/test/CodeGenCXX/microsoft-*: Fix for -Asserts.
NAKAMURA Takumi [Tue, 25 Sep 2012 09:53:18 +0000 (09:53 +0000)]
clang/test/CodeGenCXX/microsoft-*: Fix for -Asserts.

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

11 years agoImplement Mike Herrick's proposed noexcept mangling.
John McCall [Tue, 25 Sep 2012 09:10:17 +0000 (09:10 +0000)]
Implement Mike Herrick's proposed noexcept mangling.

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

11 years agoIn the MS ABI, ctors return 'this'. Patch by Dmitry Sokolov.
John McCall [Tue, 25 Sep 2012 08:00:39 +0000 (08:00 +0000)]
In the MS ABI, ctors return 'this'.  Patch by Dmitry Sokolov.

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

11 years agoAdd the Microsoft __is_interface_class type trait.
John McCall [Tue, 25 Sep 2012 07:32:49 +0000 (07:32 +0000)]
Add the Microsoft __is_interface_class type trait.
Patch by Andy Gibbs!

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

11 years agoFix for r163013 regression and further __interface enhancement.
John McCall [Tue, 25 Sep 2012 07:32:39 +0000 (07:32 +0000)]
Fix for r163013 regression and further __interface enhancement.
Patch by Andy Gibbs!

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

11 years agoDuring jump-scope checking, build an ExprWithCleanups immediately
John McCall [Tue, 25 Sep 2012 06:56:03 +0000 (06:56 +0000)]
During jump-scope checking, build an ExprWithCleanups immediately
into the enclosing scope;  this is a more accurate model but is
(I believe) unnecessary in my test case due to other flaws.
However, one of those flaws is now intentional:  blocks which
appear in return statements can be trivially observed to not
extend in lifetime past the return, and so we can allow a jump
past them.  Do the necessary magic in IR-generation to make
this work.

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

11 years agoFix crash when a decltype expression in a trailing return type refers to the
Richard Smith [Tue, 25 Sep 2012 04:46:05 +0000 (04:46 +0000)]
Fix crash when a decltype expression in a trailing return type refers to the
function being instantiated. An error recovery codepath was recursively
performing name lookup (and triggering an unbounded stack of template
instantiations which blew out the stack before hitting the depth limit).

Patch by Wei Pan!

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

11 years agoDelete some code which is, as far as I can tell, dead.
Eli Friedman [Tue, 25 Sep 2012 01:02:42 +0000 (01:02 +0000)]
Delete some code which is, as far as I can tell, dead.

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

11 years ago[analyzer] Fix a buildbot crash triggered by turning on dynamic
Anna Zaks [Tue, 25 Sep 2012 00:31:43 +0000 (00:31 +0000)]
[analyzer] Fix a buildbot crash triggered by turning on dynamic
dispatch.

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

11 years agoDon't produce diagnostics for missing ctor-initializers during template
Richard Smith [Tue, 25 Sep 2012 00:23:05 +0000 (00:23 +0000)]
Don't produce diagnostics for missing ctor-initializers during template
instantiations if we encountered errors parsing some of the initializers.

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

11 years agoHandle C++ functional casts in a similar way to C-style casts in
Eli Friedman [Mon, 24 Sep 2012 23:02:26 +0000 (23:02 +0000)]
Handle C++ functional casts in a similar way to C-style casts in
unused expression warnings.  <rdar://problem/12359208>.

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

11 years agoUpdate for r164567.
Chad Rosier [Mon, 24 Sep 2012 22:58:50 +0000 (22:58 +0000)]
Update for r164567.

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

11 years agoobjective-C: use 'instance variables' as plural when referring
Fariborz Jahanian [Mon, 24 Sep 2012 22:51:51 +0000 (22:51 +0000)]
objective-C: use 'instance variables' as plural when referring
to the feature.

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

11 years agoobjective-C: remove use of 'ivar' in favor of
Fariborz Jahanian [Mon, 24 Sep 2012 22:00:36 +0000 (22:00 +0000)]
objective-C: remove use of 'ivar' in favor of
'instance variable' in text of all diagnostics
for objective-C: // rdar://12352442

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

11 years agoAdd clarifying comment.
Ted Kremenek [Mon, 24 Sep 2012 21:17:14 +0000 (21:17 +0000)]
Add clarifying comment.

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

11 years agoMore tests for r164545 (change extension warning about 'long long').
Dmitri Gribenko [Mon, 24 Sep 2012 21:09:05 +0000 (21:09 +0000)]
More tests for r164545 (change extension warning about 'long long').

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

11 years agoStringRef'ize Preprocessor::CreateString().
Dmitri Gribenko [Mon, 24 Sep 2012 21:07:17 +0000 (21:07 +0000)]
StringRef'ize Preprocessor::CreateString().

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

11 years agoReplace raw call to snprintf() by llvm streams.
Dmitri Gribenko [Mon, 24 Sep 2012 20:56:28 +0000 (20:56 +0000)]
Replace raw call to snprintf() by llvm streams.

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

11 years agoReplace an assertion with an error for empty __asm statements.
Bob Wilson [Mon, 24 Sep 2012 19:57:59 +0000 (19:57 +0000)]
Replace an assertion with an error for empty __asm statements.

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

11 years agoFix a comment typo and clean up formatting.
Bob Wilson [Mon, 24 Sep 2012 19:57:55 +0000 (19:57 +0000)]
Fix a comment typo and clean up formatting.

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

11 years agoMake sure that we don't end up making an #undef'd macro visible after
Douglas Gregor [Mon, 24 Sep 2012 19:56:18 +0000 (19:56 +0000)]
Make sure that we don't end up making an #undef'd macro visible after
the fact. Test cases will come when we're actually (de-)serializing
macro history.

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

11 years ago[libclang] Bring CXCursor_AsmStmt back as an alias for CXCursor_GCCAsmStmt.
Argyrios Kyrtzidis [Mon, 24 Sep 2012 19:27:20 +0000 (19:27 +0000)]
[libclang] Bring CXCursor_AsmStmt back as an alias for CXCursor_GCCAsmStmt.

This was renamed in r162632 which was badness because the C API needs to be stable.
rdar://12360096

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

11 years agoInclude 'long long' extension warning in the LongLong group so that it can be
Dmitri Gribenko [Mon, 24 Sep 2012 19:05:10 +0000 (19:05 +0000)]
Include 'long long' extension warning in the LongLong group so that it can be
silenced by -Wno-long-long.  Thanks Richard Smith for the fix idea!

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

11 years agoChange the wording of the extension warning from
Dmitri Gribenko [Mon, 24 Sep 2012 18:19:21 +0000 (18:19 +0000)]
Change the wording of the extension warning from
> 'long long' is an extension when C99 mode is not enabled
to
> 'long long' is a C++11 extension
while compiling in C++98 mode.

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