forked from OSchip/llvm-project
				
			MS extension: Make __noop be the integer zero, not void
We still don't accept '__noop;', and we don't consider __noop to be the integer literal zero. More work is needed. llvm-svn: 212839
This commit is contained in:
		
							parent
							
								
									10cd0f457a
								
							
						
					
					
						commit
						ed5d4adb36
					
				| 
						 | 
					@ -679,7 +679,7 @@ BUILTIN(__builtin_rindex, "c*cC*i", "Fn")
 | 
				
			||||||
// Microsoft builtins.  These are only active with -fms-extensions.
 | 
					// Microsoft builtins.  These are only active with -fms-extensions.
 | 
				
			||||||
LANGBUILTIN(_alloca,      "v*z", "n", ALL_MS_LANGUAGES)
 | 
					LANGBUILTIN(_alloca,      "v*z", "n", ALL_MS_LANGUAGES)
 | 
				
			||||||
LANGBUILTIN(__assume,     "vb",  "n", ALL_MS_LANGUAGES)
 | 
					LANGBUILTIN(__assume,     "vb",  "n", ALL_MS_LANGUAGES)
 | 
				
			||||||
LANGBUILTIN(__noop,       "v.",  "n", ALL_MS_LANGUAGES)
 | 
					LANGBUILTIN(__noop,       "i.",  "n", ALL_MS_LANGUAGES)
 | 
				
			||||||
LANGBUILTIN(__debugbreak, "v",   "n", ALL_MS_LANGUAGES)
 | 
					LANGBUILTIN(__debugbreak, "v",   "n", ALL_MS_LANGUAGES)
 | 
				
			||||||
LANGBUILTIN(__va_start,   "vc**.", "nt", ALL_MS_LANGUAGES)
 | 
					LANGBUILTIN(__va_start,   "vc**.", "nt", ALL_MS_LANGUAGES)
 | 
				
			||||||
LANGBUILTIN(_InterlockedCompareExchange, "LiLiD*LiLi", "n", ALL_MS_LANGUAGES)
 | 
					LANGBUILTIN(_InterlockedCompareExchange, "LiLiD*LiLi", "n", ALL_MS_LANGUAGES)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1515,7 +1515,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
 | 
				
			||||||
    return EmitBuiltinNewDeleteCall(FD->getType()->castAs<FunctionProtoType>(),
 | 
					    return EmitBuiltinNewDeleteCall(FD->getType()->castAs<FunctionProtoType>(),
 | 
				
			||||||
                                    E->getArg(0), true);
 | 
					                                    E->getArg(0), true);
 | 
				
			||||||
  case Builtin::BI__noop:
 | 
					  case Builtin::BI__noop:
 | 
				
			||||||
    return RValue::get(nullptr);
 | 
					    // __noop always evaluates to an integer literal zero.
 | 
				
			||||||
 | 
					    return RValue::get(ConstantInt::get(IntTy, 0));
 | 
				
			||||||
  case Builtin::BI_InterlockedExchange:
 | 
					  case Builtin::BI_InterlockedExchange:
 | 
				
			||||||
  case Builtin::BI_InterlockedExchangePointer:
 | 
					  case Builtin::BI_InterlockedExchangePointer:
 | 
				
			||||||
    return EmitBinaryAtomic(*this, llvm::AtomicRMWInst::Xchg, E);
 | 
					    return EmitBinaryAtomic(*this, llvm::AtomicRMWInst::Xchg, E);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,9 +5,9 @@ class A {
 | 
				
			||||||
  ~A() {}
 | 
					  ~A() {}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void f() {
 | 
					int f() {
 | 
				
			||||||
// CHECK: @_Z1fv
 | 
					// CHECK: @_Z1fv
 | 
				
			||||||
// CHECK-NOT: call void @_ZN1AD1Ev
 | 
					// CHECK-NOT: call void @_ZN1AD1Ev
 | 
				
			||||||
// CHECK: ret void
 | 
					// CHECK: ret i32 0
 | 
				
			||||||
  __noop(A());
 | 
					  return __noop(A());
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue