]> granicus.if.org Git - clang/log
clang
12 years ago[analyzer] Refactor: Move symbol_iterator from SVal to SymExpr, use it
Anna Zaks [Tue, 6 Dec 2011 23:12:33 +0000 (23:12 +0000)]
[analyzer] Refactor: Move symbol_iterator from SVal to SymExpr, use it
for finding dependent symbols for taint.

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

12 years ago[analyzer] Propagate taint through NonLoc to NonLoc casts.
Anna Zaks [Tue, 6 Dec 2011 23:12:27 +0000 (23:12 +0000)]
[analyzer] Propagate taint through NonLoc to NonLoc casts.

 - Created a new SymExpr type - SymbolCast.
 - SymbolCast is created when we don't know how to simplify a NonLoc to
NonLoc casts.
 - A bit of code refactoring: introduced dispatchCast to have better
code reuse, remove a goto.
 - Updated the test case to showcase the new taint flow.

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

12 years ago[analyzer] Remove an unnecessary check.
Anna Zaks [Tue, 6 Dec 2011 23:12:17 +0000 (23:12 +0000)]
[analyzer] Remove an unnecessary check.

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

12 years agoAdd a FIXME to provide a sensible error message here
Douglas Gregor [Tue, 6 Dec 2011 23:04:08 +0000 (23:04 +0000)]
Add a FIXME to provide a sensible error message here

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

12 years agoMove vector bitcast handling in constant expressions from the expression
Richard Smith [Tue, 6 Dec 2011 22:44:34 +0000 (22:44 +0000)]
Move vector bitcast handling in constant expressions from the expression
evaluator into constant initializer handling / IRGen. The practical consequence
of this is that the bitcast now lives in the constant's definition, rather than
in its uses.

The code in the constant expression evaluator was producing vectors of the wrong
type and size (and possibly of the wrong value for a big-endian int-to-vector
bitcast). We were getting away with this only because we don't yet support
constant-folding of any expressions which inspect vector values.

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

12 years agoUse absolute paths for temporary module map files
Douglas Gregor [Tue, 6 Dec 2011 22:05:29 +0000 (22:05 +0000)]
Use absolute paths for temporary module map files

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

12 years ago[libclang] API enhancements by Joe Groff!
Argyrios Kyrtzidis [Tue, 6 Dec 2011 22:05:01 +0000 (22:05 +0000)]
[libclang] API enhancements by Joe Groff!

- Exposes a CXType_Vector type kind for vector types.
- Adds generalized versions of the clang_getArrayElementType and clang_getArraySize functions, named clang_getElementType and clang_getNumElements, which work on array, vector, or complex types.
- Adds additional functions for querying function types. clang_isFunctionTypeVariadic returns true if a function type is variadic. clang_getFunctionCallingConv returns an enumeration value indicating the calling convention of the function type. clang_getNumArgTypes returns the number of static argument types, and clang_getArgType gets the type of an argument.
- Adds a clang_getTypedefDeclUnderlyingType function to get the underlying type from a TypedefDecl cursor.
- Adds a clang_getEnumDeclIntegerType function to get the integer type from an EnumDecl cursor.
- Adds clang_getEnumConstantDeclValue and clang_getEnumConstantDeclUnsignedValue functions to get the value of an EnumConstantDecl as a signed or unsigned long long, respectively.
- Exposes a CXCursor_AsmLabelAttr cursor kind for __asm__("label") attributes.
- Alters clang_getCursorSpelling to return the label value for AsmLabelAttr-kind cursors.

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

12 years agoRename Objective-C-only tests to .m
Douglas Gregor [Tue, 6 Dec 2011 20:51:42 +0000 (20:51 +0000)]
Rename Objective-C-only tests to .m

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

12 years agoRemove misleading error message
Douglas Gregor [Tue, 6 Dec 2011 19:57:48 +0000 (19:57 +0000)]
Remove misleading error message

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

12 years agoWhen inferring a module map for a framework, infer subframework
Douglas Gregor [Tue, 6 Dec 2011 19:39:29 +0000 (19:39 +0000)]
When inferring a module map for a framework, infer subframework
modules for each of its subframeworks.

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

12 years agoRemove unused member to appease valgrind.
Benjamin Kramer [Tue, 6 Dec 2011 19:26:57 +0000 (19:26 +0000)]
Remove unused member to appease valgrind.

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

12 years ago[asan] Mac: do not link dynamic libs with the asan-rt, use -undefined dynamic_lookup...
Kostya Serebryany [Tue, 6 Dec 2011 19:18:44 +0000 (19:18 +0000)]
[asan] Mac: do not link dynamic libs with the asan-rt, use -undefined dynamic_lookup for dynamic libs. Style fixes. Patch by glider@google.com

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

12 years agoAllow inferred submodules for any (sub)module that has an umbrella header
Douglas Gregor [Tue, 6 Dec 2011 17:34:58 +0000 (17:34 +0000)]
Allow inferred submodules for any (sub)module that has an umbrella header

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

12 years agoWhen suggesting a module import for a #include or #import, suggest the
Douglas Gregor [Tue, 6 Dec 2011 17:31:28 +0000 (17:31 +0000)]
When suggesting a module import for a #include or #import, suggest the
most specific (sub)module based on the actual file we find, rather
than always importing the top-level module. This means
that #include'ing <Foo/Blah.h> should give us the submodule Foo.Blah.

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

12 years agoImplement modules support for subframeworks (aka embedded
Douglas Gregor [Tue, 6 Dec 2011 17:16:41 +0000 (17:16 +0000)]
Implement modules support for subframeworks (aka embedded
frameworks). A submodule can now be labeled as a "framework", and
header search will look into the appropriate Headers/PrivateHeaders
subdirectories for named headers.

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

12 years agoWhen building the main file to parse given a module map, don't skip
Douglas Gregor [Tue, 6 Dec 2011 17:15:11 +0000 (17:15 +0000)]
When building the main file to parse given a module map, don't skip
explicit submodules or umbrella headers from submodules. Instead,
build the entire module at once, and let the name-hiding mechanisms
hide the contents of explicit submodules at load time.

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

12 years agoHeaders: wmmintrin.h only needs xmmintrin.h.
Daniel Dunbar [Tue, 6 Dec 2011 16:17:54 +0000 (16:17 +0000)]
Headers: wmmintrin.h only needs xmmintrin.h.
 - Fixes <rdar://problem/10261246> clang -maes option is not sufficient to
   include <wmmintrin.h>

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

12 years agoMinor tweak to prepare for submodules with umbrella headers. No actual
Douglas Gregor [Tue, 6 Dec 2011 16:17:15 +0000 (16:17 +0000)]
Minor tweak to prepare for submodules with umbrella headers. No actual
functionality change yet.

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

12 years agoInstall cpuid.h when building with cmake too.
Rafael Espindola [Tue, 6 Dec 2011 15:46:47 +0000 (15:46 +0000)]
Install cpuid.h when building with cmake too.

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

12 years agoSuggest typo corrections for implicit function declarations.
Hans Wennborg [Tue, 6 Dec 2011 09:46:12 +0000 (09:46 +0000)]
Suggest typo corrections for implicit function declarations.

A mistyped function call becomes an inmplicit function declaration in C.
Suggest typo correction when one can be found.

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

12 years agoExtend warnings for missing '@end'.
Erik Verbruggen [Tue, 6 Dec 2011 09:25:23 +0000 (09:25 +0000)]
Extend warnings for missing '@end'.
Fixes PR2709.

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

12 years agoSwitch a cast to a dyn_cast and check the pointer before using. Fixes a crash
Richard Trieu [Tue, 6 Dec 2011 04:48:01 +0000 (04:48 +0000)]
Switch a cast to a dyn_cast and check the pointer before using.  Fixes a crash
in the following code:

void test4(bool (&x)(void)) {
  while (x);
}

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

12 years agoFix test for unrelated changes.
Nick Lewycky [Tue, 6 Dec 2011 03:46:28 +0000 (03:46 +0000)]
Fix test for unrelated changes.

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

12 years agoStack realignment is a tristate. Add -mno-stackrealign to turn off all stack
Nick Lewycky [Tue, 6 Dec 2011 03:33:03 +0000 (03:33 +0000)]
Stack realignment is a tristate. Add -mno-stackrealign to turn off all stack
realignment, even with locals with alignment exceeding the ABI guarantee.

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

12 years agoMinor comment update.
Eli Friedman [Tue, 6 Dec 2011 03:08:26 +0000 (03:08 +0000)]
Minor comment update.

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

12 years agoFix an extremely stupid bug causing terrible miscompilations
John McCall [Tue, 6 Dec 2011 02:56:18 +0000 (02:56 +0000)]
Fix an extremely stupid bug causing terrible miscompilations
of &= on pseudo-objects.

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

12 years agoImplement inferred submodules support, which (when requested)
Douglas Gregor [Tue, 6 Dec 2011 01:10:29 +0000 (01:10 +0000)]
Implement inferred submodules support, which (when requested)
implicitly generates submodules corresponding to the headers that fall
within a module.

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

12 years agoMake sure we perform lvalue-to-rvalue conversions for enum initializers. PR11484.
Eli Friedman [Tue, 6 Dec 2011 00:10:34 +0000 (00:10 +0000)]
Make sure we perform lvalue-to-rvalue conversions for enum initializers.  PR11484.

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

12 years agoobjc: put out more coherent warning when method definition
Fariborz Jahanian [Tue, 6 Dec 2011 00:02:41 +0000 (00:02 +0000)]
objc: put out more coherent warning when method definition
attributes don't match its declaration. // rdar://10529259.

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

12 years agoAdd -mstack-alignment=X and fix -mstackrealign handling now that the
Joerg Sonnenberger [Mon, 5 Dec 2011 23:05:23 +0000 (23:05 +0000)]
Add -mstack-alignment=X and fix -mstackrealign handling now that the
backend options are gone.

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

12 years agoMore refactoring of objc rewriter.
Fariborz Jahanian [Mon, 5 Dec 2011 22:59:54 +0000 (22:59 +0000)]
More refactoring of objc rewriter.

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

12 years agoParse inferred submodules in module maps, track their contents in
Douglas Gregor [Mon, 5 Dec 2011 22:27:44 +0000 (22:27 +0000)]
Parse inferred submodules in module maps, track their contents in
Module, and (de-)serialize this information. Semantics of inferred
submodules to follow.

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

12 years agoMake EmitAggregateCopy take an alignment argument. Make EmitFinalDestCopy pass in...
Eli Friedman [Mon, 5 Dec 2011 22:23:28 +0000 (22:23 +0000)]
Make EmitAggregateCopy take an alignment argument.  Make EmitFinalDestCopy pass in the correct alignment when known.

The test includes a FIXME for a related case involving calls; it's a bit more complicated to fix because the RValue class doesn't keep track of alignment.

<rdar://problem/10463337>

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

12 years ago[libclang] When indexing a field in a C++ class, return an entity
Argyrios Kyrtzidis [Mon, 5 Dec 2011 22:05:28 +0000 (22:05 +0000)]
[libclang] When indexing a field in a C++ class, return an entity
of kind CXIdxEntity_CXXInstanceVariable. rdar://10522503.

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

12 years ago[analyzer] Rely on LLVM Dominators in Clang dominator computation.
Anna Zaks [Mon, 5 Dec 2011 21:33:11 +0000 (21:33 +0000)]
[analyzer] Rely on LLVM Dominators in Clang dominator computation.

(Previously, Clang used it's implementation of dominators.)

The patch is contributed by Guoping Long!

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

12 years ago[analyzer] Mark ConstraintManager::canReasonAbout as protected.
Anna Zaks [Mon, 5 Dec 2011 21:33:06 +0000 (21:33 +0000)]
[analyzer] Mark ConstraintManager::canReasonAbout as protected.

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

12 years ago[analyzer] Simplify the condition.
Anna Zaks [Mon, 5 Dec 2011 21:33:01 +0000 (21:33 +0000)]
[analyzer] Simplify the condition.

This is a fixup for r145832.

The extra clauses do not matter after we remove the dependency on canReasonAbout(InitVal) in r145832.

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

12 years ago[analyzer] Simplify the expected-warning statement.
Anna Zaks [Mon, 5 Dec 2011 21:32:58 +0000 (21:32 +0000)]
[analyzer] Simplify the expected-warning statement.

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

12 years agoAdd a warning for implicit conversion from function literals (and static
Lang Hames [Mon, 5 Dec 2011 20:49:50 +0000 (20:49 +0000)]
Add a warning for implicit conversion from function literals (and static
methods) to bool. E.g.

void foo() {}
if (f) { ... // <- Warns here.
}

Only applies to non-weak functions, and does not apply if the function address
is taken explicitly with the addr-of operator.

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

12 years agoMake isWeakDecl available as a method on ValueDecl.
Lang Hames [Mon, 5 Dec 2011 20:16:26 +0000 (20:16 +0000)]
Make isWeakDecl available as a method on ValueDecl.

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

12 years agoMore objc rewriter refactoring.
Fariborz Jahanian [Mon, 5 Dec 2011 19:50:04 +0000 (19:50 +0000)]
More objc rewriter refactoring.

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

12 years ago[analyzer] Add a missing taint tester warning.
Anna Zaks [Mon, 5 Dec 2011 18:58:33 +0000 (18:58 +0000)]
[analyzer] Add a missing taint tester warning.

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

12 years ago[analyzer] Unify SymbolVal and SymExprVal under a single SymbolVal
Anna Zaks [Mon, 5 Dec 2011 18:58:30 +0000 (18:58 +0000)]
[analyzer] Unify SymbolVal and SymExprVal under a single SymbolVal
class.

We are going into the direction of handling SymbolData and other SymExpr
uniformly, so it makes less sense to keep two different SVal classes.
For example, the checkers would have to take an extra step to reason
about each type separately.

The classes have the same members, we were just using the SVal kind
field for easy differentiation in 3 switch statements. The switch
statements look more ugly now, but we can make the code more readable in
other ways, for example, moving some code into separate functions.

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

12 years ago[analyzer] Remove all uses of ConstraintManager::canResonAbout() from
Anna Zaks [Mon, 5 Dec 2011 18:58:25 +0000 (18:58 +0000)]
[analyzer] Remove all uses of ConstraintManager::canResonAbout() from
ExprEngine.

Teach SimpleConstraintManager::assumeSymRel() to propagate constraints
to symbolic expressions.

+ One extra warning (real bug) is now generated due to enhanced
assumeSymRel().

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

12 years ago[analyzer] First step toward removing
Anna Zaks [Mon, 5 Dec 2011 18:58:19 +0000 (18:58 +0000)]
[analyzer] First step toward removing
ConstraintManager::canReasonAbout() from the ExprEngine.

ExprEngine should not care if the constraint solver can reason about
something or not. The solver should be able to handle all the SymExprs.

To do this, the solver should be able to keep track of not only the
SymbolData but of all SymExprs. This is why we change SymbolRef to be an
alias of SymExpr*. When encountering an expression it cannot simplify,
the solver should just add the constraints to it.

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

12 years ago[analyzer] Minor improvements on RangeConstraint pretty-printing.
Anna Zaks [Mon, 5 Dec 2011 18:58:14 +0000 (18:58 +0000)]
[analyzer] Minor improvements on RangeConstraint pretty-printing.

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

12 years ago[analyzer] Change RetainCountChecker to use symbol dump method instead
Anna Zaks [Mon, 5 Dec 2011 18:58:11 +0000 (18:58 +0000)]
[analyzer] Change RetainCountChecker to use symbol dump method instead
of relying on SymbolID.

This way any expression can be printed (not only SymbolData).

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

12 years ago[analyzer] Add ability to do a simple ProgramState dump() without
Anna Zaks [Mon, 5 Dec 2011 18:58:08 +0000 (18:58 +0000)]
[analyzer] Add ability to do a simple ProgramState dump() without
requiring CFG.

Adding more ugly code; the evnvironment printing should be moved to
envirnment at some point.

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

12 years ago[analyzer] Add a debug checker to test for tainted data.
Anna Zaks [Mon, 5 Dec 2011 18:58:01 +0000 (18:58 +0000)]
[analyzer] Add a debug checker to test for tainted data.

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

12 years agoSome early refactoring of objective-c rewriter.
Fariborz Jahanian [Mon, 5 Dec 2011 18:43:13 +0000 (18:43 +0000)]
Some early refactoring of objective-c rewriter.

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

12 years ago[asan] don't require libstdc++ for asan on linux. Mac fix will go separately
Kostya Serebryany [Mon, 5 Dec 2011 18:32:37 +0000 (18:32 +0000)]
[asan] don't require libstdc++ for asan on linux. Mac fix will go separately

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

12 years agowe got badgered into supporting multi-alternative constraints.
Chris Lattner [Mon, 5 Dec 2011 18:29:03 +0000 (18:29 +0000)]
we got badgered into supporting multi-alternative constraints.

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

12 years agoInferred framework modules automatically export anything they import
Douglas Gregor [Mon, 5 Dec 2011 17:40:25 +0000 (17:40 +0000)]
Inferred framework modules automatically export anything they import
(i.e., 'export *'), to better match the semantics of headers.

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

12 years agoFix printing of wildcard exports.
Douglas Gregor [Mon, 5 Dec 2011 17:34:59 +0000 (17:34 +0000)]
Fix printing of wildcard exports.

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

12 years agoImplement support for wildcard exports in modules, allowing a module
Douglas Gregor [Mon, 5 Dec 2011 17:28:06 +0000 (17:28 +0000)]
Implement support for wildcard exports in modules, allowing a module
to re-export anything that it imports. This opt-in feature makes a
module behave more like a header, because it can be used to re-export
the transitive closure of a (sub)module's dependencies.

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

12 years agoActually add a useful bit to the comment pre-FIXME
Douglas Gregor [Mon, 5 Dec 2011 16:35:23 +0000 (16:35 +0000)]
Actually add a useful bit to the comment pre-FIXME

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

12 years agoWhen writing a module file, keep track of the set of (sub)modules that
Douglas Gregor [Mon, 5 Dec 2011 16:33:54 +0000 (16:33 +0000)]
When writing a module file, keep track of the set of (sub)modules that
it imports, establishing dependencies at the (sub)module
granularity. This is not a user-visible change (yet).

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

12 years agoinclude/clang*/Makefile: Tweak installation to work with CLANG_SRCDIR.
NAKAMURA Takumi [Mon, 5 Dec 2011 06:13:20 +0000 (06:13 +0000)]
include/clang*/Makefile: Tweak installation to work with CLANG_SRCDIR.

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

12 years agoSupport decltype in nested-name-specifiers.
David Blaikie [Sun, 4 Dec 2011 05:04:18 +0000 (05:04 +0000)]
Support decltype in nested-name-specifiers.

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

12 years agoMove block return type inference diagnostic to a common place where
Fariborz Jahanian [Sat, 3 Dec 2011 23:53:56 +0000 (23:53 +0000)]
Move block return type inference diagnostic to a common place where
Function or array lvalue conversions happens.

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

12 years agoFix mangling substitutions for address-space-qualified class
Douglas Gregor [Sat, 3 Dec 2011 18:24:43 +0000 (18:24 +0000)]
Fix mangling substitutions for address-space-qualified class
types. Patch from Dmitri Rubinstein!

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

12 years agoImplement support for the __is_final type trait, to determine whether
Douglas Gregor [Sat, 3 Dec 2011 18:14:24 +0000 (18:14 +0000)]
Implement support for the __is_final type trait, to determine whether
a class is marked 'final', from Alberto Ganesh Barbati! Fixes
PR11462.

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

12 years agoIf block literal return type is not specified, return type of the block is
Fariborz Jahanian [Sat, 3 Dec 2011 17:47:53 +0000 (17:47 +0000)]
If block literal return type is not specified, return type of the block is
inferred from return types. All the return statements have to agree about the type.
// rdar://10466373

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

12 years agoIn Microsoft mode, don't perform typo correction in a template member function depend...
Francois Pichet [Sat, 3 Dec 2011 15:55:29 +0000 (15:55 +0000)]
In Microsoft mode, don't perform typo correction in a template member function dependent context because it interferes with the "lookup into dependent bases of class templates" feature.

Basically typo correction will try to offer a correction instead of looking into type dependent base classes.

I found this problem while parsing Microsoft ATL code with clang.

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

12 years agoImplement overload resolution for reference-typed parameters supplied with initialize...
Sebastian Redl [Sat, 3 Dec 2011 14:54:30 +0000 (14:54 +0000)]
Implement overload resolution for reference-typed parameters supplied with initializer lists.

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

12 years agoSwitch LValue so that it exposes alignment in CharUnits. (No functional change.)
Eli Friedman [Sat, 3 Dec 2011 04:14:32 +0000 (04:14 +0000)]
Switch LValue so that it exposes alignment in CharUnits.  (No functional change.)

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

12 years ago[PCH] Make sure that the SourceExpr of a OpaqueValueExpr is always initialized
Argyrios Kyrtzidis [Sat, 3 Dec 2011 03:49:52 +0000 (03:49 +0000)]
[PCH] Make sure that the SourceExpr of a OpaqueValueExpr is always initialized
when deserialized, fixing random crashes in libclang.

Also simplifies how OpaqueValueExprs are [de]serialized.
The reader/writer automatically retains pointer equality of sub-statements (when a
statement node is referenced in multiple nodes), so no need to manually handle it.

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

12 years ago[libclang] Fix infinite loop when doing visitation of an OpaqueValueExpr.
Argyrios Kyrtzidis [Sat, 3 Dec 2011 03:49:47 +0000 (03:49 +0000)]
[libclang] Fix infinite loop when doing visitation of an OpaqueValueExpr.

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

12 years ago[libclang] Allow indexing/get-cursor/etc. for the exception variable in a C++ catch.
Argyrios Kyrtzidis [Sat, 3 Dec 2011 03:49:44 +0000 (03:49 +0000)]
[libclang] Allow indexing/get-cursor/etc. for the exception variable in a C++ catch.

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

12 years agoAdd a utility to get a RValue for a given LValue for an aggregate; switch a few place...
Eli Friedman [Sat, 3 Dec 2011 03:08:40 +0000 (03:08 +0000)]
Add a utility to get a RValue for a given LValue for an aggregate; switch a few places over to it.

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

12 years agoSwitch the Alignment argument on AggValueSlot over to CharUnits, per John's review...
Eli Friedman [Sat, 3 Dec 2011 02:13:40 +0000 (02:13 +0000)]
Switch the Alignment argument on AggValueSlot over to CharUnits, per John's review comment.

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

12 years agoModule files representing actual modules don't need to know the set of modules they...
Douglas Gregor [Sat, 3 Dec 2011 01:15:29 +0000 (01:15 +0000)]
Module files representing actual modules don't need to know the set of modules they import, since that information isn't actually used. Drop it from the AST file

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

12 years agoImplement support for precompiled headers, preambles, and serialized
Douglas Gregor [Sat, 3 Dec 2011 00:59:55 +0000 (00:59 +0000)]
Implement support for precompiled headers, preambles, and serialized
"main" files that import modules. When loading any of these kinds of
AST files, we make the modules that were imported visible into the
translation unit that loaded the PCH file or preamble.

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

12 years agoTrack alignment in AggValueSlot. No functional change in this patch, but I'll be...
Eli Friedman [Sat, 3 Dec 2011 00:54:26 +0000 (00:54 +0000)]
Track alignment in AggValueSlot.  No functional change in this patch, but I'll be introducing uses of the specified alignment soon.

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

12 years agoKeep track of all of the import declarations that are parsed or
Douglas Gregor [Sat, 3 Dec 2011 00:30:27 +0000 (00:30 +0000)]
Keep track of all of the import declarations that are parsed or
implicitly generated in a translation unit. Modules will need this
information to identify the actual imports that occurred.

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

12 years agoWhen we treat an #include or #import as a module import, create an
Douglas Gregor [Fri, 2 Dec 2011 23:42:12 +0000 (23:42 +0000)]
When we treat an #include or #import as a module import, create an
implicit ImportDecl in the translation unit to record the presence of
the import.

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

12 years agoIntroduce a module import declaration, so that we properly represent, e.g.,
Douglas Gregor [Fri, 2 Dec 2011 23:23:56 +0000 (23:23 +0000)]
Introduce a module import declaration, so that we properly represent, e.g.,

  __import_module__ std.vector;

in the AST.

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

12 years agoRevert r145697 and dependent patch r145702. It added a dependency from
Nick Lewycky [Fri, 2 Dec 2011 23:21:43 +0000 (23:21 +0000)]
Revert r145697 and dependent patch r145702. It added a dependency from
lib/Analysis to lib/Sema which is cyclical.

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

12 years agoUpdate for change to LLVM TargetMachine API in r145714.
Nick Lewycky [Fri, 2 Dec 2011 22:17:00 +0000 (22:17 +0000)]
Update for change to LLVM TargetMachine API in r145714.

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

12 years agoAdd missing test header
Douglas Gregor [Fri, 2 Dec 2011 21:59:41 +0000 (21:59 +0000)]
Add missing test header

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

12 years agoOnly perform checking of the predefines buffer when loading a
Douglas Gregor [Fri, 2 Dec 2011 21:56:05 +0000 (21:56 +0000)]
Only perform checking of the predefines buffer when loading a
precompiled header. Previously, we were trying to gather predefines
buffers from all kinds of AST files (which doesn't make sense) and
were performing some validation when AST files were loaded as main
files.

With these tweaks, using PCH files that import modules no longer fails
immediately (due to mismatched predefines buffers). However, module
visibility is lost, so this feature does not yet work.

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

12 years agoMake r145697 actually work.
Hans Wennborg [Fri, 2 Dec 2011 20:32:01 +0000 (20:32 +0000)]
Make r145697 actually work.

Use the canonical type of the typedef to compare with the underlying type.

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

12 years agoMake sure that name lookup in C checks whether a name is hidden.
Douglas Gregor [Fri, 2 Dec 2011 20:08:44 +0000 (20:08 +0000)]
Make sure that name lookup in C checks whether a name is hidden.

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

12 years agoMake conversion specifier warning refer to typedef if possible.
Hans Wennborg [Fri, 2 Dec 2011 19:22:15 +0000 (19:22 +0000)]
Make conversion specifier warning refer to typedef if possible.

For example, the warning for printf("%zu", 42.0);
changes from "conversion specifies type 'unsigned long'" to "conversion
specifies type 'size_t' (aka 'unsigned long')"

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

12 years agoWhen making a module visible, also make any of its exported modules
Douglas Gregor [Fri, 2 Dec 2011 19:11:09 +0000 (19:11 +0000)]
When making a module visible, also make any of its exported modules
visible, allowing one to create modules that import (and then
re-export) other modules.

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

12 years agoImplement (de-)serialization of the set of exported modules in a
Douglas Gregor [Fri, 2 Dec 2011 18:58:38 +0000 (18:58 +0000)]
Implement (de-)serialization of the set of exported modules in a
module map.

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

12 years agoNotify the AST writer (via ASTDeserializationListener) when a
Douglas Gregor [Fri, 2 Dec 2011 17:30:13 +0000 (17:30 +0000)]
Notify the AST writer (via ASTDeserializationListener) when a
(sub)module is read from an AST file. This makes sure that the AST
writer knows how to map all modules to their global IDs.

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

12 years agoImplement name hiding for macro definitions within modules, such that
Douglas Gregor [Fri, 2 Dec 2011 15:45:10 +0000 (15:45 +0000)]
Implement name hiding for macro definitions within modules, such that
only the macro definitions from visible (sub)modules will actually be
visible. This provides the same behavior for macros that r145640
provided for declarations.

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

12 years agoFix bitfield handling for record layout with #pragma pack. <rdar://problem/10494810...
Eli Friedman [Fri, 2 Dec 2011 02:38:48 +0000 (02:38 +0000)]
Fix bitfield handling for record layout with #pragma pack.  <rdar://problem/10494810> and PR9560.

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

12 years agoruntime/Linux: Initial support for tying compiler-rt build into Clang build on
Daniel Dunbar [Fri, 2 Dec 2011 02:31:32 +0000 (02:31 +0000)]
runtime/Linux: Initial support for tying compiler-rt build into Clang build on
Linux.
 - Currently just builds a full library, and only on x86, and only for the
   target arch.

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

12 years agoAdd support for AVX registers to clang inline asm. Add a small testcase
Eric Christopher [Fri, 2 Dec 2011 02:12:16 +0000 (02:12 +0000)]
Add support for AVX registers to clang inline asm. Add a small testcase
and update the Sema testcase with a register that we won't hit for a while
I hope.

Fixes rdar://10510405

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

12 years agoClean up some oddly gratuitous vertical whitespace.
Eric Christopher [Fri, 2 Dec 2011 02:12:12 +0000 (02:12 +0000)]
Clean up some oddly gratuitous vertical whitespace.

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

12 years agoRename function.
Eric Christopher [Fri, 2 Dec 2011 02:12:09 +0000 (02:12 +0000)]
Rename function.

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

12 years agoImplementing parsing and resolution of module export declarations
Douglas Gregor [Fri, 2 Dec 2011 01:47:07 +0000 (01:47 +0000)]
Implementing parsing and resolution of module export declarations
within module maps, which will (eventually) be used to re-export a
module from another module. There are still some pieces missing,
however.

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

12 years agoFix test regression introduced by r145656. When seeing a string literal that isn...
Ted Kremenek [Fri, 2 Dec 2011 01:30:14 +0000 (01:30 +0000)]
Fix test regression introduced by r145656.  When seeing a string literal that isn't accepted by 'asm', skip to the enclosing ')'.

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

12 years agoDiagnose use of wide string literal in 'asm' instead of crashing. Fixes <rdar:/...
Ted Kremenek [Fri, 2 Dec 2011 00:35:46 +0000 (00:35 +0000)]
Diagnose use of wide string literal in 'asm' instead of crashing.  Fixes <rdar://problem/10465079>.

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

12 years agoFix wrong-code bug when a const automatic variable of struct type has both a
Richard Smith [Fri, 2 Dec 2011 00:30:33 +0000 (00:30 +0000)]
Fix wrong-code bug when a const automatic variable of struct type has both a
mutable member and a constant initializer. We'd previously promoted such
variables to global constants, resulting in nasal demons if the mutable member
was modified.

This is only a temporary fix. The subtle interplay between isConstantInitializer
and CGExprConstant is very bug-prone; there are some other issues in this area
which I will be addressing in subsequent, more major reworking of this code.

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

12 years ago[asan] update docs to allow, but discourage, -O0
Kostya Serebryany [Fri, 2 Dec 2011 00:24:42 +0000 (00:24 +0000)]
[asan] update docs to allow, but discourage, -O0

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

12 years agoWhen we're passing a vector with an illegal type through memory on x86-64, use byval...
Eli Friedman [Fri, 2 Dec 2011 00:11:43 +0000 (00:11 +0000)]
When we're passing a vector with an illegal type through memory on x86-64, use byval so we're sure the backend does the right thing.  Fixes va_arg with illegal vectors and an obscure ABI mismatch with __m64 vectors.

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

12 years agoDriver/Darwin: Add ASAN runtime library link support.
Daniel Dunbar [Thu, 1 Dec 2011 23:40:18 +0000 (23:40 +0000)]
Driver/Darwin: Add ASAN runtime library link support.

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