2014-01-07 11:57:02 +01:00
//------------------------------------------------------------------------------
// CLING - the C++ LLVM-based InterpreterG :)
//
// This file is dual-licensed: you can choose to license it under the University
// of Illinois Open Source License or the GNU Lesser General Public License. See
// LICENSE.TXT for details.
//------------------------------------------------------------------------------
2013-08-21 12:36:48 +02:00
// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s
2012-09-05 09:37:39 +00:00
// XFAIL: *
// Test the ability of including a wrong file see diagnostics and remove the
// cached files so that all the changes are going to be seen next time it gets
// included.
2013-08-21 12:36:48 +02:00
. storeState " testUncacheFile "
2012-09-05 09:37:39 +00:00
# include <iostream>
# include <fstream>
// cleanup
remove ( " TmpClassDef.h " ) ;
// clang caches the missed too. If the file is missing it doesn't matter whether
// we create it later or not.
# include "TmpClassDef.h"
std : : ofstream myfile ;
myfile . open ( " TmpClassDef.h " ) ;
myfile < < " class MyClass{}; \n "
myfile < < " error_here; " ;
myfile < < " // expected-error {{C++ requires a type specifier for all declarations}} \n "
myfile . close ( ) ;
# include "TmpClassDef.h"
myfile . open ( " TmpClassDef.h " ) ;
myfile < < " class MyClass{ \n " ;
myfile < < " public: \n " ;
myfile < < " int gimme12(){ \n " ;
myfile < < " return 12; \n "
myfile < < " } \n "
myfile < < " }; \n " ;
myfile . close ( ) ;
# include "TmpClassDef.h"
MyClass my ;
my . gimme12 ( )
// CHECK: (int const) 12
2013-08-21 12:36:48 +02:00
. compareState " testUncacheFile "
// CHECK-NOT: File with AST differencies stored in: testUncacheFileAST.diff
. q