summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2013-07-26 20:42:57 +0000
committerAdrian Prantl <aprantl@apple.com>2013-07-26 20:42:57 +0000
commitb0e603c63813c8378e35a75408ab4cefe71e93e2 (patch)
tree78b99b34dbfd49c1dccba5751ae873fc2338eae0 /lib/CodeGen/CodeGenFunction.h
parentb28b04407e6ed06431cb58176268ab719e01fae8 (diff)
downloadclang-b0e603c63813c8378e35a75408ab4cefe71e93e2.tar.gz
clang-b0e603c63813c8378e35a75408ab4cefe71e93e2.tar.bz2
clang-b0e603c63813c8378e35a75408ab4cefe71e93e2.tar.xz
Debug Info / EmitCallArgs: arguments may modify the debug location.
Restore it after each argument is emitted. This fixes the scope info for inlined subroutines inside of function argument expressions. (E.g., anything STL). rdar://problem/12592135 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187240 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.h')
-rw-r--r--lib/CodeGen/CodeGenFunction.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
index bd729205a1..f677a5d0e8 100644
--- a/lib/CodeGen/CodeGenFunction.h
+++ b/lib/CodeGen/CodeGenFunction.h
@@ -2483,8 +2483,13 @@ private:
template<typename T>
void EmitCallArgs(CallArgList& Args, const T* CallArgTypeInfo,
CallExpr::const_arg_iterator ArgBeg,
- CallExpr::const_arg_iterator ArgEnd) {
- CallExpr::const_arg_iterator Arg = ArgBeg;
+ CallExpr::const_arg_iterator ArgEnd,
+ bool ForceColumnInfo = false) {
+ CGDebugInfo *DI = getDebugInfo();
+ SourceLocation CallLoc;
+ if (DI) CallLoc = DI->getLocation();
+
+ CallExpr::const_arg_iterator Arg = ArgBeg;
// First, use the argument types that the type info knows about
if (CallArgTypeInfo) {
@@ -2513,6 +2518,10 @@ private:
"type mismatch in call argument!");
#endif
EmitCallArg(Args, *Arg, ArgType);
+
+ // Each argument expression could modify the debug
+ // location. Restore it.
+ if (DI) DI->EmitLocation(Builder, CallLoc, ForceColumnInfo);
}
// Either we've emitted all the call args, or we have a call to a
@@ -2523,8 +2532,12 @@ private:
}
// If we still have any arguments, emit them using the type of the argument.
- for (; Arg != ArgEnd; ++Arg)
+ for (; Arg != ArgEnd; ++Arg) {
EmitCallArg(Args, *Arg, Arg->getType());
+
+ // Restore the debug location.
+ if (DI) DI->EmitLocation(Builder, CallLoc, ForceColumnInfo);
+ }
}
const TargetCodeGenInfo &getTargetHooks() const {