Simple test for Standard Library headers, and a few more workarounds
This commit is contained in:
parent
0aa66b1e48
commit
38b773ad3e
@ -107,6 +107,9 @@ namespace cling {
|
||||
void AutoloadCallback::InsertIntoAutoloadingState (clang::Decl* decl,
|
||||
std::string annotation) {
|
||||
|
||||
if (annotation == "")
|
||||
return;
|
||||
|
||||
clang::Preprocessor& PP = m_Interpreter->getCI()->getPreprocessor();
|
||||
const FileEntry* FE = 0;
|
||||
SourceLocation fileNameLoc;
|
||||
@ -114,6 +117,8 @@ namespace cling {
|
||||
const DirectoryLookup* LookupFrom = 0;
|
||||
const DirectoryLookup* CurDir = 0;
|
||||
|
||||
|
||||
|
||||
FE = PP.LookupFile(fileNameLoc, annotation, isAngled, LookupFrom, CurDir,
|
||||
/*SearchPath*/0, /*RelativePath*/ 0,
|
||||
/*suggestedModule*/0, /*SkipCache*/false,
|
||||
|
@ -140,8 +140,9 @@ namespace cling {
|
||||
if (D->getSourceRange().isInvalid())
|
||||
return;
|
||||
std::string file = m_SMgr.getFilename(D->getLocStart());
|
||||
// assert ( file.length() != 0 && "Filename Should not be blank");
|
||||
m_Out << " __attribute__((annotate(\""
|
||||
<< DynamicLibraryManager::normalizePath(file);
|
||||
<< file;
|
||||
if (!extra.empty())
|
||||
m_Out << " " << extra;
|
||||
m_Out << "\"))) ";
|
||||
@ -271,6 +272,16 @@ namespace cling {
|
||||
}
|
||||
|
||||
void ForwardDeclPrinter::VisitTypedefDecl(TypedefDecl *D) {
|
||||
// llvm::StringRef str = D->getTypeSourceInfo()->getType().getAsString();
|
||||
// if (str.startswith("enum")) {
|
||||
//// std::pair<StringRef,StringRef> pair = str.split(' ');
|
||||
//// m_Out << pair.first;
|
||||
//// prettyPrintAttributes(D,"1");
|
||||
//// m_Out << pair.second << ": unsigned int ";
|
||||
// m_SkipFlag = true;
|
||||
// //need something more
|
||||
// return;
|
||||
// }
|
||||
if (!m_Policy.SuppressSpecifiers) {
|
||||
m_Out << "typedef ";
|
||||
|
||||
|
@ -222,6 +222,7 @@ namespace cling {
|
||||
I = IncrParserTransactions.begin(), E = IncrParserTransactions.end();
|
||||
I != E; ++I)
|
||||
m_IncrParser->commitTransaction(*I);
|
||||
// EnableAutoloading();
|
||||
}
|
||||
|
||||
Interpreter::~Interpreter() {
|
||||
@ -1238,7 +1239,8 @@ namespace cling {
|
||||
return;
|
||||
}
|
||||
void Interpreter::EnableAutoloading() {
|
||||
setCallbacks(new AutoloadCallback(this));
|
||||
if (!getCallbacks())
|
||||
setCallbacks(new AutoloadCallback(this));
|
||||
}
|
||||
|
||||
} //end namespace cling
|
||||
|
@ -74,6 +74,7 @@ namespace cling {
|
||||
MetaSema::ActionResult MetaSema::actOnTCommand(llvm::StringRef inputFile,
|
||||
llvm::StringRef outputFile) {
|
||||
m_Interpreter.GenerateAutoloadingMap(inputFile, outputFile);
|
||||
m_Interpreter.EnableAutoloading();
|
||||
return AR_Success;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ gCling->EnableAutoloading();
|
||||
#include "test_auto_forwarding.h"
|
||||
#include "Def2.h"
|
||||
|
||||
gCling->GenerateAutoloadingMap("Enum.h","fwd_enums.h");
|
||||
.T Enum.h fwd_enums.h
|
||||
#include "fwd_enums.h"
|
||||
#include "Enum.h"
|
||||
|
||||
|
@ -8,31 +8,10 @@
|
||||
|
||||
// RUN: cat %s | %cling -I %S -Xclang -verify
|
||||
// Test stlFwd
|
||||
// Only for reference purposes, doesn't actually use FwdPrinter
|
||||
namespace std {
|
||||
//XFAIL: *
|
||||
.T Stlinc.h stl_test.h
|
||||
#include "stl_test.h"
|
||||
//expected-warning {{}}
|
||||
|
||||
template <typename T,typename A> class __attribute__((annotate("vector"))) vector;
|
||||
template <typename T,typename A> class __attribute__((annotate("list"))) list;
|
||||
template <typename K,typename T,typename C,typename A> class __attribute__((annotate("map"))) map;
|
||||
|
||||
template <typename Ch,typename Tr,typename A> class basic_string;
|
||||
template <typename T> class char_traits;
|
||||
template <typename T> class allocator;
|
||||
typedef basic_string<char,char_traits<char>,allocator<char>> string __attribute__((annotate("string"))) ;
|
||||
|
||||
template <typename R> void sort(R,R) __attribute__((annotate("algorithm")));
|
||||
template <typename R,typename C> void sort(R,R,C) __attribute__((annotate("algorithm")));
|
||||
|
||||
template< bool B, typename T> struct __attribute__((annotate("type_traits"))) enable_if;
|
||||
}
|
||||
|
||||
#include<vector>
|
||||
#include<list>
|
||||
#include<type_traits>
|
||||
#include<map>
|
||||
#include<algorithm>
|
||||
#include<string>
|
||||
|
||||
//expected-no-diagnostics
|
||||
.q
|
||||
|
||||
|
6
test/Autoloading/Stlinc.h
Normal file
6
test/Autoloading/Stlinc.h
Normal file
@ -0,0 +1,6 @@
|
||||
#include <map>
|
||||
#include <type_traits>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
//4 diffferent sorts of headers: containers, traits, functions, traditional classes
|
Loading…
x
Reference in New Issue
Block a user