aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/AsmWriter.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-29 20:29:48 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-29 20:29:48 +0000
commitb951bc02839e9862e02e17c7ea83e6437fc13442 (patch)
tree4ffa41ba3491e9ffc264f6f917be0d44f540c33f /lib/VMCore/AsmWriter.cpp
parentd45bff90954220d64af0ab776fd5c0e50654406f (diff)
For PR950:
Remove all grammar conflicts from assembly parsing. This change involves: 1. Making the "type" keyword not a primitive type (removes several reduce/reduce conflicts) 2. Being more specific about which linkage types are allowed for functions and global variables. In particular "appending" can no longer be specified for a function. A differentiation was made between the various internal and external linkage types. 3. Introduced the "define" keyword which is now required when defining a function. This disambiguates several cases where a named function return type could get confused with the definition of a new type. Using the keyword eliminates all shift/reduce conflicts and the remaining reduce/reduce conflicts. These changes are necessary to implement the function parameter attributes that will be introduced soon. Adding the function parameter attributes in the presence of the shift/reduce and reduce/reduce conflicts led to severe ambiguities that caused the parser to report syntax errors that needed to be resolved. This patch resolves them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32770 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/AsmWriter.cpp')
-rw-r--r--lib/VMCore/AsmWriter.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 268d3f5cfc..eb2f3fdf57 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -921,7 +921,8 @@ void AssemblyWriter::printFunction(const Function *F) {
case GlobalValue::ExternalWeakLinkage: Out << "declare extern_weak "; break;
default: Out << "declare ";
}
- else
+ else {
+ Out << "define ";
switch (F->getLinkage()) {
case GlobalValue::InternalLinkage: Out << "internal "; break;
case GlobalValue::LinkOnceLinkage: Out << "linkonce "; break;
@@ -935,6 +936,7 @@ void AssemblyWriter::printFunction(const Function *F) {
cerr << "GhostLinkage not allowed in AsmWriter!\n";
abort();
}
+ }
// Print the calling convention.
switch (F->getCallingConv()) {