Aaron Ballman [Mon, 31 Mar 2014 13:14:44 +0000 (13:14 +0000)]
Reapplying r204952 a second time.
Clean up the __has_attribute implementation without modifying its behavior.
Replaces the tablegen-driven AttrSpellings.inc, which lived in the lexing layer with AttrHasAttributeImpl.inc, which lives in the basic layer. Updates the preprocessor to call through to this new functionality which can take additional information into account (such as scopes and syntaxes).
Expose the ability for parts of the compiler to ask whether an attribute is supported for a given spelling (including scope), syntax, triple and language options.
Chandler Carruth [Sun, 30 Mar 2014 14:04:32 +0000 (14:04 +0000)]
Force a header file input to the headermap test to have different
contents than the header file by the same name under the system header
search root. Surprisingly, this is required to get the test to pass on
some systems.
So, it turns out that there exist filesystems in the world which unique
the inode of all files based on their contents. This results in two
files with the same contents at different paths suddenly having the same
inode. This doesn't actually cause any problems in practice as the
contents are the same, and the path used to access the files are the
same. However, it can cause tests like this one to be more brittle
because the file manager ends up de-duplicating the file entries by
inode. We don't have any other really easy ways to observe the behavior
shift because the whole point is that the #include written in the source
code doesn't contain the information -- instead it is contained in the
header map.
If folks have other solutions they would prefer, I'm more than happy to
work on them, but this seems a reasonable way to ensure that the test in
question exercises the code it wants to exercise.
Chandler Carruth [Sun, 30 Mar 2014 13:40:57 +0000 (13:40 +0000)]
[ARM64] Use %clang_cc1 consistently in the new arm64 codegen tests.
Really, all tests outside of the Driver tree should use %clang_cc1, but
these are new and easy to fix, and many of them use buitlin headers
which don't work as well without using %clang_cc1.
Hal Finkel [Sun, 30 Mar 2014 13:00:06 +0000 (13:00 +0000)]
[PowerPC] Make -pg generate calls to _mcount not mcount
At least on REL6 (Linux/glibc 2.12), the proper symbol for generating gprof
data is _mcount, not mcount. Prior to this change, compiling with -pg would
generate linking errors (because of unresolved references to mcount), after
this change -pg seems at least minimally functional.
Chandler Carruth [Sun, 30 Mar 2014 12:05:24 +0000 (12:05 +0000)]
[Allocator] Remove forward declarations of BumpPtrAllocator. These
aren't necessary and will break when it changes to be a typedef of
a class template.
David Majnemer [Sun, 30 Mar 2014 06:44:54 +0000 (06:44 +0000)]
Sema: Implement DR317
Summary:
Declaring a function as inline after it has been defined is in violation
of [dcl.fct.spec]p4. The program would get a strong definition instead
of getting a function with linkonce_odr linkage.
David Majnemer [Sun, 30 Mar 2014 06:34:26 +0000 (06:34 +0000)]
MS ABI: Simplify MangleByte
The delta between '\xe1' and '\xc1' is equivalent to the one between 'a'
and 'A'. This allows us to reuse the computation between '\xe1' and
'\xfa' for the '\xc1' to '\xda' case.
Tim Northover [Sat, 29 Mar 2014 15:09:55 +0000 (15:09 +0000)]
CodeGen: Allow different RTTI emission strategies
Some ABIs and C++ libraries may make different trade-offs in how RTTI
is emitted (currently with respect to visibility and so on). This
implements one scheme, as used by ARM64.
David Majnemer [Sat, 29 Mar 2014 14:19:55 +0000 (14:19 +0000)]
CodeGen: Don't crash when replacing functions
The peculiarities of C99 create scenario where an LLVM IR function
declaration may need to be replaced with a definition baring a different
type because the prototype and definition are not required to agree.
However, we were not properly deferring this when it occurred.
Richard Smith [Fri, 28 Mar 2014 23:32:39 +0000 (23:32 +0000)]
PR19278: Align ASTTemplateArgumentListInfo to match its following dynamic array
of TemplateArgumentLocs. 'uint64_t' has higher alignment requirements than a
pointer on some platforms.
Hans Wennborg [Fri, 28 Mar 2014 20:45:05 +0000 (20:45 +0000)]
Try to fix the cl-options.c test on ARM bots
The test was failing because clang-cl changes the default triple
to target MSVC-style Win32. This is kind of wonky, but hasn't been
a problem until we started warning:
Objective-C. revert r204965. This will make
-Wselector-type-mismatch default again. After
internal discussions, we think that in most cases
it has helped our developers find hard to detect
undefined behaviors. We are going to provide a syntax
(and fix-it) to suppress the warning in remaining of
false positive cases.
-u behaviour is apparently not portable between linkers (see cfe-commits
discussions for r204379 and r205012). I've moved the logic to IRGen,
where it should have been in the first place.
I don't have a Linux system to test this on, so it's possible this logic
*still* doesn't pull in the instrumented profiling runtime on Linux.
I'm in the process of getting tests going on the compiler-rt side
(llvm-commits "[PATCH] InstrProf: Add initial compiler-rt test"). Once
we have tests for the full flow there, the runtime logic should get a
whole lot less brittle.
Use the new Windows environment for target detection
This follows the LLVM change to canonicalise the Windows target triple
spellings. Rather than treating each Windows environment as a single entity,
the environments are now modelled properly as an environment. This is a
mechanical change to convert the triple use to reflect that change.
Aaron Ballman [Thu, 27 Mar 2014 20:19:24 +0000 (20:19 +0000)]
Clean up the __has_attribute implementation without modifying its behavior.
Replaces the tablegen-driven AttrSpellings.inc, which lived in the lexing layer with AttrHasAttributeImpl.inc, which lives in the basic layer. Updates the preprocessor to call through to this new functionality which can take additional information into account (such as scopes and syntaxes).
Expose the ability for parts of the compiler to ask whether an attribute is supported for a given spelling (including scope), syntax, triple and language options.
David Tweed [Thu, 27 Mar 2014 16:34:11 +0000 (16:34 +0000)]
Enforce the restriction that a parameter to a kernel function
cannot be a pointer to the private address space (as clarified
in the OpenCL 1.2 specification).
Dmitri Gribenko [Thu, 27 Mar 2014 15:40:39 +0000 (15:40 +0000)]
Comment parsing: when comment ranges are deserialized from multiple modules,
correctly order comments in SourceManager::isBeforeInTranslationUnit() order
Unfortunately, this is not as simple as it was implemented previously, and
actually requires doing a merge sort.
Rafael Espindola [Thu, 27 Mar 2014 15:27:20 +0000 (15:27 +0000)]
Handle and warn on aliases to weak aliases.
This produces valid IR now that llvm rejects aliases to weak aliases and warns
the user that the resolution is not changed if the weak alias is overridden.
Chandler Carruth [Thu, 27 Mar 2014 10:45:22 +0000 (10:45 +0000)]
[cleanup] Stop specifying size overrides for BumpPtrAllocators.
These don't seem to have any real point. Let's start with
IndexingContext. I can't come up with any conceivable reason to have
many hundereds of thousands of these alive in an address space which
would make the 4x difference in allocated (but unused) memory for the
string scratch buffer a significant memory usage problem.
The EditedSource one is somewhat more surprising. This is an 8x increase
in the memory allocated (but not used) per editted source file. However,
for this to realistically be a problem, you would need to have over half
a million editted source files in a single address space, and even that
would only really have problems on 32-bit Windows where you really only
have 2gb of virtual address space. And what's more important, the fix to
this if it is actually an issue shouldn't be to shrink the allocator's
size, it is to pass a single allocator into *many* edited source file
objects and let them share the memory.
These were the only two uses of custom sized BumpPtrAllocators
(excluding ones in the JIT using a custom allocation strategy) in all of
LLVM, Clang, LLD, LLDB, or Polly. I don't think we actually need this
complexity in the primary BumpPtrAllocator at all and am planning to
remove it.
Reid Kleckner [Thu, 27 Mar 2014 00:00:03 +0000 (00:00 +0000)]
MS asm: Filter out fpsw clobbers
When parsing MS inline assembly, we note that fpsw is an implicit def of
most x87 FP operations, and add it to the clobber list. However, we
don't recognize fpsw as a gcc register name, and we assert. Clang
always adds an fpsr clobber, which means the same thing to LLVM, so we
can just use that.
This test case was broken by my LLVM change r196939.
Eric Christopher [Wed, 26 Mar 2014 23:09:30 +0000 (23:09 +0000)]
Just call getContextDescriptor to get the context for subprograms
instead of rolling an inefficient version of the function. This
changes some order of emission of metadata nodes, fix up those
testcases and make them more flexible to some changes.
Objective-C. Fixes a bogus warning on unimplemented
selectors because we were not going through entire
elements in list of all implemented selectors.
// rdar://16428638