Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
#include "clang/Sema/Sema.h"
#include "clang/Sema/SemaDiagnostic.h"

// Implements the CValueExtractionPrinter interface.
extern "C" {
CLING_LIB_EXPORT
void cling_SetValueNoAlloc(void* /*cling::Value* V*/) {}
CLING_LIB_EXPORT
void cling_SetValueWithAlloc(void* /*cling::Value* V*/) {}
}

using namespace clang;

namespace cling {
Expand Down Expand Up @@ -436,6 +444,10 @@ namespace {
return VSError(m_Sema, E, "cling::runtime::gCling");
if (!(NSD = utils::Lookup::Namespace(m_Sema, "internal", NSD)))
return VSError(m_Sema, E, "cling::runtime::internal namespace");
} else {
// C, ObjC,...
if (!(NSD = utils::Lookup::Namespace(m_Sema, "cling")))
return VSError(m_Sema, E, "cling namespace");
}
LookupResult R(*m_Sema, &m_Context->Idents.get("setValueNoAlloc"),
SourceLocation(), Sema::LookupOrdinaryName,
Expand Down
10 changes: 5 additions & 5 deletions interpreter/cling/test/Driver/C.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

// Validate cling C mode.

// Fix value printing!

int printf(const char*,...);
printf("CHECK 123 %p\n", gCling); // CHECK: CHECK 123

12 // expected-error {{ValueExtractionSynthesizer could not find: 'cling::runtime::internal::setValueNoAlloc'.}}

32 // expected-error {{ValueExtractionSynthesizer could not find: 'cling::runtime::internal::setValueNoAlloc'.}}
int i = 1 // CHECK: (int) 1
sizeof(int) // CHECK: (unsigned long) 4
int x = sizeof(int);
printf("CHECK %d\n", x); // CHECK: CHECK 4

// expected-no-diagnostics
.q
Loading